/* avclub.us — liner notes on warm paper, one amber signal light. */

:root {
  --paper: #F3EEE3;
  --paper-2: #EAE3D4;
  --card: #F8F4EC;
  --ink: #161512;
  --ink-soft: #5A544B;
  --rule: #D6CCBA;
  --accent: #E0731A;      /* CRT amber: fills, dots, glow */
  --accent-ink: #A44A08;  /* amber dark enough for text on paper */
  --shadow: 0 1px 0 rgba(22, 21, 18, .05), 0 10px 24px -14px rgba(22, 21, 18, .28), 0 2px 6px -2px rgba(22, 21, 18, .08);
  --shadow-lift: 0 1px 0 rgba(22, 21, 18, .05), 0 22px 40px -18px rgba(22, 21, 18, .38), 0 4px 10px -4px rgba(22, 21, 18, .12);
  --grain-opacity: .07;

  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Figtree', 'Avenir Next', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --rail: 15.5rem;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --static-blend: multiply;
  color-scheme: light;
}

/* Dark: follows the system unless the toggle chose light; or forced by the toggle.
   (Same tokens twice because a media query and an attribute can't share one selector.) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #151412; --paper-2: #1C1A17; --card: #1E1C18;
    --ink: #EDE6D8; --ink-soft: #A69D8D; --rule: #34302A;
    --accent: #F08A2A; --accent-ink: #F6A456;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 28px -16px rgba(0, 0, 0, .8);
    --shadow-lift: 0 1px 0 rgba(255, 255, 255, .04), 0 24px 44px -18px rgba(0, 0, 0, .9);
    --grain-opacity: .09; --static-blend: screen;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #151412; --paper-2: #1C1A17; --card: #1E1C18;
  --ink: #EDE6D8; --ink-soft: #A69D8D; --rule: #34302A;
  --accent: #F08A2A; --accent-ink: #F6A456;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 28px -16px rgba(0, 0, 0, .8);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .04), 0 24px 44px -18px rgba(0, 0, 0, .9);
  --grain-opacity: .09; --static-blend: screen;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
/* Paper grain over everything (no image file, no inline styles). */
body::before {
  content: '';
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* A soft warm glow behind the hero, like a lamp on a record sleeve. */
body::after {
  content: '';
  position: fixed; z-index: -1; pointer-events: none;
  width: 60vmax; height: 60vmax; right: -18vmax; top: -24vmax;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
code, kbd, .mono { font-family: var(--mono); font-size: .88em; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--ink); color: var(--paper); padding: .5rem .8rem; z-index: 200; border-radius: 6px; }
.skip:focus { left: .5rem; }

.mono-label {
  font: 500 .72rem/1.3 var(--mono);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0;
}
.mono-label a { color: inherit; }

/* ---------- frame: slim sticky rail + main ---------- */
.frame { display: grid; grid-template-columns: 1fr; }
.rail {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font: 600 1.05rem/1 var(--display); font-variation-settings: 'opsz' 30, 'SOFT' 50; }
.brand:hover { color: var(--ink); }
.brand-knob {
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: conic-gradient(from 210deg, var(--ink) 0 12%, var(--ink-soft) 12% 13%, var(--ink) 13%);
  box-shadow: inset 0 0 0 2px var(--paper-2), 0 0 0 1px var(--ink);
  position: relative; transition: transform .5s var(--ease);
}
.brand-knob::after { content: ''; position: absolute; width: 3px; height: 7px; left: calc(50% - 1.5px); top: 3px; background: var(--accent); border-radius: 2px; }
.brand:hover .brand-knob { transform: rotate(60deg); }
.nav { display: flex; gap: .2rem 1rem; flex-wrap: wrap; margin-left: auto; font-weight: 500; font-size: .95rem; }
.nav a { text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.nav a[aria-current='page'] { border-bottom-color: var(--accent); }
.rail-latest, .rail-rss { display: none; }
.rail-foot { display: flex; align-items: center; gap: .9rem; }

/* Lights on / lights off switch */
.theme-toggle {
  display: inline-flex; align-items: center; gap: .55rem;
  background: none; border: 0; padding: .3rem 0; cursor: pointer; color: var(--ink);
  min-height: 2.5rem;
}
.theme-toggle[hidden] { display: none; }
.tt-track {
  position: relative; width: 2.6rem; height: 1.45rem; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--rule);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .18);
  transition: background .3s, border-color .3s;
}
.tt-knob {
  position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--ink-soft);
  transition: transform .35s var(--ease), background .3s, box-shadow .3s;
}
.theme-toggle[aria-pressed='true'] .tt-knob {
  transform: translateX(1.15rem); background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.theme-toggle[aria-pressed='true'] .tt-track { border-color: color-mix(in srgb, var(--accent) 50%, var(--rule)); }
.theme-toggle:hover .tt-track { border-color: var(--accent); }
.tt-label { white-space: nowrap; }
@media (max-width: 599px) { .tt-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

.main { padding: 0 var(--gutter) 3rem; min-width: 0; max-width: 72rem; }

@media (min-width: 1000px) {
  .frame { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .rail {
    height: 100vh; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 2rem;
    padding: 2rem 1.5rem; border-bottom: 0; border-right: 1px solid var(--rule);
    background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .nav { flex-direction: column; margin-left: 0; gap: .15rem; font-size: 1rem; }
  .nav a { padding: .35rem 0 .35rem .9rem; border-bottom: 0; border-left: 2px solid transparent; }
  .nav a[aria-current='page'] { border-left-color: var(--accent); }
  .rail-latest { display: block; }
  .rail-latest ol { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .8rem; }
  .rail-latest a { display: grid; gap: .1rem; text-decoration: none; font-size: .9rem; line-height: 1.35; }
  .rail-date { font: .68rem/1 var(--mono); color: var(--ink-soft); letter-spacing: .08em; text-transform: uppercase; }
  .rail-foot { margin-top: auto; flex-direction: column; align-items: flex-start; gap: .6rem; }
  .rail-rss { display: block; text-decoration: none; }
  .main { padding: 0 clamp(2rem, 5vw, 5rem) 4rem; }
}

/* ---------- hero: big, off-center, breaks the column ---------- */
.hero { padding: clamp(3rem, 10vw, 7.5rem) 0 clamp(2rem, 5vw, 3.5rem); position: relative; }
.hero-kicker { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.2rem; }
.hero-title {
  margin: 0;
  font: 640 clamp(3.4rem, 13vw, 9.5rem)/.86 var(--display);
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'WONK' 1;
  letter-spacing: -.035em;
  margin-left: clamp(-.3rem, -1vw, 0rem);
  overflow-wrap: anywhere;
}
.hero-tagline {
  margin: 1.4rem 0 0 auto; max-width: 26rem;
  font: italic 400 clamp(1.15rem, 2.4vw, 1.45rem)/1.4 var(--display);
  font-variation-settings: 'opsz' 24;
  color: var(--ink-soft);
  padding-left: 1.2rem; border-left: 3px solid var(--accent);
}
@media (min-width: 700px) { .hero-tagline { margin-right: 8%; } }

/* About: liner-notes column with a vertical label */
.about { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1rem 0 4rem; }
@media (min-width: 760px) {
  .about { grid-template-columns: 3rem minmax(0, 38rem); gap: 1.5rem; }
  .about .section-label { writing-mode: vertical-rl; transform: rotate(180deg); justify-self: end; align-self: start; padding-top: .3rem; }
}
.about-body { font-size: 1.12rem; }
.about-body > p:first-child::first-letter {
  float: left; font: 600 3.7em/.8 var(--display); font-variation-settings: 'opsz' 144, 'WONK' 1;
  margin: .08em .1em 0 -.02em; color: var(--accent-ink);
}

.prose p { margin: 0 0 1em; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { font-family: var(--display); line-height: 1.15; margin: 1.6em 0 .5em; font-variation-settings: 'opsz' 48; }
.prose blockquote { margin: 1.2em 0; padding-left: 1rem; border-left: 3px solid var(--rule); color: var(--ink-soft); font-style: italic; }
.prose pre { background: var(--paper-2); padding: 1rem; border-radius: 10px; overflow-x: auto; }
.prose code { background: var(--paper-2); padding: .1em .35em; border-radius: 4px; }
.prose pre code { background: none; padding: 0; }

/* ---------- section heads ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.4rem; padding-bottom: .7rem; border-bottom: 1px solid var(--ink); }
.section-title { margin: 0; font: 600 clamp(1.6rem, 3.2vw, 2.2rem)/1.1 var(--display); font-variation-settings: 'opsz' 72, 'SOFT' 50; letter-spacing: -.01em; }
.more { font: 500 .8rem var(--mono); letter-spacing: .06em; text-decoration: none; color: var(--accent-ink); }
.featured, .updates-teaser { margin-bottom: 4rem; }

.page-head { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.page-title { margin: .4rem 0 0; font: 620 clamp(2.4rem, 7vw, 4.5rem)/.95 var(--display); font-variation-settings: 'opsz' 144, 'SOFT' 40; letter-spacing: -.025em; }
.page-sub { color: var(--ink-soft); margin: 1rem 0 0; max-width: 34rem; }
.empty { color: var(--ink-soft); font-style: italic; }

/* ---------- channel cards ---------- */
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; gap: .7rem;
  padding: 1.15rem 1.2rem 1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ch {
  font: 500 .74rem/1 var(--mono); letter-spacing: .12em;
  padding: .32rem .5rem; border-radius: 5px;
  background: var(--ink); color: var(--paper);
  transition: background .2s, color .2s, box-shadow .3s;
}
.status { display: inline-flex; align-items: center; gap: .4rem; font: .7rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ink-soft); }
.status-live .dot { background: #3E9B5A; box-shadow: 0 0 0 3px color-mix(in srgb, #3E9B5A 22%, transparent); }
.status-wip .dot { background: var(--accent); }
.status-retired .dot { background: transparent; border: 1.5px solid var(--ink-soft); }
.card-name { margin: .25rem 0 0; font: 600 1.55rem/1.1 var(--display); font-variation-settings: 'opsz' 60, 'SOFT' 60; letter-spacing: -.01em; }
.card-name a { text-decoration: none; }
.card-name a::after { content: ''; position: absolute; inset: 0; z-index: 1; } /* whole card is the link */
.card-tagline { margin: 0; font-weight: 500; }
.card-why { color: var(--ink-soft); font-size: .95rem; line-height: 1.55; }
.card-why a { position: relative; z-index: 2; }
.card-meta { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; margin-top: auto; padding-top: .3rem; }
.chip { font: 500 .7rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: .32rem .55rem; border: 1px solid var(--ink); border-radius: 999px; }
.tag { font: .74rem var(--mono); color: var(--ink-soft); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .8rem; border-top: 1px dashed var(--rule); }
.card-url { font: .78rem var(--mono); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.card-open {
  flex: none; display: inline-flex; align-items: center; gap: .4rem;
  font: 600 .95rem var(--body); text-decoration: none;
  padding: .55rem .95rem; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  transition: background .2s;
}
.card-open .i { transition: transform .3s var(--ease); }

/* The tuning static: hidden noise layer that flickers in, then clears, on hover. */
.static {
  position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; mix-blend-mode: var(--static-blend);
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
}

@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
  .card:hover .ch { background: var(--accent); color: #1a0d02; box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }
  .card:hover .card-open { background: var(--accent-ink); }
  .card:hover .card-open .i { transform: translate(2px, -2px); }
  .card:hover .static { animation: tune .55s steps(6) both; }
  .card:hover .card-name, .card:hover .card-tagline { animation: lock-in .55s var(--ease) both; }
}
.card:focus-within { border-color: var(--accent); }

@keyframes tune {
  0%   { opacity: .75; background-position: 0 0, 0 0; }
  30%  { opacity: .5;  background-position: 0 -6px, -40px 20px; }
  60%  { opacity: .28; background-position: 0 -12px, 30px -10px; }
  100% { opacity: 0;   background-position: 0 -18px, -10px 40px; }
}
@keyframes lock-in {
  0%   { transform: translateX(-4px) skewX(-6deg); filter: blur(1.2px); }
  40%  { transform: translateX(3px) skewX(3deg); }
  100% { transform: none; filter: none; }
}

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.75rem; }
.filter { font: 500 .78rem/1 var(--mono); letter-spacing: .05em; text-decoration: none; padding: .5rem .8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--card); }
.filter.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- posts ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item a { display: grid; gap: .3rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
@media (min-width: 760px) {
  .post-item a { grid-template-columns: 9rem minmax(0, 1fr); column-gap: 1.5rem; }
  .post-item time { grid-row: span 2; padding-top: .45rem; }
}
.post-title { font: 600 1.4rem/1.2 var(--display); font-variation-settings: 'opsz' 48; }
.post-item a:hover .post-title { color: var(--accent-ink); }
.post-excerpt { color: var(--ink-soft); font-size: .95rem; }
.post { max-width: 40rem; }
.post-body { font-size: 1.1rem; }
.post-project { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); display: flex; gap: 1rem; align-items: baseline; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: .9rem; }

.foot-login { color: var(--ink-soft); text-decoration-color: var(--rule); }

/* ---------- one orchestrated page-load reveal ---------- */
/* ---------- icons (inline Lucide SVGs, see src/views/icons.js) ---------- */
.i { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.125em; stroke-width: 2; }
.nav .i, .more .i, .rail-rss .i, .foot .i, .post-project .i { width: .95em; height: .95em; }
.nav .i-arrow-up-right { color: var(--ink-soft); }
.more { display: inline-flex; align-items: center; gap: .35rem; }
.more .i { transition: transform .25s var(--ease); }
.more:hover .i { transform: translateX(3px); }
.nav a:hover .i-arrow-up-right, .post-project a:hover .i { transform: translate(2px, -2px); }
.nav .i, .post-project a .i { transition: transform .25s var(--ease); }
.rail-rss .i, .foot .i-rss { color: var(--accent-ink); margin-right: .15rem; }
.post-project .mono-label { display: inline-flex; align-items: center; gap: .4rem; }
.post-project .mono-label .i { color: var(--accent); width: 1.15em; height: 1.15em; }

@media (prefers-reduced-motion: no-preference) {
  .hero-kicker, .hero-title, .hero-tagline, .about, .featured, .updates-teaser, .page-head, .filters, .cards > .card, .post-list > li, .post-body {
    animation: rise .8s var(--ease) both;
  }
  .hero-title { animation-delay: .08s; }
  .hero-tagline { animation-delay: .2s; }
  .about { animation-delay: .3s; }
  .featured { animation-delay: .4s; }
  .updates-teaser { animation-delay: .5s; }
  .filters { animation-delay: .1s; }
  .cards > .card:nth-child(2), .post-list > li:nth-child(2) { animation-delay: .07s; }
  .cards > .card:nth-child(3), .post-list > li:nth-child(3) { animation-delay: .14s; }
  .cards > .card:nth-child(4), .post-list > li:nth-child(4) { animation-delay: .21s; }
  .cards > .card:nth-child(5), .post-list > li:nth-child(5) { animation-delay: .28s; }
  .cards > .card:nth-child(n+6), .post-list > li:nth-child(n+6) { animation-delay: .35s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
