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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.28s var(--ease-arch), color 0.28s var(--ease-arch);
}

/* Customized browser chrome surfaces */
::selection {
  background: var(--kinpaku);
  color: var(--kinpaku-ink);
}

:focus-visible {
  outline: 2px solid var(--kinpaku-text);
  outline-offset: 3px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--canvas-deep); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}

.wrap {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0;
  max-width: 65ch;
  text-wrap: pretty;
  color: var(--ink-muted);
}

code, pre, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Subtle architectural drafting background */
.ar-drafting-grid {
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---- Navigation Rail ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--canvas) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark-name {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--kinpaku-text);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.16s var(--ease-arch);
}

.nav-links a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 6px;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color 0.16s var(--ease-arch), background-color 0.16s var(--ease-arch);
}

.ctl-btn:hover {
  border-color: var(--kinpaku-text);
  background: var(--surface-raised);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--kinpaku);
  background: var(--kinpaku);
  color: var(--kinpaku-ink);
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.16s var(--ease-arch), transform 0.16s var(--ease-arch);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.16s var(--ease-arch), background-color 0.16s var(--ease-arch);
}

.btn-secondary:hover {
  border-color: var(--kinpaku-text);
  background: var(--surface-raised);
}

/* ---- Editorial Section Bands ---- */
.section-band {
  border-bottom: 1px solid var(--border);
  padding-top: 68px;
  padding-bottom: 68px;
}
.hero-band {
  padding-top: 56px;
  padding-bottom: 56px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.section-head h2 {
  font-size: clamp(2.1rem, 4.2vw, 3.35rem);
  letter-spacing: -0.02em;
}

.section-head p {
  font-size: 1.02rem;
}

/* ---- Hero & Interactive Before / After Curtain ---- */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.18fr);
  gap: clamp(28px, 4vw, 52px);
  align-items: center;
}

.hero-copy {
  min-width: 0;
  max-width: 100%;
}

.hero-copy h1 {
  font-size: clamp(2.55rem, 4.9vw, 4.45rem);
  letter-spacing: -0.025em;
  line-height: 1.04;
}

.hero-copy h1 .accent-word {
  display: block;
  margin-top: 6px;
  color: var(--kinpaku-text);
}

.hero-lead {
  margin-top: 18px;
  font-size: 1.08rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-cmd {
  margin-top: 22px;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.hero-cmd code {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.84rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-stage {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 10.8;
  min-height: 360px;
  user-select: none;
  touch-action: pan-y;
}

.compare-pane {
  position: absolute;
  inset: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.compare-pane svg {
  width: 100%;
  height: 100%;
  display: block;
}

.compare-after {
  clip-path: inset(0 calc(100% - var(--split, 54%)) 0 0);
}

.compare-tag {
  position: absolute;
  top: 14px;
  z-index: 4;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  background: var(--canvas);
  color: var(--ink);
}

.compare-tag.is-after {
  left: 14px;
  color: var(--kinpaku-text);
  border-color: var(--kinpaku-text);
}

.compare-tag.is-before {
  right: 14px;
  color: var(--ink-muted);
}

.compare-divider {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: var(--split, 54%);
  width: 2px;
  background: var(--kinpaku);
  z-index: 5;
  transform: translateX(-50%);
  cursor: ew-resize;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--kinpaku);
  color: var(--kinpaku-ink);
  border: 2px solid var(--canvas);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px oklch(2% 0.005 90 / 0.45);
}

/* ---- Live Interactive Sandbox ---- */
.demo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
}

.demo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s var(--ease-arch);
}

.tab-btn:hover { color: var(--ink); border-color: var(--border-strong); }

.tab-btn.is-active {
  background: var(--kinpaku);
  border-color: var(--kinpaku);
  color: var(--kinpaku-ink);
}

.demo-frame-wrap {
  position: relative;
  height: clamp(460px, 62vh, 640px);
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  background: var(--canvas-deep);
  box-shadow: var(--shadow);
}

.demo-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.demo-veil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 24px;
  background: linear-gradient(to top, oklch(4% 0.004 95 / 0.52), transparent 38%);
  cursor: pointer;
  transition: opacity 0.2s var(--ease-arch);
}

.demo-veil.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.demo-veil-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--kinpaku);
  color: var(--kinpaku-ink);
  border: 1px solid var(--kinpaku);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

/* ---- Multi-Host Command Rail ---- */
.host-rail {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.host-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.host-tab {
  flex: 1 1 120px;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.16s var(--ease-arch), color 0.16s var(--ease-arch);
}

.host-tab:last-child { border-right: 0; }
.host-tab:hover { color: var(--ink); background: var(--surface); }
.host-tab.is-active {
  color: var(--kinpaku-ink);
  background: var(--kinpaku);
  font-weight: 700;
}

.host-body {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: 24px;
}
.host-body > *, .host-side > * { min-width: 0; }

.code-block {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--canvas-deep);
  padding: 14px 16px;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.code-block pre {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--ink);
}

.host-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meta-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--canvas);
}

.meta-row dt {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.meta-row dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--kinpaku-text);
  font-weight: 600;
}

/* ---- 10-Layer Periodic Matrix ---- */
.layer-matrix {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border-strong);
  background: var(--surface);
}

.layer-cell {
  border: 0;
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  transition: background-color 0.16s var(--ease-arch);
}

.layer-cell:hover { background: var(--surface-raised); }

.layer-cell.is-active {
  background: var(--kinpaku-soft);
  box-shadow: inset 0 0 0 1px var(--kinpaku-text);
}

.layer-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--kinpaku-text);
  font-weight: 700;
}

.layer-cell-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.layer-cell-zone {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.layer-detail {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.layer-detail-info h3 {
  font-size: 1.5rem;
}

.layer-detail-info p {
  margin-top: 6px;
  font-size: 0.94rem;
}

.layer-detail-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--ink);
  background: var(--canvas);
}

/* ---- Three Lenses & Honesty Ledger (No Nested Cards) ---- */
.ledger-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

.ledger-col {
  padding: 26px 24px;
  border-right: 1px solid var(--border);
}

.ledger-col:last-child { border-right: 0; }

.ledger-col h3 {
  font-size: 1.65rem;
  color: var(--kinpaku-text);
  margin-bottom: 10px;
}

.ledger-col p {
  font-size: 0.95rem;
}

.boundary-strip {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.boundary-item {
  padding-top: 14px;
  border-top: 1px solid var(--border-strong);
}

.boundary-item strong {
  display: block;
  font-size: 0.96rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.boundary-item p {
  font-size: 0.9rem;
}

/* ---- Footer ---- */
.site-footer {
  padding-block: 40px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--kinpaku-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---- Responsive Breakpoints ---- */
@media (max-width: 980px) {
  .nav-links { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .host-body { grid-template-columns: 1fr; }
  .layer-matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger-grid { grid-template-columns: 1fr; }
  .ledger-col { border-right: 0; border-bottom: 1px solid var(--border); }
  .ledger-col:last-child { border-bottom: 0; }
  .boundary-strip { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .compare-tag.is-before {
    top: auto;
    bottom: 12px;
    right: 12px;
  }
  .compare-tag.is-after {
    top: 12px;
    left: 12px;
  }
}

@media (max-width: 560px) {
  .wrap { width: calc(100% - 24px); }
  .layer-matrix { grid-template-columns: 1fr; }
  .brand-version { display: none; }
  .ctl-btn span.hide-xs { display: none; }
  .demo-frame-wrap { height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
