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

:root {
  --bg: #08090d;
  --surface: rgba(18, 20, 28, 0.86);
  --surface-strong: rgba(24, 26, 36, 0.96);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #a78bfa;
  --accent-2: #6ee7b7;
  --accent-3: #ff8fb8;
  --text: #ffffff;
  --text-muted: #a5adbd;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --section-pad: clamp(72px, 11vh, 130px) clamp(20px, 6vw, 120px);
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.28) var(--bg);
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(167, 139, 250, 0.14), transparent 28%),
    radial-gradient(circle at 80% 22%, rgba(255, 143, 184, 0.08), transparent 24%),
    var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body[data-route="post-attention"] #bg { opacity: 0.46; }

#app,
.site-footer {
  position: relative;
  z-index: 1;
}

#nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(20px, 5vw, 56px);
  background: rgba(8, 9, 13, 0.74);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.35s ease, background 0.25s ease;
}

#nav.hidden { transform: translateY(-100%); }

.nav-logo {
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2vw, 24px);
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  transition: color 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links .external-link {
  color: rgba(110, 231, 183, 0.86);
}

#nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  background: none;
  border: 0;
  cursor: pointer;
}

#nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#nav-toggle.open span:nth-child(2) { opacity: 0; }
#nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.view {
  min-height: calc(100vh - 80px);
}

section,
.route-page,
.article-page {
  padding: var(--section-pad);
}

.section-inner,
.route-shell,
.article-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.narrow-shell { max-width: 780px; }

.section-kicker,
.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.accent-pink { color: var(--accent-3); }
.accent-green { color: var(--accent-2); }

.section-title {
  max-width: 850px;
  font-size: clamp(2rem, 4.8vw, 4.5rem);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: 0;
}

.hero-screen {
  min-height: 78vh;
  display: flex;
  align-items: center;
  padding-top: 120px;
  padding-bottom: 28px;
}

.hero-copy {
  width: min(920px, 100%);
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: clamp(3.4rem, 9vw, 7.6rem);
  line-height: 0.96;
  letter-spacing: 0;
  margin-bottom: 28px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-3) 48%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-line,
.route-header p,
.featured-reading p,
.reading-principles span,
.post-card p,
.library-card p,
.topic-card p,
.about-copy p,
.article-deck,
.article-content p,
.article-rail p {
  color: var(--text-muted);
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  line-height: 1.72;
}

.hero-line {
  max-width: 720px;
  margin: 0 auto 34px;
}

.hero-actions,
.link-row,
.article-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.link-row.left,
.article-footer {
  justify-content: flex-start;
}

.primary-link,
.text-link,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  font-weight: 700;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.primary-link {
  padding: 12px 20px;
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.text-link {
  padding: 12px 2px;
  color: var(--accent-2);
}

.compact-link {
  margin-top: 24px;
  width: fit-content;
}

.back-link {
  margin-bottom: 46px;
  padding: 8px 0;
  color: var(--text-muted);
}

.back-link::before {
  content: '←';
  margin-right: 10px;
  color: var(--accent);
}

.primary-link:hover,
.text-link:hover,
.back-link:hover {
  transform: translateY(-2px);
}

.feature-band {
  padding-top: 28px;
}

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.72fr);
  gap: 18px;
  align-items: stretch;
}

.featured-reading,
.reading-principles,
.post-card,
.library-card,
.topic-card,
.rail-block,
.callout,
.paper-source {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.featured-reading {
  min-height: 420px;
  padding: clamp(28px, 5vw, 46px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.featured-reading h2 {
  max-width: 760px;
  font-size: clamp(2.25rem, 5.2vw, 5rem);
  line-height: 1.02;
  letter-spacing: 0;
  margin-bottom: 14px;
}

.paper-subtitle {
  color: var(--accent-2) !important;
  margin-bottom: 18px;
  font-size: 0.96rem !important;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.pill-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.pill-row.vertical {
  display: grid;
  margin-top: 14px;
}

.reading-principles {
  padding: 28px;
}

.principle-list {
  display: grid;
  gap: 22px;
  list-style: none;
}

.principle-list li {
  display: grid;
  gap: 8px;
}

.principle-list strong {
  font-size: 1.05rem;
}

.home-latest {
  padding-top: 40px;
}

.section-heading {
  margin-bottom: 34px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.post-card {
  min-height: 340px;
  padding: 24px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px;
  transition: transform 0.28s ease, border-color 0.28s ease, background 0.28s ease;
}

.post-card:hover,
.library-card:hover,
.topic-card:hover {
  transform: translateY(-4px);
  border-color: rgba(167, 139, 250, 0.45);
  background: var(--surface-strong);
}

.post-card span,
.library-card span {
  color: var(--accent-3);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.post-card strong {
  font-size: 1.45rem;
  line-height: 1.17;
}

.post-card small,
.post-card em,
.library-meta,
.article-meta {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-style: normal;
}

.post-card em {
  color: var(--accent-2);
}

.post-card-muted,
.library-card-muted {
  opacity: 0.72;
}

.route-page {
  min-height: 100vh;
  padding-top: clamp(112px, 16vh, 160px);
}

.route-header {
  margin-bottom: clamp(38px, 6vw, 66px);
}

.route-header h1 {
  max-width: 940px;
  font-size: clamp(2.25rem, 5.5vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: 0;
  margin-bottom: 24px;
}

.route-header p {
  max-width: 760px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.filter-button {
  min-height: 38px;
  padding: 8px 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-button:hover,
.filter-button.active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.library-list {
  display: grid;
  gap: 14px;
}

.library-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 28px;
  padding: 24px;
  transition: transform 0.28s ease, border-color 0.28s ease, background 0.28s ease, opacity 0.2s ease;
}

.library-card[hidden] {
  display: none;
}

.library-card h2 {
  margin: 10px 0 4px;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.library-meta {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 9px;
  text-align: right;
}

.library-meta em {
  color: var(--accent-2);
  font-style: normal;
  font-weight: 700;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
}

.topic-card {
  min-height: 260px;
  padding: 24px;
  transition: transform 0.28s ease, border-color 0.28s ease, background 0.28s ease;
}

.topic-card span {
  display: inline-flex;
  margin-bottom: 36px;
  color: var(--accent-3);
  font-size: 0.86rem;
  font-weight: 700;
}

.topic-card h2 {
  margin-bottom: 12px;
  font-size: 1.42rem;
}

.about-copy {
  display: grid;
  gap: 22px;
}

.about-copy .link-row {
  margin-top: 12px;
}

.article-page {
  min-height: 100vh;
  padding-top: clamp(112px, 16vh, 150px);
}

.article-shell {
  max-width: 1160px;
}

.article-header {
  max-width: 940px;
  margin-bottom: clamp(42px, 6vw, 70px);
}

.article-header h1 {
  font-size: clamp(2.6rem, 7vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: 0;
  margin-bottom: 22px;
}

.article-deck {
  max-width: 780px;
  margin-bottom: 20px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.article-meta a {
  color: var(--accent);
  font-weight: 700;
}

.article-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 740px);
  gap: clamp(28px, 5vw, 70px);
  align-items: start;
}

.article-rail {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 16px;
}

.rail-block {
  padding: 18px;
}

.rail-block span,
.callout span,
.paper-source span {
  display: block;
  margin-bottom: 10px;
  color: var(--accent-3);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.article-content {
  display: grid;
  gap: 34px;
}

.article-content section {
  padding: 0;
}

.article-content h2 {
  margin-bottom: 14px;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.12;
}

.article-content p + p {
  margin-top: 14px;
}

.callout {
  padding: 18px 20px;
  border-color: rgba(255, 143, 184, 0.24);
  background: rgba(255, 143, 184, 0.055);
}

.paper-source {
  padding: 18px 20px;
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(167, 139, 250, 0.055);
}

.paper-source a {
  display: inline-flex;
  margin-top: 12px;
  color: var(--accent);
  font-weight: 700;
}

.attention-figure {
  position: relative;
  min-height: 250px;
  padding: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 14px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attention-figure figcaption {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 36px;
}

.attention-map {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.attention-map span {
  display: grid;
  place-items: center;
  min-height: 64px;
  color: var(--text);
  background: rgba(8, 9, 13, 0.72);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 8px;
  font-weight: 700;
}

.attention-lines {
  position: absolute;
  inset: 86px 32px 34px;
  z-index: 1;
}

.attention-lines i {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 143, 184, 0.72), transparent);
  transform-origin: left center;
}

.attention-lines i:nth-child(1) { width: 68%; top: 24%; left: 8%; transform: rotate(10deg); }
.attention-lines i:nth-child(2) { width: 62%; top: 56%; left: 15%; transform: rotate(-14deg); }
.attention-lines i:nth-child(3) { width: 44%; top: 36%; left: 28%; transform: rotate(24deg); }
.attention-lines i:nth-child(4) { width: 50%; top: 72%; left: 12%; transform: rotate(-28deg); }
.attention-lines i:nth-child(5) { width: 38%; top: 18%; left: 46%; transform: rotate(38deg); }

.article-footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 34px 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  opacity: 0.7;
}

.site-footer a {
  color: var(--accent-2);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

@media (max-width: 1024px) {
  :root { --section-pad: clamp(64px, 9vh, 100px) clamp(20px, 5vw, 56px); }

  .feature-grid,
  .post-grid,
  .topic-grid,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-rail {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.6fr);
  }
}

@media (max-width: 820px) {
  #nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .nav-logo { margin-right: auto; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 20px 18px;
    background: rgba(8, 9, 13, 0.97);
    border-bottom: 1px solid var(--line);
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 12px 0;
    font-size: 1rem;
  }

  #nav-toggle { display: flex; }

  .hero-screen {
    min-height: 82vh;
    padding-top: 122px;
  }

  .library-card {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .library-meta {
    justify-items: start;
    text-align: left;
  }

  .article-rail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  :root { --section-pad: 56px 16px; }

  #nav { padding: 15px 16px; }

  .hero-title {
    font-size: clamp(3rem, 16vw, 4.8rem);
  }

  .section-title,
  .route-header h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .article-header h1 {
    font-size: clamp(2.45rem, 13vw, 3.8rem);
  }

  .hero-actions,
  .link-row,
  .article-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-link,
  .text-link {
    width: 100%;
  }

  .featured-reading,
  .reading-principles,
  .post-card,
  .library-card,
  .topic-card,
  .rail-block,
  .callout,
  .paper-source,
  .attention-figure {
    padding: 22px 18px;
  }

  .post-card {
    min-height: auto;
  }

  .attention-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .attention-lines {
    inset: 90px 22px 24px;
  }
}

@media (hover: none) {
  .post-card:hover,
  .library-card:hover,
  .topic-card:hover,
  .primary-link:hover,
  .text-link:hover,
  .back-link:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.28); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(167, 139, 250, 0.5); }
