/* =========================================================================
   Qriouso — shared editorial design system
   Used by: architecture.html, evals.html, teacher.html (and linked by index.html
   for the shared nav/footer). No Tailwind, no CDNs. Page-specific styles live
   in each page's own <style> block, following the index.html convention.
   ========================================================================= */

/* ---- Fonts (self-hosted, see assets/fonts/) -------------------------- */
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-italic-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/instrument-sans-var.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ----------------------------------------------------------- */
:root {
  color-scheme: light;
  --paper: #fffbf5;
  --paper-deep: #f5efe3;
  --ink: #1c1917;
  --ink-deep: #100d0b;
  --ink-soft: #3e3833;
  --muted: #5b544c;
  --muted-strong: #49433d;
  --stone-400: #a8a29e;
  --burgundy: #6e3126;
  --burgundy-light: #a84a3b;
  --burgundy-dim: #e9a79a;
  --burgundy-deepest: #3a1814;
  --forest: #2d9b4e;
  --forest-deep: #1f7a3a;
  --hairline: rgba(28, 24, 23, 0.16);
  --hairline-strong: rgba(28, 24, 23, 0.22);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---- Base ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-feature-settings: 'ss01', 'cv01';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  font-size: 16px;
}
::selection {
  background: rgba(110, 49, 38, 0.22);
  color: var(--ink);
}
img,
svg {
  max-width: 100%;
  height: auto;
}
a {
  color: inherit;
}
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--burgundy-light);
  outline-offset: 4px;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* Paper grain texture */
.grain::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.1;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.43, 0 0 0 0 0.30, 0 0 0 0 0.20, 0 0 0 0.12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---- Typography -------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 450;
  font-variation-settings:
    'opsz' 144,
    'SOFT' 40,
    'WONK' 0;
  line-height: 0.98;
  letter-spacing: 0;
}
.display em {
  font-style: italic;
  color: var(--burgundy);
  font-weight: 450;
  font-variation-settings:
    'opsz' 144,
    'SOFT' 50;
}
.display-sm {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings:
    'opsz' 72,
    'SOFT' 35;
  letter-spacing: 0;
  line-height: 1.08;
}
.display-sm em {
  font-style: italic;
  color: var(--burgundy);
}
.section-mark {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--burgundy);
}
.section-mark--dim {
  color: var(--muted);
}
.mono {
  font-family: var(--font-mono);
}
.muted {
  color: var(--muted);
}
.ink-soft {
  color: var(--ink-soft);
}
.dropcap::first-letter {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings:
    'opsz' 144,
    'SOFT' 45;
  font-size: 3.6em;
  line-height: 0.85;
  float: left;
  padding: 0.06em 0.1em 0 0;
  color: var(--burgundy);
}
.pull-quote::before {
  content: '\201C';
  font-family: var(--font-display);
  font-variation-settings:
    'opsz' 144,
    'SOFT' 30;
  font-size: 5em;
  line-height: 0;
  position: relative;
  top: 0.35em;
  color: var(--burgundy-dim);
  margin-right: 0.05em;
}
.hairline {
  border-color: var(--hairline);
}
.hairline-strong {
  border-color: var(--hairline-strong);
}

/* ---- Layout ------------------------------------------------------------ */
.wrap {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 24px;
}
@media (min-width: 768px) {
  .wrap {
    padding-inline: 40px;
  }
}
.section {
  padding-block: 72px;
  border-top: 1px solid var(--hairline);
}
@media (min-width: 768px) {
  .section {
    padding-block: 104px;
  }
}
.section-head {
  max-width: 46rem;
  margin-bottom: 44px;
}
.section-head h2 {
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  margin-top: 18px;
}
.section-head .lede {
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.65;
  max-width: 40rem;
}
.grid {
  display: grid;
  gap: 24px;
}
@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- Nav / footer -------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 251, 245, 0.9);
  border-bottom: 1px solid var(--hairline);
}
.site-nav .bar {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (min-width: 768px) {
  .site-nav .bar {
    padding-inline: 40px;
  }
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand .glyph {
  width: 24px;
  height: 24px;
  color: var(--burgundy);
}
.brand .wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 1;
}
.nav-links {
  display: none;
  align-items: center;
  gap: 30px;
  font-size: 14px;
  color: var(--ink-soft);
}
@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }
}
.nav-links a {
  text-decoration: none;
  transition: color 0.3s;
  padding-block: 4px;
}
.nav-links a:hover {
  color: var(--burgundy);
}
.nav-links a[aria-current='page'] {
  color: var(--burgundy);
  border-bottom: 1px solid var(--burgundy);
}
.nav-cta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: #622a22;
  border: 1px solid rgba(58, 24, 20, 0.2);
  padding: 9px 16px;
  transition: background 0.3s;
}
.nav-cta:hover {
  background: var(--burgundy-deepest);
}

.site-footer {
  border-top: 1px solid var(--hairline);
  background: rgba(245, 239, 227, 0.3);
  padding-block: 40px;
}
.site-footer .bar {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
@media (min-width: 768px) {
  .site-footer .bar {
    padding-inline: 40px;
  }
}
.site-footer a {
  text-decoration: none;
  transition: color 0.3s;
}
.site-footer a:hover {
  color: var(--burgundy);
}
.site-footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

/* ---- Components ---------------------------------------------------------- */
.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #622a22;
  color: var(--paper);
  border: 1px solid rgba(58, 24, 20, 0.2);
  box-shadow:
    0 1px 0 rgba(58, 24, 20, 0.45),
    0 10px 24px -18px rgba(58, 24, 20, 0.5);
  padding: 14px 28px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.3s,
    box-shadow 0.3s,
    transform 0.3s;
}
.cta-primary:hover {
  background: var(--burgundy-deepest);
  transform: translateY(-1px);
}
.cta-ghost {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink);
  text-decoration: none;
  padding-bottom: 2px;
  font-size: 14px;
  letter-spacing: 0.03em;
  transition:
    color 0.3s,
    border-color 0.3s;
}
.cta-ghost:hover {
  color: var(--burgundy);
  border-color: var(--burgundy);
}

.card {
  position: relative;
  background: rgba(255, 251, 245, 0.88);
  border: 1px solid rgba(28, 24, 23, 0.14);
  transition:
    transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.4s,
    background 0.4s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 49, 38, 0.45);
  background: rgba(255, 251, 245, 1);
}

/* Corner-marked figure card (index .hd-card treatment) */
.corner-card {
  position: relative;
  background: rgba(255, 251, 245, 0.985);
  border: 1px solid rgba(28, 24, 23, 0.2);
  box-shadow:
    0 1px 0 rgba(28, 24, 23, 0.05),
    0 20px 50px -28px rgba(58, 24, 20, 0.28);
}
.corner-card::before,
.corner-card::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(28, 24, 23, 0.32);
}
.corner-card::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid;
  border-left: 1px solid;
}
.corner-card::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 1px solid;
  border-right: 1px solid;
}

/* Chips */
.chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition:
    color 0.3s,
    background 0.3s,
    border-color 0.3s;
}
.chip:hover {
  color: var(--burgundy);
  border-color: var(--burgundy);
}
.chip.is-active,
.chip[aria-pressed='true'],
.chip[aria-selected='true'] {
  color: var(--paper);
  background: var(--burgundy);
  border-color: var(--burgundy);
}
.chip--static {
  cursor: default;
}
.chip--static:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
}

/* Mono ledger strip (facts, numbers) */
.ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--hairline-strong);
  background: rgba(255, 251, 245, 0.72);
}
.ledger > div {
  flex: 1 1 150px;
  padding: 18px 20px;
  border-right: 1px dashed var(--hairline);
}
.ledger > div:last-child {
  border-right: none;
}
.ledger .num {
  font-family: var(--font-display);
  font-variation-settings:
    'opsz' 72,
    'SOFT' 35;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink-deep);
}
.ledger .lbl {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Figure + caption */
.fig {
  margin: 0;
}
.fig .frame {
  border: 1px solid var(--hairline-strong);
  background: rgba(255, 251, 245, 0.72);
  padding: 18px;
}
.fig figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1.6;
}
.fig figcaption .k {
  color: var(--burgundy);
}

/* Screenshot browser frame */
.browser-frame {
  border: 1px solid var(--hairline-strong);
  background: var(--paper);
  box-shadow:
    0 1px 0 rgba(28, 24, 23, 0.05),
    0 24px 60px -30px rgba(58, 24, 20, 0.3);
}
.browser-frame .chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(245, 239, 227, 0.55);
}
.browser-frame .dots {
  display: flex;
  gap: 5px;
}
.browser-frame .dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: rgba(28, 24, 23, 0.08);
}
.browser-frame .url {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browser-frame img {
  display: block;
  width: 100%;
  height: auto;
}
/* Placeholder while screenshots pending */
.browser-frame .placeholder {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(28, 24, 23, 0.03),
      rgba(28, 24, 23, 0.03) 12px,
      transparent 12px,
      transparent 24px
    ),
    rgba(245, 239, 227, 0.4);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Dark accent panel (index §03 system-panel treatment) */
.panel-dark {
  background: var(--ink-deep);
  color: #efe9df;
  border: 1px solid rgba(255, 251, 245, 0.1);
}
.panel-dark .section-mark {
  color: var(--burgundy-dim);
}
.panel-dark .muted {
  color: rgba(239, 233, 223, 0.6);
}
.panel-dark .hairline {
  border-color: rgba(255, 251, 245, 0.14);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table caption {
  text-align: left;
  padding-bottom: 12px;
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}
.data-table th[aria-sort] {
  cursor: pointer;
}
.data-table th[aria-sort]:hover {
  color: var(--burgundy);
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px dashed var(--hairline);
  vertical-align: top;
}
.data-table tbody tr:hover {
  background: rgba(245, 239, 227, 0.45);
}
.data-table .num-cell {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
}

/* Verdict chips */
.verdict {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid;
  white-space: nowrap;
}
.verdict--qualified {
  color: var(--forest-deep);
  border-color: rgba(31, 122, 58, 0.45);
  background: rgba(45, 155, 78, 0.08);
}
.verdict--not-qualified {
  color: var(--burgundy);
  border-color: rgba(110, 49, 38, 0.45);
  background: rgba(110, 49, 38, 0.07);
}
.verdict--inconclusive {
  color: var(--muted-strong);
  border-color: var(--hairline-strong);
  background: rgba(28, 24, 23, 0.04);
}

/* Tabs (keyboard-operable; JS per page) */
.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tab-panel[hidden] {
  display: none;
}

/* ---- Motion ---------------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes pulse-node {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}
.rise {
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
[style*='--d'] {
  animation-delay: var(--d);
}
.node-pulse {
  transform-origin: center;
  transform-box: fill-box;
  animation: pulse-node 4s ease-in-out infinite;
}
/* Scroll-draw for SVG strokes: pages set stroke-dasharray/offset, then add
   .is-drawn via IntersectionObserver. */
.drawable {
  transition: stroke-dashoffset 1.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Reveal-on-scroll helper: elements with [data-reveal] start hidden and get
   .is-visible from the shared observer snippet. */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .rise,
  .node-pulse {
    animation: none !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .drawable {
    transition: none !important;
    stroke-dashoffset: 0 !important;
  }
  .marquee-track {
    animation: none !important;
  }
}

/* ---- Utilities (tiny, deliberate) ------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
