/*
 * thorium-website — the app's own stylesheet.
 *
 * ==Why ONE sheet==
 * There were ten: `thorium`, `thorium-menu`, `homepage`, `documentation-page`, `codeblock`,
 * `contact-us`, `section`, `manage-order-sections-page`, `manage-sections-page`,
 * `order-sections-page`. Every rule in them was scoped to Fomantic markup (`.ui.grid`, `.ui menu`,
 * `.ui.content.container`, `.ui.container.crud-section`) — and the layer's shipped sheet has **0**
 * `.ui` selectors now (the 0.1.0 jar this app was on had 526), so each of those sheets styled
 * nothing that still exists. Two of them (`manage-sections-page`, `order-sections-page`) were
 * referenced by nobody at all: dead files whose selectors belonged to a Vue page no longer in the
 * tree. Translating them would have preserved a design nobody asked for, in a vocabulary the layer
 * deleted.
 *
 * So this sheet holds only what is genuinely this app's and has no published component:
 *
 *   • `.thorium-hero` — the landing page's masthead (the layer has no "hero" block);
 *   • `.thorium-feature*` — the landing page's capability grid;
 *   • `.thorium-docs*`, `.thorium-docnav*` — the documentation page's three-column reading layout;
 *   • `.thorium-order*` — the section-reorder list;
 *   • three one-offs: `.thorium-brand` (the bar's logo), `.thorium-scroll-top`, `.thorium-copy`.
 *
 * The footer's build ref (`.eca-page-footer__commit`) is NOT styled here any more:
 * `elementum-eca-ui 0.2.31` added it to the `eca-page-footer` block (monospace, `tabular-nums`,
 * muted, one line at both widths) and, being monospaced, its box is stable across a sha change — so
 * the mask the gate paints over it cannot move. Restating it here would be the app-side copy of a
 * published component, which is what this sheet exists not to do.
 *
 * Everything else — buttons, badges, forms, messages, menus, the page header, the footer, the
 * confirm panel, the code box, the breadcrumb — is a published component (`ui-alias.css` /
 * `ui-system.css`) and is NOT restyled here. A rule that repeats a component in an app is how the
 * layer became patchy.
 *
 * Loaded by `Main`'s `EcaShell.pageModifier` `.styles` hook, after `EcaUiAssets.defaultPageStyles`
 * (so the tokens and components are available) and before UnoCSS.
 *
 * Two conventions, both from the design system: tokens only (no `#hex`, no bare `px`), and every
 * breakpoint is `min-width` — the base rules are the 360–390 px layout.
 */

/* ═══ 1. The bar ═══════════════════════════════════════════════════════════════════════════════ */

/* The bar's first item is the product: a mark and its name. `.eca-menu > .item` is the component
   (flex row, 44px target, padding) — this only sizes the mark inside it. */
.thorium-brand > img {
  display: block;
  height: 1.75rem;
  width: auto;
}

/* ═══ 2. The landing page ═══════════════════════════════════════════════════════════════════════ */

/* The masthead is a BLOCK, not a `position: fixed` plane with the page slid over it (`margin-top:
   90vh`, the old arrangement): the hero never left the viewport, it covered the first screen of
   content, and it printed on top of the page. Here it is a normal band the document flows past. */
.thorium-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 60vh;
  padding-block: var(--space-8);
  border-radius: var(--radius-box);
  /* The brand's own dark surface. `.eca-login` is the layer's other inverted surface; this app's
     hero is the second, and it needs a base the scrim below can darken. */
  background: #0f172a;
}

/* A scrim between the media and the words. The hero's ink is white, and `1.4.3` asks for 4.5:1
   against whatever frame of the backdrop is showing — measured on the animated glass, the top-left
   quarter is a light sky blue, where white body text came out at ~2.4:1. The gradient is the
   component's contrast guarantee, not a tint. */
.thorium-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgb(15 23 42 / 55%), rgb(15 23 42 / 78%));
}

/* The backdrop. It is an `<img>`, decorative and `aria-hidden`, positioned under the content. */
.thorium-hero__media {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The ink on this surface is white: it needs a scrim to stay above 4.5:1 whatever frame of the
     animation happens to be showing (WCAG 1.4.3). */
  opacity: 0.55;
}

.thorium-hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-block);
  width: 100%;
  max-width: var(--measure-narrow);
  padding-inline: var(--gutter);
  text-align: center;
}

.thorium-hero__logo {
  width: min(60vw, 22rem);
  height: auto;
  filter: drop-shadow(0 var(--space-1) var(--space-5) rgb(0 0 0 / 55%));
}

/* The page's one <h1>. It sits on dark media, so it takes the inverted ink of the hero rather than
   the document's — the same exception `eca-login.css` states for the sign-in surface. */
.thorium-hero__title,
.thorium-hero__lead {
  color: #fff;
  margin: 0;
  text-shadow: 0 1px var(--space-2) rgb(0 0 0 / 60%);
}

.thorium-hero__title {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.thorium-hero__lead {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  max-width: var(--measure);
}

.thorium-hero__actions {
  justify-content: center;
  margin: 0;
}

/* A control on the hero keeps its shape and takes the hero's ink: white on the media, not the
   document's dark ink on a transparent edge. */
.thorium-hero__actions .eca-btn-secondary {
  color: #fff;
  border-color: rgb(255 255 255 / 55%);
}

.thorium-hero__actions .eca-btn-secondary:hover {
  background: rgb(255 255 255 / 14%);
  border-color: #fff;
}

.thorium-home {
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
  padding-block: var(--gap-section);
}

/* The capability grid: as many 18rem columns as fit, never a fixed count (the old sheet hard-coded
   a 500px flex basis per cell and the six cells broke 3 / 2 / 1 with a ragged last row). */
.thorium-features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--gap-section);
}

/* Six capabilities read as 2 / 3 / 3: an auto-fit grid gave 4 + 2 at 1440, so the last row was a
   half-empty row of two. */
@media (min-width: 1200px) {
  .thorium-features__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.thorium-feature {
  display: flex;
  flex-direction: column;
  gap: var(--gap-inline);
  padding: var(--space-5);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
  background: var(--color-surface);
}

/* The glyph is the one piece of colour in the tile, and it is decoration: every feature states its
   own heading, so a reader without the glyph loses nothing (WCAG 1.4.1). */
.thorium-feature > .eca-icon {
  color: var(--color-primary);
}

.thorium-feature__title {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  margin: 0;
}

.thorium-feature__text {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* ═══ 3. The documentation page ═════════════════════════════════════════════════════════════════ */

/* Smooth anchor jumps for the "on this page" links, off for a reader who asked for less motion. */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.thorium-docs {
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
  min-width: 0;
}

/* One column at 360: the section list, then the prose, then the contents list. The section list is
   NOT hidden on a phone (the old sheet dropped both side columns below 768 and reached for a
   jQuery drawer to get navigation back — `jQuery.fn.sidebar` does not exist here, so a phone had no
   way to move between sections at all). */
.thorium-docs__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap-section);
  align-items: start;
  min-width: 0;
}

/* Base (360–639): the ARTICLE comes first and the section list follows it. A phone reader who has
   just tapped a link wants the page they asked for, not 26 links to the rest of the site — measured
   on `/section/Getting Started/Data-mapping` at 390: the prose began 1 140 px down the document. */
.thorium-docs__main {
  order: 1;
}

.thorium-docs__side {
  order: 2;
}

@media (min-width: 640px) {
  .thorium-docs__layout {
    grid-template-columns: 16rem minmax(0, 1fr);
  }

  .thorium-docs__main,
  .thorium-docs__side {
    order: 0;
  }
}

@media (min-width: 1200px) {
  .thorium-docs__layout {
    grid-template-columns: 16rem minmax(0, 1fr) 14rem;
  }
}

/* Sticky columns. `align-self: start` and NO `overflow` on the element or on an ancestor of it —
   an `overflow` on a scrollable child kills `position: sticky` silently. */
.thorium-docs__side,
.thorium-docs__toc {
  align-self: start;
  min-width: 0;
}

@media (min-width: 640px) {
  .thorium-docs__side,
  .thorium-docs__toc {
    position: sticky;
    top: var(--space-4);
    max-height: calc(100dvh - var(--space-6));
    overflow-y: auto;
  }
}

/* The contents column only exists where there is room for a third column. */
.thorium-docs__toc {
  display: none;
}

@media (min-width: 1200px) {
  .thorium-docs__toc {
    display: block;
  }
}

/* The prose is authored HTML from the database, so this is the one place the app styles bare
   elements: a readable measure, a heading rhythm, and a code box that scrolls instead of pushing the
   page sideways. It was `codeblock.min.css` (a `pre` box) plus a `documentation-page.min.css` full
   of `.ui.content.container` selectors that no longer matched anything. */
.thorium-docs__prose {
  min-width: 0;
  max-width: var(--measure);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.thorium-docs__prose h1,
.thorium-docs__prose h2,
.thorium-docs__prose h3 {
  color: var(--color-primary);
  line-height: var(--leading-snug);
  margin-block: var(--gap-section) var(--gap-inline);
}

.thorium-docs__prose > .thorium-docs__section + .thorium-docs__section {
  margin-block-start: var(--gap-section);
}

.thorium-docs__prose pre {
  position: relative;
  overflow-x: auto;
  max-width: 100%;
  /* The top of the block clears the copy control that `documentationPage.js` prepends: in a scroll
     box, `padding-inline-end` only takes effect at the END of the content, so a long first line still
     ran under the button (measured on `/section/Getting Started/Data-mapping`). Reserving a band
     above the code is the one placement that holds for every line length. */
  padding: var(--space-4);
  padding-block-start: calc(var(--space-4) + var(--space-5));
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-box);
  background: var(--color-surface-sunken);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm);
}

.thorium-docs__prose img,
.thorium-docs__prose table {
  max-width: 100%;
}

/* A wide table is the table's own scroll box, not the page's. */
.thorium-docs__prose table {
  display: block;
  overflow-x: auto;
}

.thorium-docs__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-block-start: var(--gap-inline);
  color: var(--color-muted);
  font-size: var(--text-xs);
}

/* The copy control sits in the code block's own top-right corner. */
.thorium-copy {
  position: absolute;
  top: var(--space-2);
  inset-inline-end: var(--space-2);
}

.thorium-scroll-top {
  display: none;
}

.thorium-scroll-top.is-visible {
  display: inline-flex;
  position: fixed;
  bottom: var(--space-4);
  inset-inline-end: var(--space-4);
  z-index: 40;
  box-shadow: var(--shadow-2);
}

/* The section list's own labels. `ul.eca-link-list` is the published list (`ui-alias.css`); these
   three are the group heading and the current-state mark. */
.thorium-docnav {
  display: flex;
  flex-direction: column;
  gap: var(--gap-block);
  min-width: 0;
}

.thorium-docnav__heading {
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-muted);
}

.thorium-docnav__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.thorium-docnav__label {
  font-weight: 600;
  color: var(--color-ink);
}

/* ── The section list's ink ──────────────────────────────────────────────────────────────────
 * `ui-system.css` paints every bare anchor inside the page column as a link —
 * `.eaw-page a:not([class*="eca-"]):not(.button):not(.item)` — which turned this list of
 * destinations into a wall of accent green, and left "you are here" as a difference of WEIGHT only
 * (measured on `/section/Getting Started/Data-mapping`: all 26 links `rgb(15, 107, 92)` at 550).
 * A navigation list reads as ink; the accent is reserved for the current page, which is the signal
 * `.eca-menu` already publishes and this component does not.
 *
 * The selectors are deliberately rank-for-rank the same shape as the rule they correct (one class
 * higher, `:not()` chain included) and appear AFTER it, so a change to that rule cannot silently
 * repaint this list: if it changes, this rule stops matching and the defect comes back visibly.
 * The fix belongs in the layer, next to `.eca-link-list`; it is stated here because this unit could
 * not touch `elementum-core-addons`.
 */
.eaw-page .thorium-docnav .eca-link-list a:not([class*="eca-"]):not(.button):not(.item) {
  color: var(--color-ink);
}

.eaw-page .thorium-docnav .eca-link-list a:not([class*="eca-"]):not(.button):not(.item):hover {
  color: var(--color-primary);
}

.eaw-page .thorium-docnav .eca-link-list a:not([class*="eca-"]):not(.button):not(.item)[aria-current="page"] {
  color: var(--color-primary);
  font-weight: 650;
}

.thorium-crumb__sep {
  color: var(--color-muted);
}

.thorium-contact__address {
  font-size: var(--text-lg);
  margin: 0;
}

.thorium-facts {
  margin-block-start: var(--gap-block);
}

/* ═══ 4. Manage sections & order ════════════════════════════════════════════════════════════════ */

.thorium-order {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.thorium-order__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: var(--border) solid var(--color-border);
  border-radius: var(--radius-field);
  background: var(--color-surface);
}

/* The drop zone is the gap between two rows: 1rem tall when idle, a drop target while a row is
   dragged over it. (It was styled through `#vue-app`, an id this page never rendered.) */
.thorium-order__zone {
  height: var(--space-4);
}

.thorium-order__zone.is-target {
  height: var(--space-7);
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-field);
  background: color-mix(in oklab, var(--color-primary) 10%, transparent);
}

/* Base: the two arrows are one compact PAIR beside the title (stacked, they took two rows and pushed
   the title off its own line at 390). From 640 they stack in the row's own left column. */
.thorium-order__move {
  display: flex;
  flex-direction: row;
  gap: var(--space-1);
}

@media (min-width: 640px) {
  .thorium-order__move {
    flex-direction: column;
  }
}

.thorium-order__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.thorium-order__hidden {
  color: var(--color-warning-ink);
}

/* Base: the actions take a row of their own under the title (a 390 screen has no room beside it);
   from 640 they sit on the row's far edge. Their two children keep their own width — an `.eca-btn`
   inside `.eca-actions` grows, so "Edit" was a full-width bar next to a small "Delete". */
.thorium-order__actions {
  margin-inline-start: 0;
  width: 100%;
  align-items: flex-start;
  border: 0;
  padding: 0;
}

.thorium-order__actions > * {
  flex: 0 0 auto;
}

@media (min-width: 640px) {
  .thorium-order__actions {
    margin-inline-start: auto;
    width: auto;
  }
}

/* The section form's rich-text field (`/mgmt/section/new`, `/mgmt/section/:id/edit`).

   `.eca-field` is `display: grid`, so the field's `<label>` is a GRID ITEM, and a grid item's default
   `min-width: auto` lets its content become the track's minimum. The Trumbowyg toolbar is one row of
   buttons, so it sized the track at **767 px inside a 309 px form** at 390 — 410 px of horizontal page
   overflow, the finding this app's gate reported on its first run. `min-width: 0` lets the item shrink;
   the shared sheet's `.trumbowyg-button-pane { overflow-x: auto }` then pans the toolbar exactly as it
   was designed to. This belongs in the shared layer once `elementum-eca-ui` gives a rich-text control
   the same rule (it is the same defect the milestone form had); until then it is the app's own hook. */
.thorium-section-value {
  min-width: 0;
}

/* ═══ 5. Print ═══════════════════════════════════════════════════════════════════════════════════ */

/* The layer's print block hides the nav, the footer and the skip-link. Two of this app's own pieces
   are chrome on paper as well: the hero's media and the "back to top" control. */
@media print {
  .thorium-hero__media,
  .thorium-hero__actions,
  .thorium-scroll-top,
  .thorium-copy {
    display: none !important;
  }

  .thorium-hero {
    min-height: 0;
  }

  .thorium-hero::after {
    display: none;
  }

  .thorium-hero__title,
  .thorium-hero__lead {
    color: #000;
    text-shadow: none;
  }
}
