:root {
  color-scheme: dark;
  --ink: #eef5f0;
  --muted: #9eb0a7;
  --faint: #82958c;
  --canvas: #0b1210;
  --surface: #111c18;
  --surface-raised: #17251f;
  --line: #2a3d35;
  --green: #72e6aa;
  --green-dark: #183c2c;
  --yellow: #ffe28a;
  --red: #ff9f91;
  --radius: 1.25rem;
  font-family: Inter, Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 20rem;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px) 0 0 / 4.5rem 4.5rem,
    linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px) 0 0 / 4.5rem 4.5rem,
    var(--canvas);
  color: var(--ink);
}

button, textarea { font: inherit; }

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: .75rem;
  left: .75rem;
  transform: translateY(-160%);
  padding: .7rem 1rem;
  border-radius: .5rem;
  background: var(--yellow);
  color: #141a16;
}

.skip-link:focus { transform: translateY(0); }

.site-header, main, footer {
  width: min(88rem, calc(100% - 3rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -.02em;
  text-decoration: none;
}

.brand-mark { position: relative; width: 2rem; height: 1.5rem; }
.brand-mark i { position: absolute; top: 50%; width: 1.05rem; aspect-ratio: 1; transform: translateY(-50%); border: 1px solid var(--green); border-radius: 50%; }
.brand-mark i:nth-child(1) { left: 0; }
.brand-mark i:nth-child(2) { left: .45rem; }
.brand-mark i:nth-child(3) { left: .9rem; background: rgb(114 230 170 / 18%); }

nav { display: flex; gap: clamp(1rem, 3vw, 2.5rem); }
nav a, footer a { color: var(--muted); font-size: .88rem; text-underline-offset: .3rem; }
nav a:hover, footer a:hover { color: var(--green); }

.hero { padding: clamp(4rem, 9vw, 8.5rem) 0 4rem; }
.hero-copy { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(17rem, .6fr); gap: 2rem; align-items: end; }

.eyebrow, .panel-index {
  margin: 0 0 1rem;
  color: var(--green);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1 {
  grid-row: 2;
  margin: 0;
  font-size: clamp(3.25rem, 7.8vw, 7.8rem);
  font-weight: 660;
  line-height: .88;
  letter-spacing: -.075em;
}

h1 em { color: var(--yellow); font-style: normal; }

.hero-lede {
  grid-column: 2;
  grid-row: 2;
  max-width: 34rem;
  margin: 0 0 .6rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.65;
}

.proof-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: clamp(3rem, 7vw, 6rem) 0 0;
  border-block: 1px solid var(--line);
}

.proof-strip div { padding: 1.1rem 0; }
.proof-strip div + div { padding-left: 1.5rem; border-left: 1px solid var(--line); }
.proof-strip dt { color: var(--faint); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.proof-strip dd { margin: .25rem 0 0; font-weight: 650; }

.workbench {
  display: grid;
  grid-template-columns: minmax(20rem, .82fr) minmax(28rem, 1.18fr);
  align-items: start;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + .3rem);
  background: var(--surface);
  box-shadow: 0 2rem 7rem rgb(0 0 0 / 32%);
}

.panel { min-width: 0; padding: clamp(1.25rem, 3vw, 2.25rem); }
.editor-panel { position: sticky; top: 1rem; border-right: 1px solid var(--line); }
.result-panel { min-height: 48rem; }

.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.panel-heading h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.035em; }
.panel-index { margin-bottom: .35rem; color: var(--faint); }

.schema-chip, .optimal-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0 .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: .7rem;
}

.optimal-badge { border-color: #2b6b4b; background: var(--green-dark); color: var(--green); text-transform: uppercase; letter-spacing: .08em; }

.editor-label { display: block; margin-bottom: .5rem; color: var(--muted); font-size: .78rem; font-weight: 650; }

textarea {
  display: block;
  width: 100%;
  min-height: 27rem;
  resize: vertical;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  outline: none;
  background: #09100d;
  color: #cfe3d8;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: .78rem;
  line-height: 1.65;
  tab-size: 2;
}

textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(114 230 170 / 12%); }
.editor-hint { margin: .65rem 0 0; color: var(--faint); font-size: .72rem; }
kbd { padding: .08rem .3rem; border: 1px solid var(--line); border-radius: .25rem; background: var(--surface-raised); font: inherit; }

.actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.25rem; }
.button { min-height: 2.75rem; padding: 0 1rem; border: 1px solid var(--line); border-radius: .65rem; cursor: pointer; font-size: .82rem; font-weight: 700; }
.button.primary { border-color: var(--green); background: var(--green); color: #07100b; }
.button.primary:hover { background: #9bf3c4; }
.button.secondary { background: var(--surface-raised); color: var(--ink); }
.button.secondary:hover, .button.quiet:hover { border-color: #4b665b; }
.button.quiet { margin-left: auto; background: transparent; color: var(--muted); }
.button:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.button:disabled { cursor: not-allowed; opacity: .42; }

.status { min-height: 1.3rem; margin: 1rem 0 0; color: var(--muted); font-size: .78rem; }
.status[data-tone="success"] { color: var(--green); }
.status[data-tone="error"] { color: var(--red); }

.empty-state { display: grid; place-items: center; min-height: 35rem; text-align: center; }
.empty-state p { max-width: 22rem; color: var(--faint); line-height: 1.6; }
.empty-rings { position: relative; display: block; width: 9rem; height: 5rem; }
.empty-rings i { position: absolute; top: 50%; width: 4rem; aspect-ratio: 1; transform: translateY(-50%); border: 1px solid #355046; border-radius: 50%; }
.empty-rings i:nth-child(1) { left: 0; }
.empty-rings i:nth-child(2) { left: 2.4rem; }
.empty-rings i:nth-child(3) { left: 4.8rem; border-color: #4d765f; background: rgb(114 230 170 / 5%); }

.metrics { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); margin: 0 0 2rem; border-block: 1px solid var(--line); }
.metric { min-width: 0; padding: 1rem; }
.metric:first-child { padding-left: 0; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric dt { color: var(--faint); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.metric dd { margin: .35rem 0 0; overflow-wrap: anywhere; font-size: clamp(1rem, 2.2vw, 1.45rem); font-weight: 680; letter-spacing: -.025em; }
.primary-metric dd { color: var(--yellow); }

.result-section { margin-top: 2rem; }
.result-section h3 { margin: 0 0 .75rem; color: var(--muted); font-size: .72rem; letter-spacing: .11em; text-transform: uppercase; }
.gear-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.gear-item { display: grid; grid-template-columns: 1fr auto; gap: .75rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.gear-name strong { display: block; margin-bottom: .2rem; font-size: .9rem; }
.gear-name span, .gear-meta { color: var(--faint); font-size: .75rem; }
.gear-meta { text-align: right; }
.empty-copy { margin: 0; color: var(--faint); font-size: .82rem; }

.route-card { padding: 1rem 0; border-top: 1px solid var(--line); }
.route-card header { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.route-card h4 { margin: 0; font-size: .95rem; }
.route-card header span { color: var(--green); font-family: "Cascadia Mono", Consolas, monospace; font-size: .72rem; }
.route-steps { display: flex; align-items: stretch; gap: .4rem; margin: 0; padding: 0; overflow-x: auto; list-style: none; }
.route-steps:focus-visible { outline: 2px solid var(--yellow); outline-offset: .35rem; }
.route-steps li { position: relative; flex: 0 0 auto; min-width: 5.5rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: .55rem; background: #0c1511; }
.route-steps li + li { margin-left: .7rem; }
.route-steps li + li::before { content: "→"; position: absolute; left: -1.05rem; color: var(--faint); }
.route-steps strong, .route-steps span { display: block; }
.route-steps strong { font-size: .75rem; }
.route-steps span { margin-top: .15rem; color: var(--faint); font-size: .65rem; }
.route-steps .filter-step { border-color: #3d634f; background: var(--green-dark); }
.physical-note { margin: 2rem 0 0; padding: 1rem; border-left: 2px solid var(--yellow); background: rgb(255 226 138 / 5%); color: var(--muted); font-size: .78rem; line-height: 1.55; }
.physical-note strong { color: var(--yellow); }

.method { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 7vw, 7rem); padding: clamp(5rem, 10vw, 9rem) 0; }
.method h2 { max-width: 14ch; margin: 0; font-size: clamp(2rem, 4.5vw, 4.2rem); line-height: 1; letter-spacing: -.055em; }
.method ol { margin: 0; padding: 0; list-style: none; }
.method li { display: grid; grid-template-columns: 2.8rem 8rem 1fr; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.method li span { color: var(--green); font-family: "Cascadia Mono", Consolas, monospace; font-size: .72rem; }
.method li p { margin: 0; color: var(--muted); line-height: 1.5; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0 3rem; border-top: 1px solid var(--line); color: var(--faint); font-size: .78rem; }
footer p { margin: 0; }

[hidden] { display: none !important; }

@media (max-width: 64rem) {
  .hero-copy, .workbench, .method { grid-template-columns: 1fr; }
  .hero-lede { grid-column: 1; grid-row: 3; margin-top: 1.5rem; }
  .editor-panel { position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-panel { min-height: 35rem; }
  .method h2 { max-width: 18ch; }
}

@media (max-width: 42rem) {
  .site-header, main, footer { width: min(100% - 1.5rem, 88rem); }
  .site-header nav a:first-child { display: none; }
  .hero { padding-top: 3.5rem; }
  h1 { font-size: clamp(3rem, 18vw, 5rem); }
  .proof-strip { grid-template-columns: 1fr; }
  .proof-strip div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .workbench { border-radius: 1rem; }
  .panel { padding: 1.1rem; }
  textarea { min-height: 22rem; font-size: .72rem; }
  .button { flex: 1 1 auto; }
  .button.quiet { margin-left: 0; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .method li { grid-template-columns: 2rem 1fr; }
  .method li p { grid-column: 2; }
  footer { flex-direction: column; }
}

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