/* GB index — typography-first, light/dark, no frameworks */

:root {
  color-scheme: light;
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --bg: #f3efe6;
  --bg-deep: #ebe4d6;
  --surface: rgba(255, 251, 244, 0.72);
  --surface-solid: #fffbf4;
  --ink: #1a1714;
  --muted: #5c564e;
  --faint: #8a8378;
  --line: rgba(26, 23, 20, 0.12);
  --line-strong: rgba(26, 23, 20, 0.22);
  --accent: #1d5c4a;
  --accent-hover: #154538;
  --accent-soft: #d7e6e0;
  --accent-ink: #1d5c4a;
  --gold: #8b5e2b;
  --shadow: 0 1px 2px rgba(26, 23, 20, 0.04), 0 16px 40px rgba(26, 23, 20, 0.06);
  --header-bg: rgba(243, 239, 230, 0.72);
  --orb-a: rgba(29, 92, 74, 0.16);
  --orb-b: rgba(196, 140, 72, 0.18);
  --radius: 22px;
  --header-h: 4.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --theme-color: #f3efe6;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10110f;
  --bg-deep: #0b0c0a;
  --surface: rgba(26, 27, 24, 0.72);
  --surface-solid: #1a1b18;
  --ink: #f3eee6;
  --muted: #b4ada2;
  --faint: #8d877d;
  --line: rgba(243, 238, 230, 0.12);
  --line-strong: rgba(243, 238, 230, 0.22);
  --accent: #8fcdb0;
  --accent-hover: #b6e3cc;
  --accent-soft: #1c2d26;
  --accent-ink: #8fcdb0;
  --gold: #e0b266;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.24), 0 18px 48px rgba(0, 0, 0, 0.28);
  --header-bg: rgba(16, 17, 15, 0.72);
  --orb-a: rgba(143, 205, 176, 0.14);
  --orb-b: rgba(224, 178, 102, 0.1);
  --theme-color: #10110f;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; }

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

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

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

.skip {
  position: absolute;
  left: 1rem;
  top: 0;
  z-index: 20;
  transform: translateY(-140%);
  padding: 0.6rem 0.9rem;
  background: var(--surface-solid);
  color: var(--ink);
  border-radius: 0 0 10px 10px;
  font-weight: 500;
  text-decoration: none;
}
.skip:focus { transform: translateY(0); }

/* Atmosphere */
.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}
.orb-a {
  width: 52vw;
  height: 52vw;
  max-width: 640px;
  max-height: 640px;
  top: -12%;
  right: -10%;
  background: var(--orb-a);
  animation: drift-a 28s var(--ease) infinite alternate;
}
.orb-b {
  width: 46vw;
  height: 46vw;
  max-width: 560px;
  max-height: 560px;
  left: -14%;
  bottom: 4%;
  background: var(--orb-b);
  animation: drift-b 34s var(--ease) infinite alternate;
}
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
}
html[data-theme="dark"] .grain {
  opacity: 0.12;
  mix-blend-mode: overlay;
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-6%, 8%) scale(1.08); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(10%, -6%) scale(1.05); }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.03em;
}
.wordmark:hover { color: var(--ink); }
.wm-mark {
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-weight: 560;
  font-size: 1.55rem;
  font-style: italic;
  line-height: 1;
}
.wm-rest {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.92rem;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 0.05em;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.site-count {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.theme-toggle {
  appearance: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-solid);
}
.theme-toggle:active { transform: scale(0.96); }
.theme-icon svg { width: 1.15rem; height: 1.15rem; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

/* Hero */
.hero,
.catalog,
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.hero {
  padding-top: clamp(2.5rem, 7vw, 5.25rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  /* stretch lede but keep type measure; align with grid */
  max-width: 1120px;
}
.kicker {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.4rem, 6.2vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.lede {
  margin: 1.35rem 0 0;
  max-width: 36rem;
  font-size: 1.15rem;
  font-weight: 350;
  color: var(--muted);
}

/* Toolbar */
.toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.toolbar-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}
.search-wrap {
  position: relative;
  min-width: 0;
}
.search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}
#site-search {
  width: 100%;
  height: 3rem;
  padding: 0 2.6rem 0 2.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
#site-search::placeholder { color: var(--faint); }
#site-search:hover { border-color: var(--line-strong); }
#site-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  background: var(--surface-solid);
}
.search-hint {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12rem 0.38rem;
  line-height: 1.2;
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}
.sort-wrap label {
  font-size: 0.85rem;
  color: var(--muted);
}
#site-sort {
  appearance: none;
  height: 3rem;
  padding: 0 2.2rem 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8378' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.8rem center;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
#site-sort:hover { border-color: var(--line-strong); }
#site-sort:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.filters { display: grid; gap: 0.45rem; }
.filters-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.filter-pills button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.filter-pills button:hover { border-color: var(--line-strong); }
.filter-pills button[aria-pressed="true"] {
  background: var(--accent);
  border-color: transparent;
  color: var(--bg);
}
html[data-theme="dark"] .filter-pills button[aria-pressed="true"] {
  color: #10110f;
}

.results-meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.3em;
}

/* Grid / cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 1.1rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 100%;
  padding: 1.3rem 1.3rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: inherit;
  text-decoration: none;
  transition: transform 0.45s var(--ease), border-color 0.3s var(--ease), box-shadow 0.45s var(--ease);
  animation: rise 0.7s var(--ease) both;
}
a.card:hover,
a.card:focus-visible {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 1px 2px rgba(26, 23, 20, 0.04), 0 22px 50px rgba(26, 23, 20, 0.1);
  color: inherit;
}
.card.is-soon {
  cursor: default;
  opacity: 0.92;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card-tags li {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line));
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
}
.card h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-weight: 550;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.card p {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: 0.98rem;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--faint);
}
.card time { font-variant-numeric: tabular-nums; }
.card-go {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 500;
  color: var(--accent-ink);
  transition: gap 0.3s var(--ease);
}
a.card:hover .card-go { gap: 0.45rem; }
.card-go svg { width: 1rem; height: 1rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty, .error {
  margin: 2rem 0 4rem;
  padding: 1.4rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}
.error code, .foot-note code, .error code {
  font-size: 0.9em;
}

/* Footer */
.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}
.site-footer p { margin: 0; }
.site-footer .wm-mark {
  font-size: 1.05rem;
  color: var(--ink);
  margin-right: 0.15rem;
}
.foot-note { max-width: 36rem; }

@media (max-width: 720px) {
  .header-inner, .hero, .catalog, .footer-inner { padding-left: 1.15rem; padding-right: 1.15rem; }
  .toolbar-top { grid-template-columns: 1fr; }
  #site-sort, .sort-wrap { width: 100%; }
  #site-sort { flex: 1; }
  .search-hint { display: none; }
  .site-count { display: none; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  a.card:hover, a.card:focus-visible { transform: none; }
}
