/* The front of the site (server/site.js): the home page, /read and the articles.
   Dark and still on the home page so the one gold button is the only thing to look at;
   warm paper for reading. Classes here are separate from site.css and the themes. */
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-italic.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/newsreader.woff2) format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap; src: url(/fonts/newsreader-italic.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/figtree.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --ink: #0f1020;
  --deep: #171935;
  --paper: #f6efe2;
  --paper-2: #efe5d2;
  --text: #1c1a17;
  --soft: rgba(28, 26, 23, .64);
  --glow: #e9c46a;
  --glow-2: #f4d58d;
  --on-dark: #f6efe2;
  --on-dark-soft: rgba(246, 239, 226, .66);
  --line-dark: rgba(246, 239, 226, .14);
  --line: rgba(28, 26, 23, .14);
  --disp: "Instrument Serif", "Newsreader", Georgia, serif;
  --serif: "Newsreader", Georgia, serif;
  --ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: max(22px, env(safe-area-inset-left, 0px));
  --pad-r: max(22px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100svh; overflow-x: clip;
  font-family: var(--ui); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--glow); outline-offset: 3px; border-radius: 6px; }

body.is-home { background: var(--ink); color: var(--on-dark); }
body.is-page { background: var(--paper); color: var(--text); color-scheme: light; }
body.menu-open { overflow: hidden; }

/* ---------- the bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top, 0px)) var(--pad-r) 14px var(--pad);
}
.is-home .bar { position: absolute; left: 0; right: 0; }
.is-page .bar { background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--disp); font-size: 22px; letter-spacing: .01em; position: relative; z-index: 41; }
.brand svg { width: 20px; height: 20px; fill: var(--glow); }
.is-page .brand svg { fill: #b4811a; }
.burger {
  position: relative; z-index: 41; display: inline-flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 4px; text-decoration: none;
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
.burger i, .burger i::before { display: block; width: 24px; height: 1.5px; background: currentColor; transition: transform .3s ease; }
.burger i { position: relative; }
.burger i::before { content: ""; position: absolute; top: 6px; }
.burger i::after { content: ""; position: absolute; top: -6px; width: 24px; height: 1.5px; background: currentColor; transition: transform .3s ease; }
body.menu-open .burger { color: var(--on-dark); }
body.menu-open .brand { color: var(--on-dark); }
body.menu-open .brand svg { fill: var(--glow); }
body.menu-open .burger i { background: transparent; }
body.menu-open .burger i::before { transform: translateY(-6px) rotate(-45deg); }
body.menu-open .burger i::after { transform: translateY(6px) rotate(45deg); }

/* ---------- the menu: dark, full screen ---------- */
.menu {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  background: radial-gradient(120% 80% at 80% 0%, #24265a 0%, var(--ink) 60%);
  color: var(--on-dark);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}
.menu[hidden] { display: block; }
body.menu-open .menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.menu-in { max-width: 760px; margin: 0 auto; padding: calc(96px + env(safe-area-inset-top, 0px)) var(--pad-r) 56px var(--pad); }
.menu-k { margin: 0 0 18px; font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--glow); }
.menu-list { list-style: none; margin: 0 0 40px; padding: 0; counter-reset: m; border-top: 1px solid var(--line-dark); }
.menu-list li { border-bottom: 1px solid var(--line-dark); counter-increment: m; }
.menu-list a {
  display: grid; grid-template-columns: 2.2em 1fr auto; align-items: baseline; gap: 4px 8px;
  padding: 16px 0; text-decoration: none; transition: color .2s ease, padding-left .25s ease;
}
.menu-list a::before { content: counter(m, decimal-leading-zero); font-size: 12px; letter-spacing: .1em; color: var(--on-dark-soft); }
.menu-t { font-family: var(--disp); font-size: clamp(22px, 4.6vw, 30px); line-height: 1.15; }
.menu-g { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-dark-soft); text-align: right; }
.menu-list a:hover, .menu-list a:focus-visible { color: var(--glow-2); padding-left: 8px; }
.menu-quiz {
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px;
  background: var(--glow); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px;
}
.menu-list li, .menu-quiz, .menu-k { opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
body.menu-open .menu-list li, body.menu-open .menu-quiz, body.menu-open .menu-k { opacity: 1; transform: none; }
body.menu-open .menu-list li:nth-child(1) { transition-delay: .06s; } body.menu-open .menu-list li:nth-child(2) { transition-delay: .09s; }
body.menu-open .menu-list li:nth-child(3) { transition-delay: .12s; } body.menu-open .menu-list li:nth-child(4) { transition-delay: .15s; }
body.menu-open .menu-list li:nth-child(5) { transition-delay: .18s; } body.menu-open .menu-list li:nth-child(6) { transition-delay: .21s; }
body.menu-open .menu-list li:nth-child(7) { transition-delay: .24s; } body.menu-open .menu-list li:nth-child(8) { transition-delay: .27s; }
body.menu-open .menu-quiz { transition-delay: .32s; }

main { flex: 1; display: flex; flex-direction: column; }
.blk { flex: 1; display: flex; flex-direction: column; }

/* ---------- home ---------- */
.is-home main::before, .is-home main::after {
  content: ""; position: fixed; pointer-events: none; border-radius: 50%; filter: blur(70px); opacity: .55; z-index: 0;
}
.is-home main::before { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: radial-gradient(circle, #3a3d9a 0%, transparent 65%); animation: drift 24s ease-in-out infinite alternate; }
.is-home main::after { width: 60vmax; height: 60vmax; right: -25vmax; bottom: -28vmax; background: radial-gradient(circle, #b4811a 0%, transparent 65%); opacity: .38; animation: drift 30s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

.hero {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 96px var(--pad-r) 72px var(--pad); min-height: 100svh;
}
.kicker { margin: 0 0 22px; font-size: 12px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--glow); }
.hero h1 {
  margin: 0 0 clamp(40px, 8vh, 72px); max-width: 13ch;
  font-family: var(--disp); font-weight: 400; font-size: clamp(52px, 12.5vw, 128px); line-height: .96; letter-spacing: -.015em;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; color: var(--glow-2); }

.go {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 16px;
  min-height: 76px; padding: 0 clamp(34px, 6vw, 56px); border-radius: 999px;
  background: linear-gradient(180deg, var(--glow-2), var(--glow)); color: var(--ink); text-decoration: none;
  font-size: clamp(19px, 3.4vw, 24px); font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 18px 50px -12px rgba(233, 196, 106, .55);
  transition: transform .25s ease, box-shadow .25s ease;
}
.go i { font-style: normal; font-size: 1.2em; transition: transform .25s ease; }
.go::after {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; border: 2px solid var(--glow); opacity: 0;
  animation: ring 3.2s ease-out 1.2s infinite; pointer-events: none;
}
@keyframes ring { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(1.22, 1.5); opacity: 0; } }
.go:hover { transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 24px 60px -10px rgba(233, 196, 106, .7); }
.go:hover i { transform: translateX(5px); }
.go:active { transform: translateY(0) scale(.98); }
.go.sm { min-height: 56px; font-size: 18px; padding: 0 30px; }
.go.sm::after { display: none; }

/* ---------- reading pages ---------- */
.page { width: 100%; max-width: 40rem; margin: 0 auto; padding: clamp(36px, 8vw, 80px) var(--pad-r) 72px var(--pad); }
.page .kicker { color: #8a6210; margin-bottom: 16px; }
.page h1 { margin: 0 0 24px; font-family: var(--disp); font-weight: 400; font-size: clamp(38px, 8vw, 62px); line-height: 1.04; letter-spacing: -.01em; text-wrap: balance; }


.card-g { font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #8a6210; }
.card-t { font-family: var(--disp); font-size: clamp(25px, 4.4vw, 32px); line-height: 1.12; }

.quizcard {
  margin: 56px 0 0; padding: 34px 28px; border-radius: 26px; text-align: center;
  background: radial-gradient(120% 140% at 80% 0%, #2c2f78 0%, var(--ink) 65%); color: var(--on-dark);
  display: grid; justify-items: center; gap: 22px;
}
.quizcard p { margin: 0; font-family: var(--disp); font-size: clamp(30px, 6vw, 42px); line-height: 1.05; }

/* the list of articles on /read (paper) */
.page.wide { max-width: 58rem; }
.page-h2 { margin: 64px 0 18px; font-family: var(--disp); font-weight: 400; font-size: clamp(30px, 5vw, 40px); }
.xgrid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.xgrid a {
  display: grid; grid-template-columns: 56px 1fr; gap: 2px 14px; align-items: center; height: 100%; padding: 16px;
  border-radius: 20px; text-decoration: none; background: var(--ink); color: var(--on-dark);
  transition: transform .2s ease, box-shadow .2s ease;
}
.xgrid a:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(15, 16, 32, .6); }
.xgrid i { grid-row: 1 / span 2; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: rgba(233, 196, 106, .16); color: var(--glow); }
.xgrid i svg { width: 30px; height: 30px; }
.xgrid .card-g { color: var(--glow); }
.xgrid .card-t { font-size: 24px; }

@media (max-width: 480px) {
  .menu-list a { grid-template-columns: 2em 1fr; }
  .menu-g { grid-column: 2; text-align: left; }
  .go { width: min(100%, 360px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}

/* the bar stays on top of the open menu, bare, so the same button closes it */
body.menu-open .bar { z-index: 50; background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
