/* ==========================================================================
   GIRL BEER — sections
   1. Top banner   2. Navigation   3. Hero (collage mode)
   ========================================================================== */

/* ========================================================== 1. BANNER === */
.banner {
  background: var(--bg-banner);
  color: var(--color-on-dark);
  overflow: hidden;
  border-bottom: var(--rule) solid var(--color-line);
}
.banner__track {
  display: flex;
  width: max-content;
  animation: slide-left var(--speed-banner) linear infinite;
}
.banner__group {
  display: flex;
  align-items: center;
  flex: none;
  padding: .55rem 0;
}
.banner__item {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-inline: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 1.1rem;
}
.banner__star { color: var(--pink); flex: none; }

@keyframes slide-left {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* ============================================================== 2. NAV === */
/* A slim bar. The cap used to run to 140px with 22px of padding under it,
   which made the first band of the page about 180px tall and almost entirely
   empty -- a mark on the left, a menu on the right, nothing in between. */
.nav {
  background: var(--bg-hero);
  padding: clamp(10px, 1.2vw, 16px) 0;
}
/* A masthead needs an edge. The nav and the hero are both cream, so without a
   rule between them the bar had no bottom and the mark and the menu read as
   two things adrift in the page rather than as a header. This is the same
   hairline that separates any two cream sections. */
.nav__inner { border-bottom: var(--rule-hair) solid var(--color-line); padding-bottom: clamp(10px, 1.2vw, 16px); }
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.nav__logo {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.3vw, 18px);
  text-decoration: none;
  min-width: 0;
}
/* The name beside the mark, in the logo's own face and its own pink. Mixed
   case, like the logo -- never GIRL BEER PODCAST.

   The floor of 1.2rem is the whole reason this can be pink. Pink on cream is
   3.46:1, which clears the 3:1 that LARGE text needs and misses the 4.5:1 that
   anything smaller needs -- and large means bold at 18.66px, which this face
   is. 19.2px is the smallest this is ever set, at any viewport, so it stays on
   the right side of that line everywhere. Lower the floor and the colour stops
   being allowed; the two values move together. */
.nav__word {
  display: grid;                 /* the two impressions share one cell */
  font-size: clamp(1.2rem, 3.1vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.nav__under,
.nav__over { grid-area: 1 / 1; }
/* Pink on top, ink behind -- the hero's order, and the logo's.
   The z-index is doing real work here, not decoration. `translate` on the ink
   layer below makes it a stacking context, which paints with the positioned
   descendants, ABOVE a plain inline sibling however late that sibling comes in
   the markup. Without this the ink plate covers the pink one and the masthead
   comes out almost entirely dark with a pink edge. The hero never hit this
   because both of its layers carry .distressed, whose mask makes stacking
   contexts of both, so there document order settles it. */
.nav__over {
  color: var(--pink);
  position: relative;
  z-index: 1;
}
/* The ink plate, offset down and to the left, the way the hero sets its own
   and the way the logo is drawn.

   .05em, not the hero's .026em. The offset is in em so it scales with the
   type, and the hero is set at something like 360px, where .026em is a visible
   9px. Here the type tops out at 40px and .026em rounds to a single pixel --
   present in the box model, invisible on the page. The logo's own offset runs
   nearer .065em of its cap height, so this sits between the two and is the
   smallest offset that still reads as a second impression at this size. */
.nav__under {
  color: var(--ink);
  translate: -.05em .05em;
}
.nav__logo img {
  width: clamp(76px, 8vw, 104px);
  height: auto;                 /* never force a ratio — that is what warps it */
  object-fit: contain;
}
.nav__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__link {
  display: block;
  border: var(--rule) solid var(--color-line);
  margin-left: calc(var(--rule) * -1);   /* cells share a rule */
  background: var(--paper);
  padding: .7rem 1.15rem;
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .12s linear, color .12s linear;
}
/* Hover fills with ink, the current cell with wine: both read at 13.1:1
   and 8.81:1, and they stay told apart. */
.nav__link:hover,
.nav__link:focus-visible { background: var(--ink); color: var(--color-on-dark); }
.nav__link[aria-current="page"] {
  background: var(--wine);          /* cream on pink is 3.46:1; on wine it is 8.81:1 */
  color: var(--color-on-dark);
}
.nav__link--alt {                          /* Substack sits apart */
  background: var(--ink);
  color: var(--paper);
  margin-left: .55rem;
  border-color: var(--ink);
}
.nav__link--alt:hover,
.nav__link--alt:focus-visible { background: var(--wine); border-color: var(--wine); color: var(--color-on-dark); }

.nav__toggle {
  display: none;
  border: var(--rule) solid var(--color-line);
  background: var(--paper);
  padding: .7rem 1.1rem;
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  cursor: pointer;
}

/* Fitted by test, not by arithmetic. With the Episodes tab present -- which it
   will be the day feedUrl is set, so that is the case this has to survive --
   the row renders flush at 780px and overflows its own edge by 21px at 725px.
   Adding up the parts said there was 78px of slack at 725, which the rendered
   box flatly contradicted, so the measured number wins. It was 860, which
   collapsed the bar about 80px earlier than it had to. */
/* 780px is the width at which the full five-tab nav stops fitting, so it is
   the safe default and the only behaviour without JavaScript. But the tab
   count is not fixed -- Episodes takes itself off while there is no feed --
   and a media query cannot know that, so the bar used to stay collapsed over
   a stretch where it had room, stretching wider and emptier the more you
   opened the window.

   So js/site.js measures: it tries the inline layout, asks the browser
   whether the list still fits inside the bar, and sets data-nav="fits" on
   <html> when it does. Every rule below stands down in that case. Without
   JavaScript nothing sets the attribute and the 780px rule holds. */
@media (max-width: 780px) {
  /* The menu list is absolutely positioned, so its <nav> wrapper collapses to
     nothing — and in a space-between row that left MENU floating half way
     across instead of sitting at the edge. */
  :root:not([data-nav="fits"]) .nav__inner { justify-content: flex-start; position: relative; }
  :root:not([data-nav="fits"]) .nav__toggle { display: inline-flex; margin-left: auto; }
  :root:not([data-nav="fits"]) .nav__list {
    display: none;
    position: absolute;
    top: 100%;
    right: var(--gutter);
    z-index: 40;
    flex-direction: column;
    background: var(--paper);
  }
  :root:not([data-nav="fits"]) .nav__list[data-open="true"] { display: flex; }
  :root:not([data-nav="fits"]) .nav__link { margin-left: 0; margin-top: calc(var(--rule) * -1); min-width: 13rem; }
  :root:not([data-nav="fits"]) .nav__link--alt { margin-left: 0; margin-top: .5rem; }
}

/* ============================================================= 3. HERO === */
.hero {
  position: relative;
  background: var(--bg-hero);
  padding-top: clamp(14px, 1.8vw, 28px);
  /* Was 0, from when a torn paper edge closed this section. That edge went in
     the newspaper pass and the zero stayed, which left the next section's
     full-bleed hairline sitting right on top of the last button. */
  padding-bottom: clamp(38px, 5vw, 76px);
  overflow: hidden;
}

/* --- the two of us --------------------------------------------------- */

/* --p is how far the hero has scrolled: 0 at the top of the page, 1 once
   about 60% of the hero's height has gone by. js/site.js sets it. It is only
   used on a phone, where the pair sits below the buttons and has room to move;
   on a wide screen the circles are grid cells beside the line and stay put. */
.hero { --p: 0; }

.hero__face {
  position: relative;
  width: clamp(104px, 15vw, 196px);
}
.hero__face picture {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: var(--rule) solid var(--color-line);
  border-radius: var(--radius-round);
  background: var(--ph);
  overflow: hidden;
  filter: grayscale(1);
}

/* Gold halftone wash behind the headline, fading off into the paper.

   It is sized against .hero__stage — the box the words occupy — not against
   the section. Anchored to the section it slid off the type on a phone,
   where the strip and the stacked buttons push the headline into the top
   half, and the dots ended up behind the body copy instead. */
.hero__field {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 116%;
  max-width: min(1180px, 92vw);   /* so the fade happens ON screen, not past it */
  height: 146%;
  z-index: 0;
  pointer-events: none;
}

.hero__stage {
  position: relative;
  z-index: 1;
  container-type: inline-size;
}

/* --- the giant type: one line, full width ------------------------------- */
.hero__title {
  /* Both impressions sit in one grid cell, so they share a content box and
     line up without either being positioned by hand. */
  display: grid;
  margin: 0;
  padding-right: .083em;      /* re-centres the word; see the note below */
  color: var(--pink);
  font-size: var(--fs-hero);     /* tuned so "Girl Beer" spans the hero */
  line-height: .74;              /* no descenders in "Girl Beer" — set it tight */
  letter-spacing: -0.028em;
  white-space: nowrap;
  text-align: center;
  position: relative;
  z-index: 1;
}
.hero__under,
.hero__over { grid-area: 1 / 1; }

/* The ink impression. It carries the distressed mask too, on its own box --
   because the box is translated, the noise lands at a different point on this
   layer than on the pink one, so the two speckle independently the way two
   passes through a press would.

   The stroke fattens it a little past the pink so it shows as a consistent
   edge rather than as a second set of letterforms, and the offset is small
   enough that no paper shows between the two Gs. */
.hero__under {
  color: var(--ink);
  -webkit-text-stroke: .022em var(--ink);
  paint-order: stroke fill;
  translate: -.026em .026em;
  /* the same box room the pink layer gets, so the mask does not shear the
     stroke off the bottom-left where the offset pushes it */
  margin: -.07em -.25em;
  padding-block: .07em;
}

/* The pink impression, and the only one that is textured. The negative
   margins and the block padding widen its box so the distressed mask covers
   the overhang of the italic r; without them the mask shears it flat. */
.hero__over {
  margin: -.07em -.25em;
  padding-block: .07em;
}

/* The G carries a wide left sidebearing, and the negative letter-spacing
   lands after the final r as well, which together sat "Girl Beer" about
   .04em right of centre -- 17px of air on the left and none on the right.
   The padding above shifts it back by half. */

/* --- line under the type ------------------------------------------------ */
/* One row: face, line, face -- then the buttons across all three. Grid areas
   rather than absolute placement, so nothing can ever land on top of anything
   else however long a label or a line gets. */
.hero__say {
  position: relative;
  z-index: 2;
  margin: clamp(22px, 2.8vw, 40px) auto 0;
  text-align: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "a strip b"
    "btn btn btn";
  align-items: center;
  justify-items: center;
  column-gap: clamp(14px, 2.4vw, 40px);
}
.hero__face--a { grid-area: a; }
.hero__face--b { grid-area: b; }
.hero__strip   { grid-area: strip; }
.hero__listen  { grid-area: btn; }

/* Phones: the line and the buttons take the full width and the pair drops
   underneath, overlapping. This is where the scroll move lives -- they start
   apart and a little small, and close up as the page moves. */
/* Phones. Flex, not grid: two equal grid columns pushed the circles apart and
   needed negative margins to drag them back, which left the pair sitting off
   the centre line. Wrapped flex items with justify-content:center make the two
   of them one centred group, and the overlap is then the only thing the margin
   has to do. */
@media (max-width: 760px) {
  .hero__say {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    row-gap: clamp(18px, 4vw, 30px);
  }
  .hero__strip  { order: 1; flex: 0 0 100%; }
  /* The row takes the whole line here, so its width:max-content from base.css
     does not apply below 760px -- the buttons fill the width instead, which
     is what you want for a tap target on a phone. */
  .hero__listen { order: 2; flex: 0 0 100%; }
  .hero__face   { order: 3; width: clamp(92px, 32vw, 164px); }

  /* They start a little apart and smaller, then close into a light overlap as
     the page moves. */
  .hero__face {
    scale: calc(.9 + .1 * var(--p));
    translate: calc(var(--face-x) * (1 - var(--p))) 0;
  }
  .hero__face--a { --face-x: -14%; }
  .hero__face--b { --face-x:  14%; margin-left: -9%; margin-top: 13%; }
}
.hero__strip {
  display: inline-block;
  margin: 0;
  color: var(--color-text);
  /* Paper behind the words, now that the two circles pass under this line as
     the page scrolls. Ink on a photograph is a contrast figure nobody can
     promise -- it depends on which part of a face happens to be behind which
     word. On its own cream ground it is 12:1 wherever the circles are. */
  background: var(--paper);
  padding: .8rem clamp(.9rem, 2.2vw, 1.7rem);
  border-top: var(--rule-hair) solid var(--color-line);
  border-bottom: var(--rule-hair) solid var(--color-line);
  font-family: var(--mono);
  font-size: clamp(.74rem, .7rem + .22vw, .9rem);
  letter-spacing: .06em;
  line-height: 1.7;
  max-width: 52ch;
}
.hero__listen {
  margin-top: clamp(20px, 2.6vw, 34px);
  margin-inline: auto;        /* the row is max-content wide; this centres it */
}

/* --- phones: the words stack ------------------------------------------- */
@media (max-width: 760px) {
  .hero__title {
    font-size: 46cqw;
    line-height: .80;
    letter-spacing: -0.03em;
    /* Two lines, each centred on its own, and both already sit true. */
    padding-right: 0;
  }
  .hero__title span { display: block; }
}

/* =================================================== 7. LATEST EPISODES === */
.episodes {
  background: var(--bg-start);
  color: var(--color-text);
  padding-block: var(--section-pad);
}
.episodes__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: clamp(28px, 3.4vw, 48px);
}
.episodes__title {
  margin: 0;
  color: var(--color-accent);
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  line-height: .94;
}
.episodes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: clamp(22px, 2.6vw, 38px);
}

.ep { display: flex; flex-direction: column; align-items: flex-start; }
.ep__art { width: 100%; }
.ep__art :is(.ph, picture) { aspect-ratio: 1; }
.ep__cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: var(--rule-hair) solid var(--color-line);
}
.ep__num {
  color: var(--pink);
  font-size: 1.9rem;
  line-height: 1;
}
.ep__meta { color: inherit; opacity: .7; }   /* was ink-on-ink in the dark grid */
.ep__title {
  margin: 1.1em 0 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.ep__desc { margin: .7em 0 0; opacity: .8; }
.ep .btn { margin-top: 1.5em; }

/* dark variant — the grid on an ink ground */
.episodes--dark { background: var(--bg-episodes); color: var(--color-on-dark); }
.episodes--dark .episodes__title { color: var(--color-accent); }
.episodes--dark .ep__btn,
.episodes--dark .episodes__head .btn {
  background: transparent;
  border-color: var(--color-on-dark);
  color: var(--color-on-dark);
}
/* Same as the media-kit block: on a dark ground the outline fills with
   cream and the label flips to ink, rather than filling with a colour that
   has nothing to show against it. */
.episodes--dark .ep__btn:hover,
.episodes--dark .ep__btn:focus-visible,
.episodes--dark .episodes__head .btn:hover,
.episodes--dark .episodes__head .btn:focus-visible {
  background: var(--color-on-dark);
  color: var(--ink);
  border-color: var(--color-on-dark);
}

@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
  .feature__art {
    border-right: none;
    border-bottom: var(--rule) solid var(--color-line);
  }
  .feature__art :is(.ph, picture) { aspect-ratio: 4 / 3; }
}

/* ============================================================ 12. FOOTER === */
.footer {
  background: var(--bg-footer);
  color: var(--color-on-dark);
  /* Two cream sections are separated by an ink rule; two dark ones need the
     same rule in the other colour. Without it the episode band and the footer
     are one unbroken slab and the end of the page has no edge. It sits here
     unconditionally because against a cream section above it a cream hairline
     is invisible, so it only shows where two dark bands meet. */
  border-top: var(--rule-hair) solid var(--color-on-dark);
  padding-block: calc(var(--section-pad) * 0.62);
}
/* cap | address + newsletter | platform links. The mark used to sit on a row
   of its own with the address, the button on a second row and the links on a
   third -- three short left-aligned blocks with most of the footer's width
   empty beside them. Pairing the first two fills that row and removes one. */
.footer__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "cap say links"
    "law law law";
  column-gap: clamp(22px, 3vw, 56px);
  row-gap: clamp(22px, 2.6vw, 40px);
  align-items: start;
}
.footer__cap      { grid-area: cap; }
.footer__say      { grid-area: say; }
.footer__links    { grid-area: links; }
.footer__colophon { grid-area: law; }

/* the cap needs paper under it — its ink browns vanish against the ink ground */
.footer__cap {
  display: grid;
  place-items: center;
  width: clamp(62px, 7vw, 88px);
  aspect-ratio: 1;
  border-radius: var(--radius-round);
  background: var(--paper);
}
.footer__logo { width: 94%; height: auto; object-fit: contain; }  /* fills the disc, bar a thin cream edge */

.footer__say {
  display: grid;
  justify-items: start;
  gap: clamp(14px, 1.6vw, 20px);
}
.footer__email {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;   /* last resort below about 290px */
  color: var(--paper);
  opacity: .75;
}

/* A row, not a column. Stacked, the four platform names made a narrow
   left-aligned list with the whole right of the footer empty beside it --
   worst of all between about 400 and 900px, where the links already span the
   full width and used every bit of it going down and none going across.
   They wrap to a second line on their own when they stop fitting. */
.footer__links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.7em;
  row-gap: .5em;
  align-items: baseline;
}
.footer__linksLabel {
  flex: 1 0 100%;            /* the label heads the row, on its own line */
  margin: 0 0 .7em;
  color: var(--paper);
  opacity: .75;
}
.footer__links a {
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
/* On ink, pink type is 3.79:1 at this size. The label stays cream and the
   accent moves to the rule under it, where contrast does not apply. */
.footer__links a:hover,
.footer__links a:focus-visible { color: var(--color-on-dark); border-bottom-color: var(--pink); }

/* The colophon. Without it the footer's last line is a row of platform names
   and the page stops rather than ends -- every reference footer we looked at
   closes on one of these, and it is the cheapest way to make the bottom edge
   read as finished.

   The hairline is cream because the ground here is ink, the same reasoning as
   the rule on .footer above. Cream at 60% over ink is 5.5:1, so the line
   clears 4.5:1 at label size while staying quieter than the address. */
.footer__colophon {
  margin: 0;
  padding-top: clamp(16px, 1.8vw, 24px);
  border-top: var(--rule-hair) solid var(--color-on-dark);
  color: var(--paper);
  opacity: .6;
}

/* Three across needs 745px of content: the mark at 88, the address block at
   228, the link row at 353 and two gaps at 77. Measured, not guessed -- the
   numbers hold until the email address or a platform name gets longer, which
   is the thing to re-measure if one does.

   Below that the links take a row of their own, still running across, and
   the address block spreads so the row above fills its width too. */
@media (max-width: 860px) {
  .footer__grid {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "cap say"
      "links links"
      "law law";
  }
  .footer__say {
    grid-auto-flow: column;
    justify-content: space-between;
    align-items: center;
    column-gap: clamp(16px, 2vw, 28px);
  }
}

/* The address and the button stop sharing a line before the mark does. */
@media (max-width: 620px) {
  .footer__say {
    grid-auto-flow: row;
    justify-content: start;
  }
}

/* Under about 400px the mark and the address cannot share a row either. */
@media (max-width: 400px) {
  .footer__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cap" "say" "links" "law";
  }
  .footer__linksLabel { margin-bottom: .3em; }
}
