:root {
  --night: #141c16;
  --ramie: #7e9168;
  --ivory: #f4efe4;
  --paper: #ebe4d4;
  --sheet: #faf6ec;
  --alkali: #1c7f7c;
  --alkali-bright: #3ad4c8;
  --hold: #c45a32;
  --pass: #3a8a58;
  --ink: #1a2218;
  --mute: #5c6a58;
  --line: rgba(26, 34, 24, 0.14);
  --serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --num: ui-monospace, "SF Mono", Menlo, monospace;
}

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

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 72px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code {
  font-family: var(--num);
  font-size: 0.9em;
  background: rgba(28, 127, 124, 0.1);
  padding: 0.05em 0.35em;
}
.app-link {
  color: var(--alkali);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.14;
  background-image: url("images/texture.webp");
  background-size: 640px auto;
  mix-blend-mode: multiply;
}
.skip { position: absolute; left: -999px; }
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 80;
  background: var(--sheet);
  padding: 8px 12px;
}
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: rgba(244, 239, 228, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 700;
}
.brand small {
  display: block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--mute);
}
.seal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--alkali);
  color: var(--alkali);
  transform: rotate(-8deg);
  font-family: var(--serif);
}
.nav-toggle {
  display: none;
  background: var(--sheet);
  border: 1px solid var(--alkali);
  color: var(--alkali);
  padding: 8px 14px;
}
.nav-links { display: flex; gap: 16px; font-size: 14px; }
.nav-links a {
  color: var(--mute);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.nav-links a.is-active,
.nav-links a:hover {
  color: var(--alkali);
  border-bottom-color: var(--alkali-bright);
}
.hero {
  position: relative;
  min-height: 94vh;
  display: grid;
  align-items: end;
  color: var(--ivory);
  overflow: hidden;
}
.hero picture,
.hero img.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(20, 28, 22, 0.78) 0%, rgba(20, 28, 22, 0.28) 52%, rgba(20, 28, 22, 0.55) 100%),
    linear-gradient(180deg, transparent 30%, rgba(20, 28, 22, 0.88) 100%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  padding: 8vh 7vw 9vh;
  max-width: 980px;
}
.kicker,
.vlabel {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--alkali-bright);
}
.vlabel {
  color: var(--alkali);
  writing-mode: vertical-rl;
  letter-spacing: 0.4em;
  font-size: 13px;
}
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.08;
  margin: 0 0 16px;
}
h1 { font-size: clamp(42px, 8vw, 92px); letter-spacing: -0.04em; }
h2 { font-size: clamp(28px, 3.6vw, 42px); }
h3 { font-size: 21px; }
.lead {
  font-size: 18px;
  max-width: 38em;
  color: rgba(244, 239, 228, 0.9);
}
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.chip {
  border: 1px solid rgba(244, 239, 228, 0.35);
  padding: 4px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid currentColor;
  font-size: 14px;
}
.btn-fill {
  background: var(--alkali-bright);
  color: var(--night);
  border-color: var(--alkali-bright);
}
.btn-ghost { background: transparent; color: inherit; }
.disclaimer {
  margin: 18px 0 0;
  font-size: 13px;
  color: rgba(244, 239, 228, 0.65);
}
.wrap {
  width: min(1140px, calc(100% - 48px));
  margin: 0 auto;
  padding: 84px 0;
}
.section-head {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 20px;
  margin-bottom: 40px;
  align-items: start;
}
.section-head p:last-child { color: var(--mute); margin: 0; max-width: 46em; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 22px;
}
.card:nth-child(2) { transform: translateY(18px); }
.card:nth-child(3) { transform: translateY(-8px); }
.stamp {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--alkali);
  border: 1px solid var(--alkali);
  padding: 2px 8px;
  margin-bottom: 10px;
  transform: rotate(-2deg);
}
.card ul, .io-grid ul, .rule-list { margin: 0; padding-left: 1.1em; }
.card li, .io-grid li, .rule-list li { margin: 0.35em 0; }
.alt { background: linear-gradient(180deg, var(--paper) 0%, var(--ivory) 100%); }
.step {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 36px;
  align-items: center;
  margin-bottom: 64px;
}
.step.reverse { grid-template-columns: 0.95fr 1.05fr; }
.step.reverse .step-copy { order: 2; }
.num {
  font-family: var(--num);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--alkali);
  display: block;
  margin-bottom: 8px;
}
figure { margin: 0; }
figure img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  box-shadow: 18px 22px 0 rgba(28, 127, 124, 0.12);
}
figcaption { margin-top: 10px; font-size: 13px; color: var(--mute); }
.gate-demo {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px dashed var(--alkali);
  background: rgba(28, 127, 124, 0.06);
}
.gate-demo p { margin: 0 0 8px; font-size: 13px; }
.gate-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.lot-btn {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-family: var(--num);
  font-size: 12px;
}
.lot-btn.is-on { border-color: var(--alkali); color: var(--alkali); }
.gate-status { font-family: var(--num); font-size: 13px; }
.gate-status.ok { color: var(--pass); }
.gate-status.bad { color: var(--hold); }
.bench-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.bench {
  padding: 18px;
  background: var(--sheet);
  border-left: 4px solid var(--ramie);
}
.bench h3 { font-size: 18px; margin-bottom: 8px; }
.bench p { margin: 0; color: var(--mute); font-size: 14px; }
.limits {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 28px;
}
.limit { background: var(--night); color: var(--ivory); padding: 14px; }
.limit span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--alkali-bright);
  margin-bottom: 6px;
}
.limit strong { font-family: var(--num); font-size: 18px; font-weight: 500; }
.rule-list { font-size: 17px; max-width: 46em; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.wide-fig { margin-top: 36px; }
.wide-fig img { height: 380px; }
footer { background: var(--night); color: var(--paper); }
.footer-inner {
  padding: 32px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}
footer .app-link { color: var(--alkali-bright); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 12px 20px 18px;
    background: var(--ivory);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .section-head, .grid-3, .step, .io-grid, .bench-grid, .limits, .footer-inner {
    grid-template-columns: 1fr;
  }
  .vlabel { writing-mode: horizontal-tb; letter-spacing: 0.2em; }
  .card:nth-child(2), .card:nth-child(3) { transform: none; }
  .step.reverse .step-copy { order: 0; }
  .footer-inner { display: flex; flex-direction: column; }
  figure img, .wide-fig img {
    height: 220px;
    box-shadow: 8px 10px 0 rgba(28, 127, 124, 0.12);
  }
  .wrap {
    width: min(1140px, calc(100% - 32px));
    padding: 56px 0;
  }
}
