:root {
  color-scheme: light;
  --page-bg: #f5f5f7;
  --elevated: #ffffff;
  --ink: #1d1d1f;
  --ink-muted: #6e6e73;
  --accent: #0071e3;
  --card: #ffffff;
  --border: #d2d2d7;
  --selection: #e8e8ed;
  --running: #248a3d;
  --titlebar: #fbfbfd;
  --shadow: rgba(0, 0, 0, 0.08);
  --header-height: 4.25rem;
  --page: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page-bg: #1c1c1e;
    --elevated: #2c2c2e;
    --ink: #f5f5f7;
    --ink-muted: #a1a1a6;
    --accent: #0a84ff;
    --card: #2c2c2e;
    --border: #3a3a3c;
    --selection: #3a3a3c;
    --running: #30d158;
    --titlebar: #242426;
    --shadow: rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #1c1c1e;
  --elevated: #2c2c2e;
  --ink: #f5f5f7;
  --ink-muted: #a1a1a6;
  --accent: #0a84ff;
  --card: #2c2c2e;
  --border: #3a3a3c;
  --selection: #3a3a3c;
  --running: #30d158;
  --titlebar: #242426;
  --shadow: rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
  background: var(--page-bg);
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 0.9rem;
  background: var(--accent);
  color: #ffffff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
  color: #ffffff;
}

.wrap {
  width: min(var(--page), calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-height);
  background: color-mix(in srgb, var(--page-bg) 82%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-height);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1;
}

.wordmark img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
}

.wordmark:hover {
  color: var(--ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1.35rem;
}

.site-nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.site-nav a:hover {
  color: var(--accent);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.85rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
}

.hero {
  position: relative;
  padding: 4.5rem 0 1rem;
  overflow: hidden;
}

.hero-inner,
.chapter-inner {
  position: relative;
  text-align: center;
}

.hero-mark {
  width: 7rem;
  height: 7rem;
  margin: 0 auto 1.5rem;
  border-radius: 1.6rem;
}

.kicker {
  margin: 0 0 0.65rem;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.display {
  margin: 0;
  font-size: clamp(4.5rem, 14vw, 8rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.lede {
  max-width: 36rem;
  margin: 1.35rem auto 0;
  color: var(--ink-muted);
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.45;
}

.soon {
  display: inline-block;
  margin: 1.35rem 0 0;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.stage-wrap {
  position: relative;
  margin-top: 3.5rem;
}

.window {
  margin: 0 auto;
  max-width: 52rem;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px var(--shadow);
  overflow: hidden;
  text-align: left;
}

.window-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--titlebar);
}

.titlebar img {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 0.25rem;
}

.titlebar-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.status {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.status-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.4rem;
  border-radius: 999px;
  background: var(--running);
  vertical-align: 0.05em;
}

.window-body {
  display: grid;
  grid-template-columns: 11.5rem 1fr;
  min-height: 18rem;
}

.sidebar {
  padding: 1rem 0.75rem;
  background: var(--page-bg);
  border-right: 1px solid var(--border);
}

.sidebar-label,
.shelf-label {
  margin: 0 0 0.45rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-item {
  margin: 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.sidebar-item.indent {
  margin-left: 0.85rem;
}

.sidebar-item.is-current {
  background: var(--selection);
  color: var(--ink);
  font-weight: 600;
}

.thread {
  padding: 1.5rem 1.5rem 1.75rem;
}

.reply-title {
  margin: 0 0 0.45rem;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.state {
  margin: 0;
  color: var(--ink-muted);
}

.chapter {
  padding: 7.5rem 0;
  scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

.chapter h2 {
  margin: 0 auto 1rem;
  max-width: 16ch;
  font-size: clamp(2.6rem, 6vw, 4.25rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.chapter-inner > p {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--ink-muted);
  font-size: 1.15rem;
}

.panel {
  max-width: 32rem;
  margin: 2.25rem auto 0;
  padding: 1.25rem 1.3rem 1.35rem;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.shelf-label:first-child {
  margin-top: 0;
}

.shelf-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.shelf-row > span:first-child {
  margin-right: auto;
}

.shelf-action {
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.write {
  margin: 1.1rem 0 0;
  color: var(--accent);
  font-weight: 600;
}

.names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.names li {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.92rem;
}

.site-footer {
  padding: 1.5rem 0 2.25rem;
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.85rem 0;
  }

  .header-actions,
  .site-nav {
    justify-content: center;
    width: 100%;
  }

  .window-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.35rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-label {
    width: 100%;
    margin-bottom: 0.15rem;
  }

  .hero {
    padding-top: 3rem;
  }

  .chapter {
    padding: 5rem 0;
  }

  .display {
    font-size: clamp(3.6rem, 18vw, 5rem);
  }
}
