/* brand.ormus.solutions page layout. Brand values come from tokens.css and
   fusion.css (loaded first); this file restates no color or font. */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
[data-motion="off"] { scroll-behavior: auto; }
[data-motion="off"] .surface-firm::after { animation: none; }
[data-motion="off"] .fusion-reveal { transition: none; }
@media (scripting: none) { .motion-toggle { display: none; } }
body {
  margin: 0;
  font-family: var(--ormus-font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ormus-fg);
  background: var(--ormus-deep);
  color-scheme: dark;
}
img, video, canvas, svg { max-width: 100%; display: block; }
a { color: var(--ormus-gold); text-underline-offset: 3px; }
a:hover { color: var(--ormus-gold-bright); }
code, pre { font-family: var(--ormus-font-mono); font-size: 0.85em; }
:focus-visible { outline: 2px solid var(--ormus-gold); outline-offset: 3px; border-radius: var(--ormus-radius); }
h2, h3 { text-wrap: balance; }
button.fusion-btn { font: 500 1rem var(--ormus-font-sans); line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 50;
  padding: 0.5rem 1rem; background: var(--ormus-gold); color: var(--ormus-on-gold);
  border-radius: var(--ormus-radius); text-decoration: none;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 0.75rem); }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(env(safe-area-inset-top, 0px) + 0.75rem) max(1rem, env(safe-area-inset-right, 0px)) 0.75rem max(1rem, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--ormus-hairline);
  background-color: var(--ormus-deep);
}
.wordmark { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; text-decoration: none; color: var(--ormus-ink); }
.wordmark img { width: 28px; height: 28px; }
.wordmark-name { font-family: var(--ormus-font-display); font-size: 1.5rem; font-weight: 400; line-height: 1; }
.wordmark .mono-label { margin-left: 0.25rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.topbar-actions .fusion-btn { font-size: 0.875rem; text-decoration: none; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 78rem;
  margin: 0 auto;
  padding-inline: 1.5rem;
}
.toc { position: sticky; top: 5.5rem; align-self: start; padding-block: 3rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.toc a {
  display: block; padding: 0.3rem 0 0.3rem 0.75rem;
  font-family: var(--ormus-font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ormus-ink-muted); text-decoration: none; border-left: 1px solid var(--ormus-hairline);
}
.toc a:hover { color: var(--ormus-ink); }
.toc a[aria-current="true"] { color: var(--ormus-gold); border-left-color: var(--ormus-gold); }

main { min-width: 0; }
main > section { padding-block: 5rem 1rem; border-top: 1px solid var(--ormus-hairline); }
main > section.hero { border-top: 0; }
.eyebrow { display: block; margin-bottom: 0.5rem; }
h2 { font-family: var(--ormus-font-display); font-weight: 400; font-size: clamp(2.1rem, 4vw, 2.9rem); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 1.5rem; }
h3 { font-family: var(--ormus-font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.25; margin: 0 0 0.5rem; }
.subhead { margin-top: 3.5rem; }
.intro, .prose p { max-width: 65ch; color: var(--ormus-ink); }
.intro { margin: 0 0 2rem; }
.note { max-width: 65ch; color: var(--ormus-ink-muted); font-size: 0.925rem; margin-top: 1.25rem; }
.rules { max-width: 65ch; margin: 2rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.5rem; color: var(--ormus-ink-muted); }
.rules li::marker { color: var(--ormus-gold); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-inline: 6px; margin-inline: -6px; padding-block: 4px; }

/* ── Hero ── */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 3rem; align-items: center; padding-top: 4rem; }
.hero h1 { font-family: var(--ormus-font-display); font-weight: 300; font-size: clamp(2.6rem, 5.2vw, 4.2rem); line-height: 1.02; letter-spacing: -0.01em; margin: 0.9rem 0 1.25rem; text-wrap: balance; }
.lead { font-size: 1.1rem; color: var(--ormus-ink-muted); max-width: 52ch; margin: 0 0 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.actions .fusion-btn, .kit-download .fusion-btn { text-decoration: none; }
.build { margin-top: 1.5rem; }
.hero-media { margin: 0; border-radius: var(--ormus-radius); overflow: hidden; border: 1px solid var(--ormus-hairline); aspect-ratio: 16 / 9; background: var(--ormus-deep); }
.hero-media video { width: 100%; height: 100%; object-fit: cover; }

/* ── Essence ── */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; margin: 2.5rem 0 0; }
.facts div { border-top: 1px solid var(--ormus-hairline); padding-top: 0.9rem; }
.facts dd { margin: 0.4rem 0 0; font-family: var(--ormus-font-display); font-size: 1.35rem; line-height: 1.3; }

/* ── Marks ── */
.marks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.mark { margin: 0; }
.mark-stage { position: relative; aspect-ratio: 1; background: var(--ormus-midnight); border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); }
.mark-stage img { position: absolute; inset: 12%; width: 76%; height: 76%; object-fit: contain; }
.mark figcaption { display: grid; gap: 0.2rem; margin-top: 0.75rem; color: var(--ormus-ink-muted); font-size: 0.925rem; }
.mark-name, .sigil-name, .swatch-name, .family-name { color: var(--ormus-ink); font-weight: 500; }

/* ── Color ── */
.swatch-group { margin-top: 2.5rem; }
.swatch-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 1rem; }
.swatch-group-head h3 { margin: 0; }
.swatch-group-head p { margin: 0; color: var(--ormus-ink-muted); font-size: 0.925rem; }
.swatch-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.swatch-row:has(> .swatch:nth-child(4)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.swatch { margin: 0; min-width: 0; }
.swatch-chip, .sample, .dot, .canvas-chip { forced-color-adjust: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.swatch-chip { aspect-ratio: 3 / 2; border-radius: var(--ormus-radius); border: 1px solid var(--ormus-hairline); }
.swatch figcaption { display: grid; gap: 0.1rem; margin-top: 0.6rem; font-size: 0.875rem; color: var(--ormus-ink-muted); }
.swatch-value {
  justify-self: start; padding: 0.1rem 0.35rem; margin-left: -0.35rem; text-align: left; overflow-wrap: anywhere;
  font-family: var(--ormus-font-mono); font-size: 0.8rem; color: var(--ormus-ink);
  background: none; border: 1px solid transparent; border-radius: var(--ormus-radius); cursor: copy;
}
.swatch-value:hover { border-color: var(--ormus-hairline); color: var(--ormus-gold); }
.swatch-var { font-size: 0.75rem; color: var(--ormus-ink-muted); overflow-wrap: anywhere; }

table { border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--ormus-hairline); vertical-align: middle; }
thead th { font-family: var(--ormus-font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ormus-ink-muted); font-weight: 400; }
tbody th { font-weight: 500; white-space: nowrap; }
.contrast { min-width: 40rem; }
.contrast td { white-space: nowrap; }
.sample { display: inline-grid; place-items: center; width: 2.4rem; height: 2rem; border-radius: var(--ormus-radius); border: 1px solid var(--ormus-hairline); font-family: var(--ormus-font-display); font-size: 1.15rem; margin-right: 0.4rem; }
.ratio { font-variant-numeric: tabular-nums; font-family: var(--ormus-font-mono); font-size: 0.8rem; color: var(--ormus-ink); }
.grade { font-size: 0.8rem; margin-left: 0.3rem; }
.grade-pass .grade { color: var(--ormus-ink); }
.grade-limit .grade { color: var(--ormus-gold); }
.grade-fail .grade { color: var(--ormus-ink-muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Type ── */
.families { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.family { display: grid; align-content: start; gap: 0.25rem; padding-top: 1rem; border-top: 1px solid var(--ormus-hairline); }
.family-glyph { display: block; height: 5rem; font-size: 4.5rem; line-height: 1; color: var(--ormus-gold); margin-bottom: 0.5rem; }
.family-role { color: var(--ormus-ink-muted); font-size: 0.925rem; }
.specimens { display: grid; }
.specimen { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1rem 2rem; padding-block: 1.25rem; border-top: 1px solid var(--ormus-hairline); align-items: baseline; }
.specimen-meta { display: grid; gap: 0.3rem; }
.specimen-key { font-family: var(--ormus-font-mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ormus-gold); }
.specimen-meta code { color: var(--ormus-ink-muted); font-size: 0.75rem; }
.specimen-sample { margin: 0; max-width: 60ch; }

/* ── Material ── */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 2.5rem; align-items: start; }
.split .rules { margin-top: 0; }
.material-compare { margin: 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); overflow: hidden; }
.material-half { aspect-ratio: 1 / 1.2; padding: 1rem; }
.material-flat { background: var(--ormus-deep); }
.material-compare figcaption { grid-column: 1 / -1; padding: 0.75rem 1rem; border-top: 1px solid var(--ormus-hairline); font-size: 0.85rem; color: var(--ormus-ink-muted); background: var(--ormus-deep); }

/* ── Shape ── */
.demo-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.demo-cards .card-title { font-family: var(--ormus-font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.25; color: var(--ormus-ink); margin: 0.5rem 0 0.25rem; }
.demo-cards p { margin: 0; color: var(--ormus-ink-muted); }
.demo-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }
.demo-buttons .fusion-btn { cursor: default; }

/* ── Motion ── */
.curve { margin: 0; }
.curve svg { width: 100%; max-width: 20rem; height: auto; overflow: visible; }
.curve-frame { fill: none; stroke: var(--ormus-hairline); }
.curve-grid { stroke: var(--ormus-hairline); stroke-dasharray: 2 4; }
.curve-handle { stroke: var(--ormus-ink-muted); stroke-width: 1; }
.curve-point { fill: var(--ormus-ink-muted); }
.curve-line { fill: none; stroke: var(--ormus-gold); stroke-width: 3; stroke-linecap: round; }
.curve figcaption { display: grid; gap: 0.25rem; margin-top: 1rem; color: var(--ormus-ink-muted); font-size: 0.875rem; }
.curve figcaption code { color: var(--ormus-ink); }
.reveal-stage { display: grid; gap: 1rem; justify-items: start; padding: 1.5rem; border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); min-height: 9rem; }
.reveal-demo { margin: 0; font-family: var(--ormus-font-display); font-size: 2rem; line-height: 1.15; font-weight: 300; }
.timings { width: 100%; margin-top: 1.25rem; }
.timings td:nth-child(2) { font-family: var(--ormus-font-mono); font-size: 0.8rem; white-space: nowrap; color: var(--ormus-gold); }
.timings td:last-child { color: var(--ormus-ink-muted); }

/* ── Sigils: four across, a short last row centered ── */
.sigils { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem 1rem; }
.sigil { margin: 0; flex: 0 0 calc((100% - 3rem) / 4); }
.sigil img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.sigil figcaption { display: grid; gap: 0.15rem; font-size: 0.85rem; color: var(--ormus-ink-muted); }

/* ── Canvas ── */
.graph { margin: 0; }
#graph-demo { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); background: var(--ormus-deep); }
.graph-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.75rem; font-size: 0.875rem; color: var(--ormus-ink-muted); }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.4rem; vertical-align: -0.05rem; }
.canvas-list { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 23rem), 1fr)); gap: 0.4rem 1.5rem; }
.canvas-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; font-size: 0.8rem; min-width: 0; }
.canvas-list li code { color: var(--ormus-ink); overflow-wrap: anywhere; min-width: 0; }
.canvas-list .swatch-value { margin-left: auto; color: var(--ormus-ink-muted); }
.canvas-chip { flex: none; width: 1.25rem; height: 1.25rem; border-radius: var(--ormus-radius); border: 1px solid var(--ormus-hairline); }

/* ── Decks ── */
.slides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.slide-frame { container-type: inline-size; }
.slide { aspect-ratio: 16 / 9; border-radius: var(--ormus-radius); border: 1px solid var(--ormus-hairline); padding: 6cqw 7cqw; display: flex; flex-direction: column; justify-content: flex-end; gap: 2cqw; overflow: hidden; }
.slide-tag { font-family: var(--ormus-font-mono); font-size: max(0.6rem, 2.6cqw); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ormus-gold); margin-bottom: auto; }
.slide-title { margin: 0; font-family: var(--ormus-font-display); font-weight: 300; font-size: 7.5cqw; line-height: 1.05; }
.slide-body { margin: 0; font-size: max(0.7rem, 2.8cqw); color: var(--ormus-ink-muted); max-width: 40ch; }
.slide--end { align-items: center; justify-content: center; }
.slide--end img { height: 38cqw; width: auto; }

/* ── Voice ── */
.voice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; }
.voice h3 { margin-bottom: 1rem; }
.voice .rules { margin-top: 0; }
.quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.quotes li { font-family: var(--ormus-font-display); font-size: 1.45rem; line-height: 1.3; padding-left: 1rem; border-left: 1px solid var(--ormus-gold); }

/* ── Kit ── */
.kit-download { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 2rem; color: var(--ormus-ink-muted); font-size: 0.925rem; }
.files { min-width: 32rem; width: 100%; }
.files tbody th { font-weight: 400; }
.files .file-path { display: block; margin-top: 0.15rem; color: var(--ormus-ink-muted); font-size: 0.72rem; }
.files td:last-child { color: var(--ormus-ink-muted); }
.snippet { margin-top: 1rem; border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); background: var(--ormus-code-bg); }
.snippet-head { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem 0.5rem 1rem; border-bottom: 1px solid var(--ormus-hairline); }
.snippet pre { margin: 0; padding: 1rem; overflow-x: auto; line-height: 1.6; color: var(--ormus-ink); }
.copy-btn { font: 500 0.8rem var(--ormus-font-sans); color: var(--ormus-ink); background: none; border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius); padding: 0.25rem 0.7rem; cursor: pointer; }
.copy-btn:hover { border-color: var(--ormus-gold); color: var(--ormus-gold); }

/* ── Ending ── */
.ending { display: grid; justify-items: center; gap: 0.75rem; text-align: center; padding: 6rem 1.5rem 7rem; border-top: 1px solid var(--ormus-hairline); margin-top: 4rem; }
.ending img { height: min(40vh, 22rem); width: auto; margin-bottom: 1.5rem; }
.ending p { margin: 0; }
.ending a { color: inherit; }

/* ── Section tabs for phones, toast ── */
.tabbar { display: none; }
.toast {
  position: fixed; right: 1rem; bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); z-index: 40;
  padding: 0.5rem 0.9rem; border-radius: var(--ormus-radius); border: 1px solid var(--ormus-gold);
  background: var(--ormus-deep); color: var(--ormus-ink); font-size: 0.85rem;
  opacity: 0; transform: translateY(0.5rem); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s var(--ormus-ease-reveal);
}
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 960px) {
  html { scroll-padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-inline: 1rem; }
  .toc { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 2.5rem; }
  main > section { padding-block: 3.5rem 0.5rem; }
  .topbar .wordmark .mono-label { display: none; }
  .tabbar {
    display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 0.6rem max(0.75rem, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 0.6rem) max(0.75rem, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--ormus-hairline);
    background-color: var(--ormus-deep);
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a {
    flex: none; padding: 0.55rem 0.9rem; min-height: 44px; display: inline-flex; align-items: center;
    font-size: 0.85rem; color: var(--ormus-ink-muted); text-decoration: none;
    border: 1px solid var(--ormus-hairline); border-radius: var(--ormus-radius);
  }
  .tabbar a[aria-current="true"] { color: var(--ormus-gold); border-color: var(--ormus-gold); }
  .ending { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8rem); }
  .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 5rem); }
  /* Touch targets */
  .fusion-btn, .copy-btn, .swatch-value { min-height: 44px; }
  .copy-btn { min-width: 44px; }
  .swatch-value { padding-block: 0.5rem; }
  .files tbody th a { display: inline-block; padding-block: 0.5rem 0.1rem; min-height: 44px; }
  /* Table row labels stay put while the table scrolls */
  .contrast tbody th, .contrast thead th:first-child, .files tbody th, .files thead th:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--ormus-deep); padding-right: 0.75rem;
    box-shadow: -6px 0 0 var(--ormus-deep);
  }
  /* A fade on the right edge while there is more table to scroll to */
  .scroll-x.can-scroll:not(.at-end) { -webkit-mask-image: linear-gradient(to right, black calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, black calc(100% - 2.5rem), transparent); }
}
/* Short screens and heavy zoom: let the bars scroll away */
@media (max-width: 960px) and (max-height: 32rem) {
  .topbar { position: relative; }
  .tabbar { position: static; }
  .ending { padding-bottom: 6rem; }
  .toast { bottom: 1rem; }
  html { scroll-padding: 0; }
}
@media (max-width: 640px) {
  .families, .split, .voice, .slides, .demo-cards { grid-template-columns: minmax(0, 1fr); }
  .specimen { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .sigil { flex-basis: calc((100% - 1rem) / 2); }
  .topbar-actions .topbar-kit { display: none; }
}
@media (max-width: 520px) {
  .facts { grid-template-columns: minmax(0, 1fr); }
  .marks { gap: 0.6rem; }
  .mark figcaption { font-size: 0.78rem; }
  .swatch-row, .swatch-row:has(> .swatch:nth-child(4)) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
  .swatch-row:has(> .swatch:nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swatch-chip { aspect-ratio: 1; }
  .swatch figcaption { font-size: 0.78rem; }
  .swatch-value { font-size: 0.72rem; }
  .swatch-var { display: none; }
  .family-glyph { height: 4rem; font-size: 3.5rem; }
}

/* ── Print: fusion.css remaps the palette; hide the chrome, drop the dark panels ── */
@media print {
  .topbar, .tabbar, .toc, .skip, .toast, .hero-media, .motion-toggle, .copy-btn { display: none !important; }
  .slide, .material-half, .material-compare figcaption, .lacquer, .mark-stage { background: none !important; }
  .contrast tbody th, .contrast thead th:first-child, .files tbody th, .files thead th:first-child { position: static; background: none; box-shadow: none; }
  .scroll-x { -webkit-mask-image: none !important; mask-image: none !important; }
  .layout { display: block; padding: 0; }
  main > section { padding-block: 2rem 0; break-inside: avoid-page; }
  .snippet { background: none; }
  .ending { padding: 2rem 0; }
}
