:root {
  --bg: #f4f4f5;
  --ink: #0c0c0c;
  --muted: #71717a;
  --line: rgba(12, 12, 12, 0.1);
  --accent: #0c0c0c;
  --accent-hot: #e11d48;
  --surface: #ffffff;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-ui: "Sora", system-ui, sans-serif;
  --pad: clamp(1rem, 4.5vw, 1.75rem);
  --max: 40rem;
  --radius: 0.85rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.02rem;
  line-height: 1.62;
  background:
    radial-gradient(ellipse 90% 55% at 100% -5%, rgba(225, 29, 72, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 70% 45% at 0% 100%, rgba(12, 12, 12, 0.04) 0%, transparent 45%),
    var(--bg);
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem var(--pad);
  background: rgba(244, 244, 245, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  flex: 1;
  min-width: 0;
}

.back {
  display: none;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 2.4rem;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.back:hover {
  border-color: var(--ink);
  transform: translateX(-1px);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.8vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.brand-sub {
  margin: 0.2rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

main {
  flex: 1;
  width: min(100%, calc(var(--max) + 2 * var(--pad)));
  margin: 0 auto;
  padding: 0 var(--pad) 3.5rem;
}

.home-hero {
  margin: 1rem calc(var(--pad) * -1) 1.35rem;
  overflow: hidden;
  background: #d4d4d8;
  animation: fade-up 0.5s ease both;
}

.home-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center;
  filter: contrast(1.05) saturate(0.92);
}

.hero-caption {
  margin: 0;
  padding: 0.55rem 0.85rem 0.7rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  margin: 0 0 0.7rem;
  width: 100%;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 6vw, 2.35rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.045em;
  animation: fade-up 0.5s ease 0.05s both;
}

.support {
  margin: 0 0 1.5rem;
  width: 100%;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  animation: fade-up 0.5s ease 0.1s both;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: fade-up 0.5s ease 0.18s both;
}

.toc-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 1rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  text-align: left;
  text-decoration: none;
  font: inherit;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.toc-item:hover,
.toc-item:focus-visible {
  background: var(--surface);
  border-color: rgba(12, 12, 12, 0.22);
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(12, 12, 12, 0.06);
}

.toc-num {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-hot);
  letter-spacing: -0.03em;
}

.toc-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.toc-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.toc-teaser {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.toc-go {
  color: var(--muted);
  font-size: 1.15rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.toc-item:hover .toc-go {
  color: var(--ink);
  transform: translateX(3px);
}

.source {
  margin: 2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.reader {
  display: none;
  padding-top: 1.15rem;
  animation: fade-up 0.28s ease;
}

.reader:target {
  display: block;
}

body:has(.reader:target) .home {
  display: none;
}

body:has(.reader:target) .back {
  display: block;
}

body:has(.reader:target) .brand-sub {
  visibility: hidden;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-img {
  margin: 0 0 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: #d4d4d8;
  border: 1px solid var(--line);
}

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

.reader h1 {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6.5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.body p {
  margin: 0 0 1rem;
}

.body p:last-child {
  margin-bottom: 0;
}

.pager {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.pager a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.85rem 0.9rem;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.pager a:hover {
  border-color: rgba(12, 12, 12, 0.35);
  transform: translateY(-1px);
}

.pager-muted {
  opacity: 0.45;
}

.pager-next {
  background: var(--ink) !important;
  color: #fafafa !important;
  border-color: var(--ink) !important;
}

.pager-next:hover {
  background: #2a2a2a !important;
}

@media (min-width: 640px) {
  .home-hero {
    margin: 1.25rem 0 1.5rem;
    border-radius: 1rem;
  }

  .toc-item {
    padding: 1.1rem 1.05rem;
  }
}

.reader:target {
  scroll-margin-top: 4.5rem;
}

#home:target {
  scroll-margin-top: 4.5rem;
}
