:root {
  color-scheme: dark;
  --bg: #15141c;
  --ink: #f2f0f7;
  --muted: #9a97ad;
  --accent: #a9a3ff;
  --line: #2a2938;
  --panel: #1d1c26;

  /* card tones, same in both modes, always with dark ink on top */
  --butter: #f7e3a1;
  --sky: #bfd7f2;
  --mint: #c7e8d5;
  --blush: #f5c9c9;
  --lilac: #dccdf2;
  --peach: #f8d3b5;

  --wrap: 70rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body:has(dialog[open]) { overflow: hidden; }

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--panel); padding: 0.4rem 0.7rem; border-radius: 8px;
}
.skip:focus { top: 1rem; z-index: 10; }

h1, h2, .card__title, .reader__title {
  font-family: "Fraunces", Georgia, serif;
  font-variation-settings: "SOFT" 100, "opsz" 72;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* nav */

.nav {
  max-width: var(--wrap); margin: 0 auto;
  padding: 1.5rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.nav__name { font-family: "Fraunces", Georgia, serif; font-variation-settings: "SOFT" 100; font-weight: 600; font-size: 1.25rem; }
.nav__links { display: flex; gap: clamp(1rem, 3vw, 1.75rem); font-size: 0.9375rem; color: var(--muted); }
.nav__links a { transition: color 150ms ease; }
.nav__links a:hover { color: var(--ink); }

/* hero */

.hero {
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(2rem, 8vh, 5rem) var(--gutter) clamp(4rem, 10vh, 7rem);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.hero__title {
  margin: 0 0 1rem;
  font-size: clamp(2.75rem, 6vw, 4.75rem);
  line-height: 1;
}

.hero__line {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  line-height: 1.35;
  max-width: 30ch;
}

.hero__cycle {
  display: inline-grid;
  vertical-align: bottom;
  color: var(--accent);
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-variation-settings: "SOFT" 100;
  font-weight: 500;
}
.hero__word { grid-area: 1 / 1; white-space: nowrap; }
.hero__word.is-entering { animation: word-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.hero__word.is-leaving { animation: word-out 420ms cubic-bezier(0.4, 0, 0.6, 1) both; }
@keyframes word-in { from { opacity: 0; transform: translateY(0.6em) rotate(3deg); } to { opacity: 1; transform: none; } }
@keyframes word-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-0.6em) rotate(-3deg); } }

.hero__sub { margin: 0 0 2rem; color: var(--muted); max-width: 44ch; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-flex; align-items: center;
  padding: 0.75rem 1.3rem; border-radius: 999px;
  background: var(--accent); color: #15141c;
  font-weight: 500; font-size: 0.9375rem;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease;
}
.button:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 10px 24px -12px var(--accent); }
.button:active { transform: translateY(0) scale(0.98); }
.button--quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.button--quiet:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

/* hero stack of the latest three */

.hero__stack {
  position: relative;
  height: clamp(18rem, 32vw, 24rem);
  display: grid;
  place-items: center;
}
.hero__stack .card {
  position: absolute;
  width: min(17rem, 70%);
  min-height: 0;
  --spread: 0.45;
  --fan: rotate(calc(var(--tilt) * 1.5 + var(--spread) * (var(--i) - 1) * 9deg))
         translate(calc(var(--spread) * (var(--i) - 1) * 5rem), calc(var(--spread) * (var(--i) - 1) * 1rem));
  transform: var(--fan);
  transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 300ms ease;
}
.hero__stack:hover .card,
.hero__stack:focus-within .card { --spread: 1; }
.hero__stack .card:hover,
.hero__stack .card:focus-visible { transform: var(--fan) translateY(-10px); z-index: 3; }
.hero__stack .card__teaser { display: none; }

/* thoughts */

.thoughts { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter) clamp(4rem, 10vh, 7rem); }

.thoughts__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  margin-bottom: 2.5rem;
}
.thoughts__title { margin: 0 0 0.5rem; font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1; }
.thoughts__lede { margin: 0; color: var(--muted); max-width: 52ch; }

.shuffle {
  flex: none;
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-size: 0.9375rem; font-weight: 500;
  padding: 0.65rem 1.1rem; border-radius: 999px;
  background: var(--panel); color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease;
}
.shuffle:hover { transform: rotate(-2deg) translateY(-1px); box-shadow: inset 0 0 0 1.5px var(--ink); }
.shuffle:active { transform: rotate(2deg) scale(0.97); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
  padding: 0.5rem;
}

/* the card */

.card {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left;
  display: flex; flex-direction: column; gap: 0.5rem;
  padding: 1.5rem 1.5rem 1.35rem;
  border-radius: var(--radius);
  min-height: 15rem;
  transform: rotate(var(--tilt));
  box-shadow: 0 1px 0 rgba(27, 26, 46, 0.06), 0 12px 28px -18px rgba(27, 26, 46, 0.35);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 320ms ease;
}
.card:hover, .card:focus-visible {
  transform: rotate(0deg) translateY(-8px);
  box-shadow: 0 1px 0 rgba(27, 26, 46, 0.06), 0 26px 44px -22px rgba(27, 26, 46, 0.45);
}
.card:active { transform: rotate(0deg) translateY(-4px) scale(0.99); }

.card--butter { background: var(--butter); }
.card--sky    { background: var(--sky); }
.card--mint   { background: var(--mint); }
.card--blush  { background: var(--blush); }
.card--lilac  { background: var(--lilac); }
.card--peach  { background: var(--peach); }
.card, .reader__panel[class*="card--"] { color: #1b1a2e; }

.card__date { font-size: 0.8125rem; opacity: 0.6; }
.card__title { font-size: 1.4375rem; line-height: 1.15; margin: 0.15rem 0 0.25rem; }
.card__teaser {
  font-size: 0.9375rem; line-height: 1.5; opacity: 0.78;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__open {
  margin-top: auto; padding-top: 0.75rem;
  font-size: 0.875rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.card__open::after {
  content: ""; width: 0.4em; height: 0.4em;
  border-right: 2px solid currentColor; border-top: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 220ms ease;
}
.card:hover .card__open::after { transform: rotate(45deg) translate(2px, -2px); }

/* reader dialog */

.reader {
  border: 0; padding: 0; background: transparent;
  max-width: none; max-height: none; width: 100%; height: 100%;
  display: grid; place-items: center;
  margin: 0; inset: 0;
}
.reader:not([open]) { display: none; }
.reader::backdrop {
  background: rgba(27, 26, 46, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 300ms ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.reader__panel {
  position: relative;
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(84vh, 46rem);
  display: flex; flex-direction: column;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: var(--radius);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.5);
  transform-origin: center;
}

.reader__close {
  position: absolute; top: 1rem; right: 1rem;
  width: 2.5rem; height: 2.5rem; border-radius: 999px;
  border: 0; cursor: pointer;
  background: rgba(27, 26, 46, 0.08); color: inherit;
  font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), background 200ms ease;
}
.reader__close:hover { transform: rotate(90deg); background: rgba(27, 26, 46, 0.14); }

.reader__date { margin: 0 0 0.35rem; font-size: 0.875rem; opacity: 0.65; }
.reader__title { margin: 0 0 1.25rem; font-size: clamp(1.75rem, 3.5vw, 2.5rem); line-height: 1.1; padding-right: 3rem; }
.reader__body { overflow: auto; padding-right: 0.25rem; max-width: 36rem; font-size: 1.0625rem; }
.reader__body p { margin: 0 0 1em; }
.reader__body p:last-child { margin-bottom: 0; }

.reader__nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1.5px solid rgba(27, 26, 46, 0.12);
  font-size: 0.9375rem;
}
.reader__count { opacity: 0.6; font-size: 0.875rem; }
.reader__step {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.9375rem;
  padding: 0.5rem 0.9rem; border-radius: 999px;
  background: rgba(27, 26, 46, 0.08); color: inherit;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), background 180ms ease;
}
.reader__step:hover:not(:disabled) { background: rgba(27, 26, 46, 0.14); transform: translateY(-1px); }
.reader__step:disabled { opacity: 0.35; cursor: default; }

/* footer */

.foot {
  max-width: var(--wrap); margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1.5px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem;
  color: var(--muted); font-size: 0.9375rem;
}
.foot p { margin: 0; }
.foot__links { display: flex; gap: 1.5rem; }
.foot__links a:hover { color: var(--ink); }

code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; }

/* page load: hero settles in, stack fans in */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero__text > * { animation: rise 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  .hero__text > :nth-child(2) { animation-delay: 80ms; }
  .hero__text > :nth-child(3) { animation-delay: 160ms; }
  .hero__text > :nth-child(4) { animation-delay: 240ms; }
  .hero__stack .card { animation: deal 800ms cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(200ms + var(--i) * 90ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes deal { from { opacity: 0; translate: 0 40px; } to { opacity: 1; translate: 0 0; } }
}
@media (prefers-reduced-motion: reduce) {
  .card, .button, .shuffle, .reader__close, .reader__step { transition: none; }
  .hero__word.is-entering, .hero__word.is-leaving { animation: none; }
}

/* responsive */

@media (max-width: 64rem) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 46rem) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; padding-top: 2rem; }
  .hero__stack { height: 15rem; }
  .hero__stack .card { width: min(15rem, 75%); }
  .thoughts__head { flex-direction: column; align-items: flex-start; gap: 1.25rem; margin-bottom: 2rem; }
  .cards { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .card { min-height: 0; }
  .nav__links { gap: 1rem; font-size: 0.875rem; }
  .reader__panel { max-height: 90vh; }
}
