:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #68645f;
  --faint: #9a958d;
  --line: #e8e3db;
  --line-strong: #d8d1c7;
  --accent: #111111;
  --header-bg: rgba(251, 250, 247, 0.86);
  --nav-active: #f0ece5;
  --image-bg: #f3efe7;
  --max: 1080px;
  --narrow: 760px;
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #11100f;
    --surface: #1a1816;
    --ink: #f4efe8;
    --muted: #c2b9ad;
    --faint: #8d8378;
    --line: #302b26;
    --line-strong: #494038;
    --accent: #f4efe8;
    --header-bg: rgba(17, 16, 15, 0.86);
    --nav-active: #26221e;
    --image-bg: #211d19;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11100f;
  --surface: #1a1816;
  --ink: #f4efe8;
  --muted: #c2b9ad;
  --faint: #8d8378;
  --line: #302b26;
  --line-strong: #494038;
  --accent: #f4efe8;
  --header-bg: rgba(17, 16, 15, 0.86);
  --nav-active: #26221e;
  --image-bg: #211d19;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: var(--bg);
  background: var(--ink);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav {
  max-width: var(--max);
  min-height: 72px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-links a {
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--ink);
  background: var(--nav-active);
  outline: none;
}

.theme-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--nav-active);
  outline: none;
}

.theme-toggle-icon {
  width: 1em;
  display: inline-flex;
  justify-content: center;
  line-height: 1;
}

.page-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 88px 24px 120px;
}

.page-shell.narrow { max-width: var(--narrow); }

.hero,
.page-intro,
.post-header {
  max-width: 820px;
  padding-bottom: 72px;
}

.eyebrow,
.note-meta,
.post-info {
  color: var(--faint);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.eyebrow { margin: 0 0 18px; }

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 24px;
  max-width: 860px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.98;
  letter-spacing: -0.065em;
  text-wrap: balance;
}

.post-header h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 14px;
  font-size: clamp(26px, 3.2vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.52;
  text-wrap: pretty;
}

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

.section-head,
.site-footer,
.post-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-head { margin-bottom: 24px; }
.section-head h2 { margin-bottom: 0; }

.text-link {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

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

.feature-note,
.post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.post-row + .post-row { margin-top: 18px; }

.feature-note p:last-child,
.gallery-card p:last-child,
.post-row p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover,
.button:focus-visible {
  color: var(--ink);
  background: transparent;
  outline: none;
}

.two-column {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 56px;
}

.rule-list { border-top: 1px solid var(--line); }

.rule-list div {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.rule-list span {
  color: var(--faint);
  font-size: 14px;
  font-weight: 600;
}

.rule-list p { margin-bottom: 0; color: var(--muted); }

.post-body section,
.post-body h2 {
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.post-body h2 {
  margin-top: 34px;
  margin-bottom: 14px;
  font-size: 26px;
}

.post-body h2:first-child {
  margin-top: 0;
}

.post-body p,
.post-body li {
  color: var(--muted);
  font-size: 18px;
}

.post-body ul {
  margin: 0;
  padding-left: 1.2em;
}

.post-body li + li { margin-top: 10px; }

.post-body a { color: var(--ink); }

.post-info {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 30px;
}

.post-info span + span::before {
  content: "";
  width: 4px;
  height: 4px;
  display: inline-block;
  margin: 0 12px 3px 0;
  border-radius: 50%;
  background: var(--line-strong);
}

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

.gallery-card {
  min-height: 260px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.gallery-card h2 {
  max-width: 420px;
  margin-top: auto;
}

.gallery-card h2 a,
.post-row h2 a {
  text-decoration: none;
}

.gallery-card h2 a:hover,
.post-row h2 a:hover {
  text-decoration: underline;
}

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

.data-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-card-image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--image-bg);
}

.data-card-image img,
.dataset-hero-image {
  width: 100%;
  display: block;
}

.data-card-image img {
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.data-card:hover .data-card-image img {
  transform: scale(1.025);
}

.data-card-body {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.data-card h2 {
  margin-bottom: 14px;
  font-size: clamp(23px, 2.4vw, 32px);
}

.data-card h2 a {
  text-decoration: none;
}

.data-card h2 a:hover {
  text-decoration: underline;
}

.data-card p {
  color: var(--muted);
}

.dataset-facts {
  font-size: 15px;
  line-height: 1.55;
}

.data-card-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 18px;
}

.dataset-hero-image {
  margin-bottom: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 52px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 14px;
}

.site-footer p { margin: 0; }
.site-footer p:first-child { color: var(--ink); font-weight: 700; }

.visitor-count {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}

.visitor-count span + span::before {
  content: "";
  width: 3px;
  height: 3px;
  display: inline-block;
  margin: 0 12px 3px 0;
  border-radius: 50%;
  background: var(--line-strong);
}

.visitor-count strong {
  color: var(--muted);
  font-weight: 600;
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .nav {
    min-height: auto;
    padding: 13px 18px 12px;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .nav-links {
    order: 3;
    width: 100%;
    gap: 2px;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar { display: none; }

  .nav-links a {
    min-height: 38px;
    padding: 8px 11px;
    white-space: nowrap;
  }

  .theme-toggle {
    min-height: 38px;
    padding-inline: 11px;
    gap: 7px;
  }

  .page-shell { padding: 52px 18px 88px; }
  .hero, .page-intro, .post-header { padding-bottom: 54px; }

  h1 { font-size: clamp(42px, 13vw, 64px); }
  .post-header h1 { font-size: clamp(34px, 10vw, 50px); }

  .section-head,
  .feature-note,
  .post-row,
  .two-column,
  .site-footer {
    display: block;
  }

  .feature-note,
  .post-row { padding: 24px; }
  .feature-note .button { margin-top: 24px; }
  .post-row .text-link { display: inline-block; margin-top: 18px; }
  .gallery-grid,
  .data-grid { grid-template-columns: 1fr; }
  .site-footer p + p { margin-top: 8px; }
  .visitor-count {
    justify-content: flex-start;
    margin-top: 10px;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
