:root {
  --bone: #f4eee4;
  --gel: #e7d3a4;
  --amber: #c4842a;
  --amber-2: #e0a24a;
  --kettle: #2a1c12;
  --ink: #22180f;
  --mute: #6a5846;
  --hold: #b43a28;
  --ok: #3d7a48;
  --line: rgba(34, 24, 15, 0.14);
  --serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", 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(--bone);
  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(196, 132, 42, 0.12);
  padding: 0.05em 0.35em;
}
.app-link { color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.16;
  background-image: url("images/texture.webp");
  background-size: 560px auto;
  mix-blend-mode: multiply;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 80; background: #fff; padding: 8px 12px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(244, 238, 228, 0.94);
  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(--amber); color: var(--amber);
  transform: rotate(-7deg); font-family: var(--serif);
}
.nav-toggle {
  display: none;
  background: var(--amber);
  border: 1px solid var(--amber);
  color: var(--kettle);
  padding: 8px 16px;
  font-weight: 600;
}
.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(--amber); border-bottom-color: var(--amber-2); }

.hero { position: relative; min-height: min(94vh, 920px); display: grid; align-items: end; color: var(--bone); 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(42, 28, 18, 0.82) 0%, rgba(42, 28, 18, 0.28) 55%, rgba(42, 28, 18, 0.5) 100%),
    linear-gradient(180deg, transparent 28%, rgba(42, 28, 18, 0.9) 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.2em; color: var(--amber-2); }
.vlabel { color: var(--amber); writing-mode: vertical-rl; letter-spacing: 0.38em; 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, 238, 228, 0.9); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.chip { border: 1px solid rgba(244, 238, 228, 0.35); padding: 4px 10px; font-size: 12px; }
.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(--amber); color: var(--kettle); border-color: var(--amber); }
.btn-ghost { background: transparent; color: inherit; }
.disclaimer { margin: 18px 0 0; font-size: 13px; color: rgba(244, 238, 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; }
.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: #fff8ee; border: 1px solid var(--line); padding: 22px; }
.card:nth-child(2) { transform: translateY(16px); }
.card:nth-child(3) { transform: translateY(-8px); }
.stamp { display: inline-block; font-size: 11px; letter-spacing: 0.16em; color: var(--amber); border: 1px solid var(--amber); 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(--gel) 0%, var(--bone) 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.16em; color: var(--amber); display: block; margin-bottom: 8px; }
figure { margin: 0; }
figure img { width: 100%; height: 340px; object-fit: cover; box-shadow: 18px 22px 0 rgba(196, 132, 42, 0.16); }
figcaption { margin-top: 10px; font-size: 13px; color: var(--mute); }
.gate-demo { margin-top: 20px; padding: 14px 16px; border: 1px dashed var(--amber); background: rgba(196, 132, 42, 0.08); }
.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: #fff8ee; border: 1px solid var(--line); padding: 6px 10px; font-family: var(--num); font-size: 12px; }
.lot-btn.is-on { border-color: var(--amber); color: var(--amber); }
.gate-status { font-family: var(--num); font-size: 13px; }
.gate-status.ok { color: var(--ok); }
.gate-status.bad { color: var(--hold); }
.bench-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.bench { padding: 18px; background: #fff8ee; border-left: 4px solid var(--amber); }
.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(4, 1fr); gap: 10px; margin-top: 28px; }
.limit { background: var(--kettle); color: var(--bone); padding: 14px; }
.limit span { display: block; font-size: 11px; letter-spacing: 0.12em; color: var(--amber-2); 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(--kettle); color: var(--gel); }
.footer-inner { padding: 32px 0; display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
footer .app-link { color: var(--amber-2); }

@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(--bone); 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(196, 132, 42, 0.16); }
  .wrap { width: min(1140px, calc(100% - 32px)); padding: 56px 0; }
}
