:root {
  --paper: #f5f1e8;
  --surface: rgba(255, 255, 255, 0.28);
  --ink: #12110e;
  --muted: #726c64;
  --line: rgba(18, 17, 14, 0.16);
  --accent: #c73c2b;
  --max-width: 1360px;
  --font-display: "Avenir Next", "Helvetica Neue", "Hiragino Sans GB",
    "Yu Gothic", "Apple SD Gothic Neo", sans-serif;
  --font-text: "Iowan Old Style", "Palatino Linotype", "Songti SC",
    "Noto Serif JP", "Noto Serif KR", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(199, 60, 43, 0.08), transparent 24%),
    linear-gradient(180deg, #faf7f1 0%, var(--paper) 38%, #f7f3eb 100%);
  color: var(--ink);
  font-family: var(--font-display);
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 1rem;
  width: 1px;
  height: 100vh;
  background: linear-gradient(180deg, transparent, rgba(199, 60, 43, 0.45), transparent);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
}

.topbar,
.hero-grid,
.section,
.footer {
  width: min(calc(100% - 2.5rem), var(--max-width));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 0 0.95rem;
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(245, 241, 232, 0.9), rgba(245, 241, 232, 0.65));
  border-bottom: 1px solid rgba(18, 17, 14, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand-mark {
  width: 1.8rem;
  height: 1.8rem;
  flex: none;
}

.brand-text {
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.lang-switch button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.lang-switch button:hover,
.lang-switch button:focus-visible {
  color: var(--ink);
  background: rgba(18, 17, 14, 0.06);
  outline: none;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.repo-link {
  font-size: 0.84rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 180ms ease;
}

.repo-link:hover,
.repo-link:focus-visible {
  color: var(--accent);
  outline: none;
}

.page-content {
  padding-bottom: 8rem;
}

.hero {
  min-height: calc(100svh - 4.25rem);
  display: flex;
  align-items: flex-end;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: end;
  padding: 5rem 0 4rem;
}

.eyebrow,
.section-kicker,
.path-label,
.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 1rem 0 1.25rem;
  max-width: 10ch;
  font-size: clamp(3.35rem, 9vw, 8.6rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 600;
}

.hero-body {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.8;
  font-family: var(--font-text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.95rem;
  padding: 0.75rem 1.15rem;
  border: 1px solid var(--line);
  color: var(--ink);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(18, 17, 14, 0.32);
  outline: none;
}

.button-primary {
  background: var(--ink);
  color: #fff;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: #000;
}

.hero-side {
  position: relative;
}

.hero-logo {
  width: min(100%, 28rem);
  margin-left: auto;
  display: block;
  opacity: 0.96;
}

.manifesto {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
}

.manifesto p {
  margin: 0;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.section {
  padding: 4.5rem 0 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

.section-index {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.24em;
  color: var(--accent);
  padding-top: 0.1rem;
}

.section-head h2 {
  margin: 0.5rem 0 0;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.05;
  font-weight: 600;
}

.ruled-list,
.mechanism-list,
.doc-links {
  border-top: 1px solid var(--line);
}

.ruled-item,
.mechanism-item,
.doc-link {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1.45rem 0;
  border-bottom: 1px solid var(--line);
}

.item-label {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding-top: 0.25rem;
}

.item-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.item-body {
  margin: 0.45rem 0 0;
  max-width: 50rem;
  color: var(--muted);
  line-height: 1.85;
  font-family: var(--font-text);
}

.structure-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  align-items: start;
}

.path-column {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.path-column.alt {
  border-color: rgba(199, 60, 43, 0.3);
}

.path-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}

.path-list li {
  position: relative;
  padding: 0 0 1.25rem 1.75rem;
  color: var(--ink);
  line-height: 1.6;
}

.path-list li::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: 0;
  width: 0.6rem;
  height: 0.6rem;
  border: 1px solid var(--ink);
  background: transparent;
}

.path-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.1rem;
  left: 0.29rem;
  width: 1px;
  height: calc(100% - 0.25rem);
  background: var(--line);
}

.path-column.alt .path-list li::before {
  border-color: var(--accent);
}

.structure-note {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0;
  max-width: 52rem;
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 1.05rem;
  line-height: 1.9;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2rem;
  border-top: 1px solid var(--line);
}

.module-item {
  padding: 1.35rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

.module-item h3 {
  margin: 0;
  font-size: 1.2rem;
}

.module-item p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  line-height: 1.85;
  font-family: var(--font-text);
}

.mechanism-item {
  align-items: start;
}

.mechanism-copy {
  display: grid;
  gap: 1rem;
}

.code-block,
.formula {
  margin: 0;
  overflow-x: auto;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(18, 17, 14, 0.08);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.8rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
}

.metric-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  align-items: start;
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  border-top: 1px solid var(--line);
}

.plain-list li {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.65;
}

.validation-block {
  align-self: stretch;
}

.doc-link {
  align-items: center;
}

.doc-link a {
  color: var(--accent);
}

.doc-link a:hover,
.doc-link a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.footer {
  padding: 3rem 0 5rem;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.page-content.is-switching {
  opacity: 0.42;
  transition: opacity 180ms ease;
}

@media (max-width: 980px) {
  .hero-grid,
  .structure-layout,
  .module-grid,
  .metric-layout {
    grid-template-columns: 1fr;
  }

  .ruled-item,
  .mechanism-item,
  .doc-link {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    max-width: 12ch;
  }

  .hero-logo {
    width: min(100%, 22rem);
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  body::before {
    left: 0.65rem;
  }

  .topbar,
  .hero-grid,
  .section,
  .footer {
    width: min(calc(100% - 1.5rem), var(--max-width));
  }

  .topbar {
    gap: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .lang-switch {
    flex-wrap: wrap;
  }

  .hero {
    min-height: auto;
  }

  .hero-grid {
    padding: 3.5rem 0 3rem;
  }

  .section {
    padding-top: 3.4rem;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
