/* Layout: one left-aligned column up to 68rem. A navy band, the icon's own
   ground, opens a product page; everything after it sits on cool paper in
   rows separated by rules. Rounded display type echoes the icon's round-capped
   strokes; component names are set in mono. */
:root {
  --navy: #1E1B4B;
  --navy-deep: #100E2A;
  --mint: #2FD69A;
  --bg: #F4F5FB;
  --surface: #FFFFFF;
  --ink: #1E1B4B;
  --ink-2: #55547A;
  --line: #D9DAEA;
  --accent: #0B8A60;
  --tag-bg: #DFF7ED;
  --tag-ink: #0A6B4B;
  --on-band: #FFFFFF;
  --on-band-2: #C4C3E6;
  --band-line: rgba(255, 255, 255, 0.16);

  --font-display: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.4rem + 2.2vw, 2.75rem);
  --step-4: clamp(2.75rem, 1.6rem + 5.4vw, 4.75rem);

  --gutter-left: max(1.25rem, env(safe-area-inset-left, 0px));
  --gutter-right: max(1.25rem, env(safe-area-inset-right, 0px));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100E2A;
    --surface: #1A1742;
    --ink: #EEEEFA;
    --ink-2: #A9A8CE;
    --line: #2C2960;
    --accent: #2FD69A;
    --tag-bg: #16383F;
    --tag-ink: #7CF0C4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--step-0)/1.65 var(--font-body);
}

img, svg { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { text-decoration-thickness: 0.14em; }

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

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.03em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); line-height: 1.25; }
p { margin: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 0.08em 0.36em;
  border-radius: 0.35em;
  background: var(--tag-bg);
  color: var(--tag-ink);
}

.wrap {
  max-width: 68rem;
  margin-inline: auto;
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
}

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; padding: 0.5rem 0.9rem; background: var(--surface); border-radius: 0.5rem; }

/* Top bar */
.bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-block: 1.1rem; }
.crumbs { display: flex; align-items: center; gap: 0.55rem; margin-right: auto; font-family: var(--font-display); font-weight: 700; font-size: var(--step-0); }
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { opacity: 0.4; font-weight: 400; }
.wordmark { display: inline-flex; align-items: center; gap: 0.4rem; }
.wordmark::before { content: ""; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--mint); }
.nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.3rem; font-size: var(--step--1); }
.nav a { color: inherit; text-decoration: none; opacity: 0.82; }
.nav a:hover, .nav a[aria-current="true"] { opacity: 1; text-decoration: underline; }
.nav .langs { display: flex; gap: 0.7rem; padding-left: 1.3rem; border-left: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 25%, transparent); }

/* Navy band: the icon's ground */
.band { background: var(--navy); color: var(--on-band); position: relative; overflow: hidden; }
.band a { color: inherit; }
.band .ghost { position: absolute; right: -6rem; top: -3rem; width: 38rem; max-width: none; opacity: 0.07; pointer-events: none; }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2rem 4rem; padding-block: 3.5rem 4rem; }
.hero .lede { margin-top: 1.25rem; max-width: 34rem; font-size: var(--step-1); line-height: 1.5; color: var(--on-band-2); }
.hero .kicker { margin-bottom: 1rem; font-family: var(--font-mono); font-size: var(--step--1); color: var(--mint); }
.hero .icon { width: clamp(9rem, 22vw, 15rem); height: auto; aspect-ratio: 1; border-radius: 22.5%; box-shadow: 0 0 0 1px var(--band-line); display: block; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.25rem; border-radius: 999px; font-family: var(--font-display); font-weight: 700; font-size: var(--step-0); text-decoration: none; }
.button.primary { background: var(--mint); color: var(--navy); }
.button.primary:hover { background: #5BE3B3; }
.button.soon { border: 1.5px dashed var(--band-line); padding: calc(0.7rem - 1.5px) calc(1.25rem - 1.5px); color: var(--on-band-2); cursor: default; }
.button.soon small { font-family: var(--font-mono); font-weight: 400; font-size: var(--step--1); color: var(--mint); }
.button.quiet { box-shadow: inset 0 0 0 1.5px var(--band-line); }
.button.quiet:hover { box-shadow: inset 0 0 0 1.5px var(--on-band); }
.facts { display: flex; flex-wrap: wrap; gap: 0.75rem 2.25rem; margin: 0; padding: 1.25rem 0 1.75rem; border-top: 1px solid var(--band-line); list-style: none; font-size: var(--step--1); color: var(--on-band-2); }
.facts b { display: block; font-family: var(--font-display); font-size: var(--step-0); color: var(--on-band); }

/* Sections */
.section { padding-block: 4.5rem; }
.section + .section { border-top: 1px solid var(--line); }
.section > .wrap > .intro { max-width: 40rem; margin-top: 1rem; color: var(--ink-2); }

/* The upstream credit is the one boxed block on the page */
.origin { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 2rem 3.5rem; align-items: start; }
.origin h2 + p { margin-top: 1rem; }
.origin p + p { margin-top: 1rem; }
.origin .credit { padding: 1.5rem 1.6rem; border-radius: 1.1rem; background: var(--surface); border: 1px solid var(--line); }
.origin .credit h3 { font-size: var(--step-0); font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; color: var(--accent); }
.origin .credit p { margin-top: 0.6rem; font-size: var(--step--1); color: var(--ink-2); }
.origin .credit .more { margin-top: 1rem; font-weight: 600; }

/* What the fork changes: component name, then what it does */
.changes { margin: 2.5rem 0 0; padding: 0; list-style: none; }
.change { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 0.4rem 2rem; padding-block: 1.6rem; border-top: 1px solid var(--line); }
.change:last-child { border-bottom: 1px solid var(--line); }
.change .tag { justify-self: start; align-self: start; margin-top: 0.15rem; padding: 0.2rem 0.6rem; border-radius: 0.45rem; background: var(--tag-bg); color: var(--tag-ink); font-family: var(--font-mono); font-size: var(--step--1); }
.change p { margin-top: 0.45rem; max-width: 38rem; color: var(--ink-2); }

/* How it fits together: the stack drawn like the icon */
.stack { display: grid; grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); gap: 2rem 4rem; align-items: center; margin-top: 2.5rem; }
.stack svg { width: 100%; height: auto; display: block; }
.stack .slab { fill: none; stroke: var(--ink); stroke-width: 9; stroke-linejoin: round; stroke-linecap: round; }
.stack .slab.top { stroke: var(--accent); }
.stack .dot { fill: var(--mint); }
.layers { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.5rem; counter-reset: layer; }
.layers li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: 0 0.9rem; counter-increment: layer; }
.layers li::before { content: counter(layer); grid-row: span 2; display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink); font-family: var(--font-display); font-weight: 700; font-size: var(--step--1); }
.layers li:first-child::before { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.layers p { color: var(--ink-2); }

/* Download */
.soon-line { margin-top: 0.9rem; font-family: var(--font-display); font-weight: 700; font-size: var(--step-2); line-height: 1.2; color: var(--accent); }
.section > .wrap > .soon-line + .intro { margin-top: 0.6rem; }

/* Requirements */
.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.75rem 2.5rem; margin: 2.5rem 0 0; }
.specs dt { font-family: var(--font-mono); font-size: var(--step--1); color: var(--accent); }
.specs dd { margin: 0.35rem 0 0; }
.specs dd small { display: block; margin-top: 0.25rem; font-size: var(--step--1); color: var(--ink-2); }

/* Project list on the iEmu home page */
.home-hero { padding-block: 3.5rem 0; }
.home-hero + .section { padding-top: 3rem; }
.home-hero .lede { margin-top: 1.25rem; max-width: 36rem; font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); }
.projects { display: grid; gap: 1rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.project { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem 1.5rem; padding: 1.4rem 1.6rem; border-radius: 1.4rem; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.project:hover { border-color: var(--accent); }
.project img { width: 5.5rem; height: 5.5rem; border-radius: 22.5%; display: block; }
.project h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.8rem; }
.project .state { font-family: var(--font-mono); font-weight: 400; font-size: var(--step--1); letter-spacing: 0; color: var(--accent); }
.project p { margin-top: 0.4rem; max-width: 36rem; color: var(--ink-2); }
.project .go { font-family: var(--font-display); font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding-block: 2.5rem 3.5rem; font-size: var(--step--1); color: var(--ink-2); }
.foot .wrap { display: grid; gap: 0.9rem; }
.foot .links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.foot p { max-width: 44rem; }

@media (max-width: 46rem) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 2rem 3rem; }
  .band .ghost { display: none; }
  .hero .art { order: -1; }
  .origin, .stack { grid-template-columns: minmax(0, 1fr); }
  .stack svg { max-width: 15rem; }
  .change { grid-template-columns: minmax(0, 1fr); }
  .project { grid-template-columns: auto minmax(0, 1fr); }
  .project .go { grid-column: 1 / -1; }
  .project img { width: 4rem; height: 4rem; }
  .section { padding-block: 3.25rem; }
  .nav .langs { padding-left: 0; border-left: 0; }
}

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