/* ==========================================================================
   MayteraOS website: modern dark redesign.
   Palette derived from the brand teal #336666. All text/background pairs
   verified >= 4.5:1 (WCAG AA). No frameworks; plain CSS.
   Writing rule: no em-dashes anywhere.
   ========================================================================== */

:root {
  /* color tokens */
  --bg: #0c1312;          /* page ground, deep teal-black */
  --bg-2: #0a100f;        /* footer / code wells */
  --panel: #13201f;       /* raised surfaces */
  --panel-2: #182827;     /* hover / higher surfaces */
  --line: #24403d;        /* hairline borders */
  --line-soft: #1b302d;
  --ink: #eaf4f1;         /* headings, strong text     16.7:1 on bg */
  --body-c: #c7d7d3;      /* body text                 12.6:1 on bg */
  --muted: #9db3ae;       /* secondary text             8.5:1 on bg */
  --accent: #45d8c2;      /* links, cta                10.7:1 on bg */
  --accent-deep: #2a8f80; /* decorative only */
  --amber: #e8c468;       /* small second accent */
  --danger: #ff6b6b;      /* high-severity accent    6.8:1 on bg, 6.0:1 on panel */
  --btn-ink: #052722;     /* text on accent buttons */

  /* type */
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1140px;
  --rad: 10px;
  --rad-sm: 6px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .65);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body-c);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent); color: var(--btn-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code, kbd, pre {
  font-family: var(--mono);
}
code, kbd {
  font-size: .86em;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: .1em .38em;
  color: var(--ink);
  overflow-wrap: break-word;
}
pre {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad-sm);
  padding: .95rem 1.1rem;
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.6;
  color: #a9e8dc; /* 14:1 on --bg-2 */
}
pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
pre .c { color: var(--muted); }

h1, h2, h3, h4 {
  font-family: var(--display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0 0 .55em;
  overflow-wrap: break-word;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--btn-ink);
  padding: .5rem .9rem;
  z-index: 200;
  border-radius: 0 0 var(--rad-sm) 0;
  font-weight: 600;
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */
.menubar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .65rem clamp(1rem, 4vw, 2.2rem);
  background: rgba(10, 17, 16, .86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }
.menu {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
  font-size: .92rem;
}
.menu a {
  color: var(--body-c);
  padding: .42rem .8rem;
  border-radius: 999px;
  font-weight: 500;
}
.menu a:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.menu a[aria-current="page"], .menu a.active {
  color: var(--accent);
  background: rgba(69, 216, 194, .1);
}
.menu .menu-cta {
  color: var(--btn-ink);
  background: var(--accent);
  font-weight: 600;
  margin-left: .35rem;
}
.menu .menu-cta:hover { background: #6ae2cf; color: var(--btn-ink); }

.menu-toggle {
  display: none;
  margin-left: auto;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--rad-sm);
  font-size: 1.25rem;
  line-height: 1;
  padding: .35rem .6rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
    margin: 0;
    padding: .6rem .9rem 1rem;
    background: rgba(10, 17, 16, .97);
    border-bottom: 1px solid var(--line);
  }
  .menu.open { display: flex; }
  .menu a { padding: .65rem .8rem; border-radius: var(--rad-sm); }
  .menu .menu-cta { margin-left: 0; text-align: center; margin-top: .35rem; }
}

/* --------------------------------------------------------------------------
   Shared layout
   -------------------------------------------------------------------------- */
main { display: block; }

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.6rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.2rem);
}
.section + .section { padding-top: 0; }

.section-head { max-width: 760px; margin-bottom: clamp(1.6rem, 3vw, 2.4rem); }
.section-head h2 { font-size: clamp(1.55rem, 3.2vw, 2.15rem); }
.section-sub { color: var(--muted); margin: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--accent);
  margin: 0 0 .8rem;
}

/* buttons */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .62rem 1.35rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--panel-2); border-color: var(--accent-deep); text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--btn-ink);
}
.btn-primary:hover { background: #6ae2cf; border-color: #6ae2cf; }
.cta-row { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0 0; }

/* cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  padding: 1.4rem 1.4rem 1.2rem;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: var(--accent-deep); transform: translateY(-2px); }
.card h3 { font-size: 1.08rem; margin-bottom: .5rem; }
.card p { margin: 0; font-size: .95rem; color: var(--body-c); }
.card .ico {
  display: inline-block;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--accent);
  background: rgba(69, 216, 194, .08);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .15rem .45rem;
  margin-right: .5rem;
  vertical-align: 2px;
}
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; }
a.card h3 { color: var(--accent); }

/* --------------------------------------------------------------------------
   Signature device: window frame around real screenshots.
   A modern abstraction of the OS's CDE chrome: thin bar, three square pips,
   mono title. Used site-wide for every screenshot.
   -------------------------------------------------------------------------- */
.frame {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 0;
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem;
  background: linear-gradient(180deg, #1b2e2c, #142221);
  border-bottom: 1px solid var(--line-soft);
}
.frame-dots { display: inline-flex; gap: 5px; }
.frame-dots i {
  width: 9px; height: 9px;
  border-radius: 2px;                    /* square pips: CDE, not macOS */
  background: var(--accent-deep);
  display: inline-block;
}
.frame-dots i:nth-child(2) { background: #3c6f66; }
.frame-dots i:nth-child(3) { background: var(--amber); }
.frame-title {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frame img { width: 100%; }
.frame figcaption, .figcap {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  padding: .6rem .85rem .7rem;
  border-top: 1px solid var(--line-soft);
}
.js .frame[data-full] { cursor: zoom-in; }

/* --------------------------------------------------------------------------
   Terminal card (hero + demo blocks)
   -------------------------------------------------------------------------- */
.term {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem;
  background: linear-gradient(180deg, #1b2e2c, #142221);
  border-bottom: 1px solid var(--line-soft);
}
.term-body {
  font-family: var(--mono);
  font-size: .9rem;
  padding: 1rem 1.1rem 1.1rem;
  color: #a9e8dc;
  min-height: 3.2rem;
}
.term-body .out { color: var(--muted); }
.ps1 { color: var(--amber); margin-right: .5ch; }
.cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* --------------------------------------------------------------------------
   Landing hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52rem 30rem at 78% 8%, rgba(51, 102, 102, .34), transparent 62%),
    radial-gradient(38rem 26rem at 8% 96%, rgba(51, 102, 102, .2), transparent 60%);
  pointer-events: none;
}
.hero-in {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.2rem) clamp(2.6rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 10fr) minmax(0, 9fr);
  gap: clamp(1.6rem, 4vw, 3.2rem);
  align-items: center;
}
.hero-copy .eyebrow { display: flex; align-items: center; gap: .55rem; }
.hero-copy .eyebrow img { width: 20px; height: 20px; }
.hero h1 {
  font-size: clamp(2.15rem, 5.4vw, 3.6rem);
  letter-spacing: -.03em;
  margin-bottom: .5em;
}
.hero h1 .tealw { color: var(--accent); }
.lede { font-size: 1.06rem; color: var(--body-c); max-width: 34em; margin: 0; }
.hero .term { margin-top: 1.5rem; max-width: 34rem; }
.hero .cta-row { margin-top: 1.5rem; }

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  margin: 1.5rem 0 0;
}
.chips li {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--body-c);
  border: 1px solid var(--line);
  background: rgba(19, 32, 31, .7);
  border-radius: 999px;
  padding: .3rem .75rem;
}

.hero-shot { position: relative; }
.hero-shot .frame { transform: rotate(.4deg); }
.hero-shot .figcap { border-top: 0; padding: .7rem .2rem 0; }
/* Hero screenshot shows the raw desktop, no window-chrome bar. */
.hero-shot .frame-bar { display: none; }

/* Crossfading image stack inside the hero frame. Two layers occupy the same
   box; the rotator fades the top layer in over the base to cross-dissolve. */
.frame-media {
  position: relative;
  aspect-ratio: 1280 / 800;
  overflow: hidden;
}
.hero-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-layer-fx { opacity: 0; }
.js .hero-layer { transition: opacity .9s ease; }
@media (prefers-reduced-motion: reduce) {
  .js .hero-layer { transition: none; }
}

/* Hero shot on desktop is right-aligned within its column and kept fully
   on-screen. .hero keeps overflow:hidden as a safety clip. */
.chips-lead {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  margin: 1.4rem 0 .55rem;
  letter-spacing: .02em;
}
@media (min-width: 901px) {
  /* Original two-column hero is unchanged (copy column keeps its full width).
     The screenshot renders at 2x size, anchored at its normal left edge, so it
     grows to the right and bleeds off the viewport (clipped by .hero's
     overflow:hidden - no horizontal scrollbar). */
  .hero-shot { z-index: 1; }
  .hero-shot .frame {
    width: 200%;
    max-width: none;
    margin-left: 0;      /* keep the left edge exactly where it was */
    transform: rotate(.4deg);
  }
}

/* stat strip below hero */
.statgrid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem clamp(1rem, 4vw, 2.2rem) 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .6rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad-sm);
  padding: .7rem .9rem;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
}
.stat b { display: block; color: var(--ink); font-size: .95rem; font-weight: 600; margin-bottom: .1rem; }

@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero-shot { max-width: 40rem; }
  .hero-shot .frame { width: auto; max-width: 100%; transform: rotate(.4deg); }
}

/* --------------------------------------------------------------------------
   Feature rows (screenshot + copy)
   -------------------------------------------------------------------------- */
.feature-row {
  display: grid;
  grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
  gap: clamp(1.4rem, 3.5vw, 2.8rem);
  align-items: center;
  margin: 0 0 clamp(2.2rem, 5vw, 3.6rem);
}
.feature-row:last-child { margin-bottom: 0; }
.feature-row.flip .feature-copy { order: -1; }
.feature-copy h3 { font-size: 1.35rem; }
.feature-copy p { margin: 0 0 .9rem; }
.feature-copy ul { margin: 0; padding-left: 1.1rem; }
.feature-copy li { margin: .35rem 0; font-size: .95rem; }
.feature-copy li::marker { color: var(--accent); }
@media (max-width: 860px) {
  .feature-row { grid-template-columns: 1fr; }
  .feature-row.flip .feature-copy { order: 0; }
}

/* proven vs planned panel */
.ai-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.6rem;
}
.ai-status > div {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  padding: 1.2rem 1.3rem;
}
.ai-status .status-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .05em;
  border-radius: 4px;
  padding: .18rem .55rem;
  margin-bottom: .6rem;
}
.ai-status .s-proven .status-tag { color: var(--accent); background: rgba(69, 216, 194, .1); border: 1px solid var(--accent-deep); }
.ai-status .s-ahead .status-tag { color: var(--amber); background: rgba(232, 196, 104, .08); border: 1px solid #6b5a2c; }
.ai-status p { margin: 0; font-size: .95rem; }
@media (max-width: 760px) { .ai-status { grid-template-columns: 1fr; } }

/* apps strip */
.applist {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  margin: 0;
}
.applist li {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--body-c);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: .42rem .8rem;
}

.shots-note { color: var(--muted); font-size: .9rem; margin: 1.2rem 0 0; }

/* gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.gallery .span2 { grid-column: span 2; }
@media (max-width: 860px) {
  .gallery { grid-template-columns: 1fr; }
  .gallery .span2 { grid-column: auto; }
}

/* CTA band */
.cta-band {
  background: linear-gradient(180deg, rgba(51, 102, 102, .18), rgba(51, 102, 102, .05)), var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1.8rem, 4vw, 2.8rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.4rem, 3vw, 2.6rem);
  align-items: center;
}
.cta-band h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.cta-band .fineprint { margin-bottom: 0; }
@media (max-width: 860px) { .cta-band { grid-template-columns: 1fr; } }

.fineprint { color: var(--muted); font-size: .84rem; margin: 1rem 0 0; }

/* --------------------------------------------------------------------------
   Subpage hero
   -------------------------------------------------------------------------- */
.pagehead {
  position: relative;
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.pagehead::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(44rem 22rem at 82% 0%, rgba(51, 102, 102, .28), transparent 62%);
  pointer-events: none;
}
.pagehead-in {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 4rem) clamp(1rem, 4vw, 2.2rem);
}
.pagehead h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); letter-spacing: -.025em; }
.pagehead p { max-width: 46em; margin: 0; color: var(--body-c); }

/* --------------------------------------------------------------------------
   Downloads
   -------------------------------------------------------------------------- */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start;
}
.dl-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  padding: 1.5rem 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.dl-card h3 { font-size: 1.25rem; margin: 0; }
.dl-card p { margin: .3rem 0; font-size: .95rem; }
.dl-card .meta { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.dl-card .meta b { color: var(--ink); font-weight: 600; }
.dl-card .btn { align-self: flex-start; margin-top: .6rem; }
.dl-card pre { margin: .5rem 0; font-size: .74rem; }
.tag {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: .2rem .55rem;
  margin-bottom: .35rem;
}
.tag-live { color: var(--accent); background: rgba(69, 216, 194, .1); border: 1px solid var(--accent-deep); }
.tag-soon { color: var(--amber); background: rgba(232, 196, 104, .08); border: 1px solid #6b5a2c; }

/* spec sheet */
.specs { margin: 0; }
.specs > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.specs > div:last-child { border-bottom: 0; }
.specs dt { font-family: var(--mono); font-size: .8rem; color: var(--accent); padding-top: .15rem; }
.specs dd { margin: 0; font-size: .95rem; }
@media (max-width: 620px) {
  .specs > div { grid-template-columns: 1fr; gap: .1rem; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  padding: clamp(1.3rem, 3vw, 2rem);
}

/* --------------------------------------------------------------------------
   Prose (docs, about)
   -------------------------------------------------------------------------- */
.prose { max-width: 76ch; }
.prose p, .prose li, .prose dd, .prose td, .prose th, .prose blockquote {
  overflow-wrap: break-word;
  word-break: break-word;
}
.prose h1 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.prose h2 {
  font-size: 1.45rem;
  margin-top: 2.2em;
  padding-top: 1.1em;
  border-top: 1px solid var(--line-soft);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { font-size: 1.12rem; margin-top: 1.6em; }
.prose h4 { font-size: 1rem; margin-top: 1.4em; color: var(--ink); }
.prose p, .prose ul, .prose ol { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin: .3rem 0; }
.prose li::marker { color: var(--accent); }
.prose figure { margin: 1.4rem 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  margin: 0 0 1.2em;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  text-align: left;
  padding: .5rem .7rem;
  border: 1px solid var(--line-soft);
}
.prose th { background: var(--panel); color: var(--ink); font-family: var(--mono); font-size: .78rem; }
.prose pre { margin: 0 0 1.2em; }
.prose blockquote {
  margin: 0 0 1.2em;
  padding: .2rem 0 .2rem 1rem;
  border-left: 3px solid var(--accent-deep);
  color: var(--muted);
}
.prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: 2rem 0; }

.note {
  background: rgba(69, 216, 194, .06);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--rad-sm);
  padding: .85rem 1.1rem;
  margin: 0 0 1.2em;
  font-size: .93rem;
}
.note-hist {
  background: rgba(232, 196, 104, .06);
  border-color: #4d431f;
  border-left-color: var(--amber);
}
.note-hist b, .note b { color: var(--ink); }

/* --------------------------------------------------------------------------
   Docs wiki layout
   -------------------------------------------------------------------------- */
.doc-layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 2.8rem) clamp(1rem, 4vw, 2.2rem) clamp(2.6rem, 6vw, 4.5rem);
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(1.4rem, 3vw, 2.6rem);
  align-items: start;
}
.doc-side {
  position: sticky;
  top: 4.4rem;
  max-height: calc(100vh - 5.4rem);
  overflow-y: auto;
  padding-right: .3rem;
}
.doc-side .side-group {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.15rem 0 .35rem;
}
.doc-side .side-group:first-child { margin-top: 0; }
.doc-side a {
  display: block;
  color: var(--body-c);
  font-size: .88rem;
  padding: .3rem .6rem;
  border-radius: var(--rad-sm);
  border-left: 2px solid transparent;
}
.doc-side a:hover { color: var(--ink); background: var(--panel); text-decoration: none; }
.doc-side a.active {
  color: var(--accent);
  background: rgba(69, 216, 194, .08);
  border-left-color: var(--accent);
}

.crumbs {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  margin: 0 0 1.3rem;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.doc-meta {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  margin: 0 0 1.6rem;
}

details.doc-side-wrap summary {
  list-style: none;
  cursor: pointer;
}
details.doc-side-wrap summary::-webkit-details-marker { display: none; }
.doc-side-toggle {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad-sm);
  padding: .6rem .9rem;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
}
.doc-layout > article { min-width: 0; }
@media (max-width: 860px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-side { position: static; max-height: none; }
  .doc-side-toggle { display: block; }
  .doc-side-nav { display: none; padding: .7rem .3rem 0; }
  details.doc-side-wrap[open] .doc-side-nav { display: block; }
}
@media (min-width: 861px) {
  details.doc-side-wrap summary { display: none; }
  .doc-side-nav { display: block; }
}

/* docs index cards */
.doc-cat {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.2rem 0 .8rem;
}
.doc-cat:first-of-type { margin-top: 0; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: .9rem;
}
.doc-grid .card h3 { font-size: 1rem; }
.doc-grid .card p { font-size: .88rem; color: var(--muted); }

/* in-page toc (user guide) */
.toc-inline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .4rem .9rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  padding: 1rem 1.2rem;
  margin: 0 0 2rem;
  font-size: .9rem;
}
.toc-inline a { color: var(--body-c); }
.toc-inline a:hover { color: var(--accent); }
.toc-inline .n { font-family: var(--mono); color: var(--accent); font-size: .78rem; margin-right: .4ch; }

/* --------------------------------------------------------------------------
   Changelog
   -------------------------------------------------------------------------- */
.cl-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-bottom: 1.4rem;
}
.cl-search {
  flex: 1 1 240px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: .92rem;
  padding: .55rem 1.1rem;
}
.cl-search::placeholder { color: var(--muted); opacity: 1; }
.cl-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.cl-count { font-family: var(--mono); font-size: .76rem; color: var(--muted); flex-basis: 100%; }

.cl-day {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--rad);
  margin-bottom: .6rem;
  overflow: hidden;
}
.cl-day summary {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.cl-day summary::-webkit-details-marker { display: none; }
.cl-day summary::before {
  content: "+";
  font-family: var(--mono);
  color: var(--accent);
  width: 1ch;
}
.cl-day[open] summary::before { content: "-"; }
.cl-day summary:hover { background: var(--panel-2); }
.cl-date { font-family: var(--mono); font-size: .88rem; color: var(--ink); font-weight: 600; }
.cl-n { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin-left: auto; }
.cl-entries { padding: .2rem 1.1rem 1rem; border-top: 1px solid var(--line-soft); }
.cl-entry { padding: .9rem 0; border-bottom: 1px dashed var(--line-soft); }
.cl-entry:last-child { border-bottom: 0; }
.cl-entry h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.cl-entry h4 { font-size: .9rem; margin: .8rem 0 .3rem; }
.cl-entry p, .cl-entry ul { margin: 0 0 .6rem; font-size: .92rem; }
.cl-entry ul { padding-left: 1.2rem; }
.cl-entry li { margin: .25rem 0; }
.cl-entry li::marker { color: var(--accent); }
.cl-empty { color: var(--muted); padding: 1rem 0; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
.footer-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.4rem clamp(1rem, 4vw, 2.2rem) 2.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr);
  gap: 2rem;
}
.footer-brand { display: flex; gap: .8rem; align-items: flex-start; }
.footer-brand img { width: 34px; height: 34px; }
.footer-brand .fb-name { font-family: var(--display); font-weight: 700; color: var(--ink); margin: 0; }
.footer p { margin: 0; }
.footer .muted { color: #8fa6a1; font-size: .88rem; }
.footer-cols { display: flex; gap: clamp(1.6rem, 5vw, 4rem); flex-wrap: wrap; }
.footer-cols h4 {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .6rem;
}
.footer-cols a { display: block; color: var(--body-c); font-size: .9rem; padding: .18rem 0; }
.footer-cols a:hover { color: var(--accent); }
.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.2rem) 1.6rem;
  font-family: var(--mono);
  font-size: .74rem;
  color: #8fa6a1;
}
@media (max-width: 700px) {
  .footer-in { grid-template-columns: 1fr; gap: 1.6rem; }
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5, 10, 9, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.2rem;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--rad-sm);
  box-shadow: var(--shadow);
}
.lb-close {
  position: absolute;
  top: .9rem;
  right: 1.1rem;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.2rem;
  cursor: pointer;
}
.lb-close:hover { background: var(--panel-2); }

/* --------------------------------------------------------------------------
   Security advisories
   -------------------------------------------------------------------------- */
.sev {
  display: inline-block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: .18rem .5rem;
  white-space: nowrap;
}
.sev-high { color: var(--danger); background: rgba(255, 107, 107, .1); border: 1px solid #6b2a2a; }
.sev-medium { color: var(--amber); background: rgba(232, 196, 104, .08); border: 1px solid #6b5a2c; }

.adv-stats {
  display: flex; flex-wrap: wrap; gap: .9rem;
  margin: 0 0 1.6rem;
}
.adv-stat {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--rad-sm);
  padding: .85rem 1.15rem; min-width: 130px;
}
.adv-stat .n { font-family: var(--display); font-size: 1.5rem; color: var(--ink); font-weight: 600; line-height: 1; }
.adv-stat .l { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: .3rem; display: block; }

.adv-remote {
  display: inline-block;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--danger); border: 1px solid #6b2a2a; background: rgba(255,107,107,.1);
  border-radius: 4px; padding: .05rem .4rem; margin-left: .4rem;
}

.adv-table-wrap {
  max-width: var(--maxw);
  margin: 0 auto 1.6rem;
  overflow-x: auto;
}
.adv-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.adv-table th, .adv-table td { text-align: left; padding: .6rem .8rem; border: 1px solid var(--line-soft); vertical-align: top; }
.adv-table th { background: var(--panel); color: var(--ink); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }
.adv-table td:nth-child(2) { min-width: 190px; }
.adv-table td:nth-child(5) { min-width: 270px; }
.adv-table th, .adv-table td { padding: .55rem .6rem; }
.adv-table code { font-size: .78rem; }
.adv-table .adv-id { font-family: var(--mono); font-size: .8rem; color: var(--accent); white-space: nowrap; }
.adv-table .adv-build { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.adv-table .adv-patched { font-family: var(--mono); font-size: .82rem; white-space: nowrap; color: var(--ink); font-weight: 600; }

.adv-row-remote { box-shadow: inset 3px 0 0 var(--danger); }

/* --------------------------------------------------------------------------
   Generated reference tables (syscalls, and similar gate-sourced tables)
   -------------------------------------------------------------------------- */
.prose td.ok { color: var(--accent); font-family: var(--mono); font-size: .78rem; white-space: nowrap; }
.prose td.warn { color: var(--danger); font-family: var(--mono); font-size: .78rem; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
