@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --paper: #f1ead8;
  --paper-deep: #e5dcc6;
  --ink: #29291f;
  --muted: #686457;
  --line: #bdb49f;
  --accent: #a20f1b;
  --accent-soft: #c34a42;
  --white: #faf5e8;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgb(255 255 255 / 24%), transparent 25rem),
    repeating-linear-gradient(0deg, rgb(64 52 32 / 1.2%) 0 1px, transparent 1px 4px),
    var(--paper);
  font-family: "Libre Baskerville", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

.site-header,
main,
footer {
  width: min(880px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 3px double var(--line);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: contain;
}

.site-header nav {
  display: flex;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.site-header nav a {
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--accent);
}

.page-intro {
  max-width: 700px;
  padding: 92px 0 104px;
}

.label,
.status,
.section-number {
  margin: 0;
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.label a {
  text-decoration: none;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  font-family: "Libre Baskerville", Georgia, serif;
}

h1 {
  margin: 18px 0 28px;
  font-size: clamp(48px, 8vw, 76px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.page-intro p:not(.label, .summary, .note, .source-line) {
  max-width: 650px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.summary {
  max-width: 710px;
  margin: 0 0 18px;
  font-size: clamp(20px, 2.7vw, 27px);
  line-height: 1.55;
}

.note {
  margin: 34px 0 0;
  padding-left: 15px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

.article-header {
  padding: 68px 0 48px;
  border-top: 3px double var(--line);
}

.article-header h2 {
  margin: 13px 0 14px;
  font-size: clamp(32px, 4.5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.article-header > p:last-child {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.design-section,
.detail-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 48px;
  padding: 48px 0;
  border-top: 1px solid var(--line);
}

#design {
  counter-reset: design-section;
}

.design-section {
  counter-increment: design-section;
}

.design-section h3,
.implementation-row h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.45;
}

.design-section h3::before {
  display: block;
  margin-bottom: 11px;
  color: var(--accent);
  content: counter(design-section, upper-roman) ".";
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.design-section p,
.section-copy p,
.implementation-row > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.design-section p + p,
.section-copy p + p {
  margin-top: 18px;
}

.implementations {
  padding-bottom: 80px;
}

.implementation-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 210px;
  gap: 32px;
  align-items: start;
  padding: 34px 0;
  border-top: 1px solid var(--line);
}

.implementation-row .status {
  margin-bottom: 8px;
  color: var(--muted);
}

.implementation-row .current {
  color: var(--accent);
}

.implementation-row.planned {
  opacity: 0.72;
}

.text-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.detail-intro {
  padding-bottom: 90px;
}

.source-line {
  margin-top: 32px;
}

.detail-section {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 56px;
  padding: 58px 0;
}

.section-title {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: baseline;
}

.section-title h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.section-number {
  color: #89928c;
}

code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--paper-deep);
  font-family: "DM Mono", monospace;
  font-size: 0.9em;
}

.page-nav {
  display: flex;
  justify-content: space-between;
  padding: 36px 0 76px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.page-nav a {
  color: var(--accent);
  text-decoration: none;
}

.page-nav a:hover {
  text-decoration: underline;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 28px 0;
  border-top: 3px double var(--line);
  color: var(--muted);
  font-size: 11px;
}

footer span:first-child {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    gap: 22px;
    flex-direction: column;
    padding: 20px 0;
  }

  .site-header nav {
    flex-wrap: wrap;
    gap: 10px 20px;
  }

  .page-intro {
    padding: 72px 0 82px;
  }

  .design-section,
  .detail-section {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .implementation-row {
    grid-template-columns: 110px 1fr;
  }

  .implementation-row .text-link {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .site-header,
  main,
  footer {
    width: min(100% - 30px, 880px);
  }

  h1 {
    font-size: 52px;
  }

  .summary {
    font-size: 21px;
  }

  .implementation-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .implementation-row .text-link {
    grid-column: 1;
  }

  .page-nav,
  footer {
    gap: 14px;
    flex-direction: column;
  }
}

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