/* ==========================================================================
   GIRL BEER — base
   Components only. Every value comes from css/brand.css — if you find
   yourself typing a colour, radius or font here, add a token instead.
   Palette, type, paper, textures, and the reusable bits (buttons,
   placeholders, tape, doodles, stickers).
   ========================================================================== */


/* --------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;      /* turned off under reduced-motion, below */
}
/* anything jumped to by an anchor keeps a little air above it */
:target, #main { scroll-margin-top: 2rem; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--mono);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--wine); color: var(--paper); }

/* ------------------------------------------------------- paper texture -- */
/* subtle grain over everything so the cream reads as paper, not as #F4EEE3 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain-opacity);
  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='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.16 0 0 0 0 0.15 0 0 0 0 0.11 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ---------------------------------------------------------------- type -- */
.display {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-style: var(--display-style);   /* Bold Italic. Only ever this. */
  letter-spacing: var(--ls-display);
  line-height: var(--lh-display);
}
.mono-label {
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  line-height: 1.5;
}
/* distressed print: eats speckles out of the ink, like a worn letterpress.
   Largest headline + a few graphic shapes only. Never body text. */
.distressed {
  -webkit-mask-image:
    linear-gradient(#000, #000),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='0 0 0 0 0 0 0 1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23s)'/%3E%3C/svg%3E");
  mask-image:
    linear-gradient(#000, #000),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='0 0 0 0 0 0 0 1 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23s)'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%, 260px 260px;
  mask-size: 100% 100%, 260px 260px;
  -webkit-mask-repeat: no-repeat, repeat;
  mask-repeat: no-repeat, repeat;
  -webkit-mask-composite: source-out;
  mask-composite: subtract;
}

/* ------------------------------------------------------------ halftone -- */
.halftone {
  background-image: radial-gradient(var(--gold) var(--halftone-dot), transparent calc(var(--halftone-dot) + 0.2px));
  background-size: var(--halftone-gap) var(--halftone-gap);
}
/* a whisper of halftone, for fills that sit under body text */
.halftone--soft {
  background-image: radial-gradient(color-mix(in srgb, var(--gold) 55%, transparent) 1px, transparent 1.2px);
  background-size: 9px 9px;
}
/* Fade a halftone field off into nothing. The ramp has to reach zero by the
   edge of the box — stopping at 92% leaves a faint rim, which reads as a
   grey rectangle sitting on the paper rather than as a wash. */
.halftone--fade {
  -webkit-mask-image: radial-gradient(closest-side, #000 14%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 14%, transparent 100%);
}

/* ------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  border: var(--rule) solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--color-text);
  padding: .62em 1.3em;
  font-family: var(--mono);
  font-size: var(--fs-button);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--speed-hover) linear, color var(--speed-hover) linear;
}
/* The filled state is WINE, not pink. Cream on pink is 3.46:1 and ink on
   pink is 3.79:1 — at this size both are under the 4.5:1 a label needs, so
   pink carries no small text anywhere on the site. On wine, cream is
   8.81:1. It is also the rule BRAND.md already stated: pink is the accent,
   never a ground. */
.btn:hover,
.btn:focus-visible,
.btn--pink:hover,
.btn--pink:focus-visible {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--color-on-dark);
}

/* on an ink ground the outline and label flip to cream */
.btn--on-ink {
  background: transparent;
  border-color: var(--color-on-dark);
  color: var(--color-on-dark);
}
/* On an ink ground a wine fill would lose its shape (1.49:1 against the
   ground), so the outline fills with cream and the label flips to ink. */
.btn--on-ink:hover,
.btn--on-ink:focus-visible {
  background: var(--color-on-dark);
  border-color: var(--color-on-dark);
  color: var(--ink);
}

/* A grid sized to its content, with equal auto columns: every button comes
   out the width of the longest label rather than each one shrink-wrapping its
   own text. Three buttons of three different widths is a tell -- it is what
   you get when nobody decided, and the eye reads it as a form rather than as
   a set of choices. */
.listen-row {
  /* grid, not inline-grid: the strip above it is an inline-block, so an
     inline-level row sat on the same line as the text instead of under it.
     width:max-content keeps it shrink-wrapped to the buttons. */
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .6rem;
  align-items: center;
  width: max-content;
  max-width: 100%;
}
/* These three are the point of the hero, so unlike every other button on the
   site they arrive already filled rather than as an outline waiting to be
   hovered. Wine, because pink can carry no label at this size (3.46:1) and
   ink would put three heavy black bars under the headline. Cream on wine is
   8.81:1.

   Pressed, they go to the lighter paper tint with an ink label — the same
   inversion .btn--on-ink uses, and on the warm cream ground it reads as
   white. :active covers the tap; :hover is here too because iOS holds the
   hover state on a tapped link, so without it the press would flash and
   vanish. */
.listen-row .btn {
  background: var(--wine);
  border-color: var(--wine);
  color: var(--color-on-dark);
  justify-content: center;
}
.listen-row .btn:hover,
.listen-row .btn:focus-visible,
.listen-row .btn:active {
  background: var(--paper-lit);
  border-color: var(--color-line);
  color: var(--color-text);
}

/* On a phone the row stacks. Left at their natural widths the buttons make a
   ragged staircase, so they match each other — but capped at the width of the
   longest label rather than run to the screen edges, where a 24-character
   label in a full-bleed pill reads as a stretched lozenge. */
/* Measured, not guessed: three buttons at the width of "Apple Podcasts" plus
   two gaps come to 512px, which a 600px viewport clears with 40px to spare.
   (It was 800px when the labels still read "Listen on Apple Podcasts" and the
   row needed 785px -- change the labels and this number has to be measured
   again.)

   The stack is max-content wide -- the longest label's own width -- rather
   than a round number. It was capped at 18rem, which left 251px inside the
   button for a label needing 255, so one label broke onto a second line by
   four pixels. A guessed width will always be wrong for some label; the
   label's own width never is. */
@media (max-width: 600px) {
  .listen-row {
    grid-auto-flow: row;
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
  }
  .listen-row .btn { width: 100%; }
}

/* ------------------------------------------------------------- notice --- */
/* A short, plain statement where content was expected: a feed that would not
   load, an episode address that matches nothing. It always carries a link
   out, so the visitor is never left at a dead end. */
.notice {
  grid-column: 1 / -1;
  margin: 0;
  padding: .6em 0 0;
  max-width: var(--measure);
}
.notice__text { margin: 0 0 1.2em; }

/* ------------------------------------------------- photo placeholders --- */
.ph {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--ph);
  border: var(--rule-hair) solid var(--color-line);
  padding: 1.2rem;
  text-align: center;
  overflow: hidden;
}
/* A real photo drops in exactly where its placeholder stood -- same frame,
   same ratio -- so the page does not reflow the day the photography lands.
   The ratio comes from the .ph rules in pages.css and sections.css, which
   name `picture` alongside `.ph`; the crop is object-fit, so a portrait that
   is not quite 4:5 is trimmed rather than squashed. */
picture {
  display: block;
  border: var(--rule-hair) solid var(--color-line);
  background: var(--ph);
  overflow: hidden;
}
picture > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ph__label {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .1em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--ink);
  max-width: 22ch;
}

/* ---------------------------------------------------------------- frame -
   The only way a photo is presented anywhere on the site: a thin ink rule
   and a monospace caption under it, like a picture in a newspaper.
   No mats, no tape, no tilt.                                              */
.frame { display: block; margin: 0; }
.frame__caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .7rem;
  padding-top: .55rem;
  border-top: var(--rule-hair) solid currentColor;  /* follows the ground it sits on */
}

/* --------------------------------------------------------- skip link --- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--ink);
  color: var(--paper);
  padding: 1em 1.4em;
  font-family: var(--mono);
  font-size: var(--fs-button);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------ utility --- */
.wrap { width: min(var(--wrap), 100% - var(--gutter) * 2); margin-inline: auto; }
.svg-defs { position: absolute; }   /* the shared <defs> sprite, not drawn */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
  html { scroll-behavior: auto; }
}


/* ------------------------------------------ moving between pages --------- */
/* This site is a set of separate documents, so clicking a nav link throws the
   whole page away and builds the next one. However fast that is -- and it is
   fast, about 100ms to first paint -- there is a frame in the middle with
   nothing on screen, and that blank frame is the flash.

   Speed is not the fix. The fix is to stop the browser discarding the first
   page before the second is ready: this hands it both and lets it cross-fade.

   Chrome, Edge and Safari 18.2+ do this. Firefox ignores the rule and
   navigates exactly as it does today -- the old behaviour, not a new fault. */
@view-transition { navigation: auto; }

/* The strip, the masthead and the footer are identical on every page, so they
   should not take part in the fade at all. Naming one tells the browser the
   element in the old page and the element in the new page are the same thing,
   and it holds them still while the content between them changes.

   A name has to be unique within a page. These three appear once each. */
.banner { view-transition-name: banner; }
.nav    { view-transition-name: masthead; }
.footer { view-transition-name: page-footer; }

/* Short enough to read as one movement rather than an effect. The default is
   250ms; this trims it, because the page underneath is already there. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: .2s;
  animation-timing-function: ease;
}

/* Under reduced motion the snapshots swap with no animation at all. That is
   still not the flash -- the browser holds the old page until the new one is
   ready either way, so there is no blank frame; only the fade goes.

   This deliberately does NOT nest @view-transition inside @media. The spec
   allows it, but support for the at-rule inside a conditional group is newer
   and patchier than support for the at-rule itself, and getting it wrong
   silently disables the transition everywhere rather than only under reduced
   motion. Targeting the pseudo-elements needs no such support. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}


/* ----------------------------------------------------------- printing --- */
/* A brand or a venue printing a page should get the words, not
   a wall of ink. Grounds go white, the textures and the chrome come off,
   and every link prints the address it points at. */
@media print {
  body::after,
  .banner,
  .nav__toggle,
  .skip,
  .halftone { display: none !important; }

  html, body { background: #fff !important; color: #000 !important; }
  .wrap { width: 100% !important; }

  [class*="--dark"],
  .banner, .episodes--dark, .footer, .mediakit, .bio--a {
    background: #fff !important;
    color: #000 !important;
  }

  a { text-decoration: underline; }
  .notes__list a::after,
  .footer__links a::after { content: " (" attr(href) ")"; font-size: .8em; }

  .ph { border: 1px solid #999; }
  section { break-inside: avoid; page-break-inside: avoid; }
}
