/* ============================================================================
   Floom Blog — the deck, and the reader a card opens into
   ----------------------------------------------------------------------------
   Three parts:

     1. the head    — eyebrow and title on the left, the one-line description
                      on the right, sitting on the title's baseline
     2. the deck    — every guide as one wide card, each in its own sticky
                      wrapper: skiper16's StickyCard_001. At rest the first
                      card sits under the head, the width of the page (the
                      wireframe). Scrolling brings the next card up over it;
                      each sticks one step lower than the one before, and the
                      cards underneath shrink from their top edge, so the
                      stack reads as a stair of cards with the newest in front.
     3. the reader  — where a card opens. Click a card and it grows out to the
                      whole viewport, its face dissolving into the guide's own
                      page, which is read by scrolling inside. floom-blog.js
                      does the growing; this is what it grows into.

   Geometry the script needs is shared through custom properties on the deck.
   ========================================================================== */

/* ── 1. the head ────────────────────────────────────────────────────────────*/
.bl-head{
  position: relative;
  padding: round(clamp(112px, 15vh, 152px), 8px) 0 round(clamp(20px, 3vh, 32px), 4px);
  overflow: hidden;
}
.bl-head .glow{
  position: absolute; top: -200px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, rgba(255,60,0,.06) 0%, rgba(255,138,77,.02) 35%, transparent 65%);
  pointer-events: none;
}
.bl-head-grid{
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));   /* title 1–8, description 9–12 */
  align-items: end;                 /* the description sits on the title's line */
  gap: 24px var(--fl-col-gap);
}
.bl-head-grid > :first-child{ grid-column: 1 / span 8; }
.bl-head-grid > :last-child{ grid-column: 9 / -1; }
.bl-head h1{
  font-size: var(--fl-t-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 16px 0 0;
}
.bl-desc{
  font-size: clamp(14.5px, 1.2vw, 16px);
  line-height: 1.3;
  color: var(--text-secondary);
  /* Reads against the h1's baseline, not its cap height: a few px of lift
     lines the last line of the paragraph up with the bottom of the title. */
  padding-bottom: 8px;
}
/* The deck is pulled up by --bl-pin, so the head has to hand that back plus the
   clearance it wants: without this the stack's top edge starts ABOVE the title's
   baseline and cuts into both the title and the standfirst. */
.bl-head{ padding-bottom: round(clamp(80px, 7vw, 112px), 8px); }

/* ── 2. the deck ────────────────────────────────────────────────────────────*/
.bl-deck{
  position: relative;
  --bl-n: 2;                        /* how many cards — the markup sets it */
  --bl-pin: 96px;                   /* where the first card sticks, under the 72px nav */
  --bl-stair: 36px;                 /* each card sticks this much lower than the last.
                                       This is the ONLY peek: a shrunk card sits inside
                                       the front one's width, so nothing shows at the
                                       sides however far it shrinks. */
  --bl-hold: 60vh;                  /* room after the last card: the stack holds while the
                                       cards under it finish shrinking, then leaves */
  /* Tall enough to be the page, short enough to sit whole under the head
     with the fold to spare — the wireframe's single card. */
  --bl-card-h: clamp(420px, calc(100vh - 310px), 720px);
  /* The first wrapper starts --bl-pin above the head's end. At rest its card
     is then directly under the head; when the wrapper sticks to the top of
     the viewport the card is --bl-pin below it — under the nav, not behind. */
  margin-top: round(calc(-1 * var(--bl-pin)), 4px);
  /* Room under the last card. This sits on the SECTION, not on the track: the
     track is the sticky wrappers' containing block, and padding there would
     take the stack's own room away (which is why the hold is a ::after block
     of content instead). */
  /* Enough that the last card has scrolled clear of the viewport by the time
     the page bottoms out. The footer is revealed from under the page, so a card
     still on screen at max scroll simply stays there — only trailing room moves
     it off. Shortening the hold does not help: it moves the card and the page
     end by the same amount. */
  padding-bottom: round(clamp(300px, 48vh, 640px), 8px);
  /* The wrappers overlap the head's last lines: let clicks through to them. */
  pointer-events: none;
}
.bl-deck .bl-card{ pointer-events: auto; }
.bl-deck-track{ position: relative; }
/* The hold is CONTENT, not padding: a sticky child is held inside its
   containing block's content box, so padding at the foot of the track would
   give the stack no room at all — it would start leaving the moment the last
   card arrived. A generated block at the end is content, and holds it. */
.bl-deck-track::after{
  content: "";
  display: block;
  height: var(--bl-hold);
}
/* The deck looks like a deck before anything has moved: two edges above the
   front card, each a little narrower, the way a pile of cards sits. They are
   behind every wrapper (z-index 0 against the wrappers' 1 and 2) and they are
   NOT the real cards — those arrive on scroll — so they leave as soon as the
   stack starts, rather than lingering as a border that belongs to nothing. */
.bl-deck-edges{
  position: absolute; left: 0; right: 0; z-index: 0;
  top: round(calc(var(--bl-pin) - 32px), 8px);
  height: 56px; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.bl-deck-edges i{
  position: absolute; left: 50%; display: block; height: 56px;
  transform: translateX(-50%);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-xl, 24px) var(--radius-xl, 24px) 0 0;
  /* White on a cream page is nearly invisible at 12px of exposure: the lift is
     what separates one edge from the next. */
  box-shadow: 0 -3px 10px rgba(24,24,24,.055);
}
.bl-deck-edges i:nth-child(1){ top: 0;  width: min(1048px, calc(100vw - 152px)); opacity: .62; }
.bl-deck-edges i:nth-child(2){ top: 16px; width: min(1104px, calc(100vw - 96px)); opacity: .85; }
.bl-deck.is-moving .bl-deck-edges{ opacity: 0; transform: translateY(-6px); }

/* One sticky wrapper per card, in flow. Each sticks at the top of the
   viewport; the card inside sits at the pin plus one stair per card, so the
   stack fans downward. Later in the markup = later to arrive = on top. */
.bl-card-wrap{
  position: sticky;
  top: 0;
  padding-top: round(calc(var(--bl-pin) + var(--i, 0) * var(--bl-stair)), 4px);
  z-index: calc(1 + var(--i, 0));
}

.bl-card{
  position: relative;
  margin: 0 auto;
  width: min(1152px, calc(100vw - 48px));   /* the container's own width */
  height: var(--bl-card-h);
  /* A cover band on top, the words in a footer under it. The band takes the
     height the words leave, up to a fixed proportion of the card's width, so
     the crop of a banner is the same on every screen; past that the footer
     takes the room and centres its lines in it. */
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 24px);
  box-shadow: 0 30px 80px rgba(24,24,24,.10), 0 2px 6px rgba(24,24,24,.04);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  will-change: transform;
  transform-origin: 50% 0;          /* shrinks from its top edge: the edge stays put
                                       and peeks out above the card that covers it */
  cursor: pointer;
  /* The script owns transform; this is for everything else. */
  transition: box-shadow .3s cubic-bezier(.22, 1, .36, 1),
              border-color .3s cubic-bezier(.22, 1, .36, 1);
}
.bl-card:hover{
  border-color: var(--border-hover, rgba(0,0,0,.15));
  box-shadow: 0 36px 90px rgba(24,24,24,.13), 0 2px 6px rgba(24,24,24,.05);
}
.bl-card:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
/* Open in the reader: the reader's cover stands exactly where this was. */
.bl-card.is-open{ visibility: hidden; }

.bl-card-thumb{
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  /* 2.8:1 of the card's own width — the most of a banner a band ever shows */
  max-height: calc(min(1152px, 100vw - 48px) * 0.3567);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(160deg, var(--orange-50, #ffffff), var(--orange-100, #faf6f1));
  border-bottom: 1px solid var(--border);
}
.bl-card-thumb svg{ width: min(34%, 300px); height: auto; }
/* A cover image fills the band and is cropped to it, centred: the banners are
   wider than the band, so what goes is a strip off the top and the bottom. */
.bl-card-thumb img{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
/* A dark banner stands on its own black — its transparent corners and any
   letterboxing land on the same colour as its own ground. */
.bl-card-thumb.is-dark{ background: #000; border-bottom-color: rgba(0,0,0,.25); }
/* A light one stands on white. */
.bl-card-thumb.is-light{ background: #fff; }
/* A banner that carries its own title at the foot: the card's footer already
   says what it says, so the window the band shows ENDS just above the words,
   whatever the band's height. The image hangs from the band's bottom edge and
   overshoots it by a fixed share of its own height (the share the title
   occupies), so a shorter band shows a lower slice — the icons and the sheet
   stay, the title never appears — and at the cap above the slice starts at the
   very top. 6% wider than the band so its own rounded corners fall outside. */
.bl-card-thumb.is-top img{
  top: auto; bottom: round(calc(-0.104 * min(1152px, 100vw - 48px)), 8px);
  left: 0; width: 100%; height: auto;
  object-fit: fill;
}

.bl-card-meat{
  /* Grows only once the band has hit its cap — a grow factor this small is a
     rounding error while the band is still growing, and all the room after. */
  flex: 0.001 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 12px round(clamp(28px, 4vw, 72px), 4px);
  align-items: start;
  align-content: center;
  padding: round(clamp(24px, 2.6vw, 32px), 4px) round(clamp(28px, 3.4vw, 52px), 4px) round(clamp(24px, 2.8vw, 36px), 4px);
  min-width: 0;
}
.bl-card-lead, .bl-card-more{ min-width: 0; }
.bl-card .post-tag{
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent);
}
.bl-card h2{
  font-size: var(--fl-t-title2);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 12px 0 0;
  color: var(--text);
  text-wrap: balance;
}
.bl-card p{
  font-size: clamp(15px, 1.2vw, 16.5px);
  line-height: 1.3;
  color: var(--text-secondary);
  max-width: 54ch;
}
.bl-card .post-meta{
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.bl-card .post-arrow{
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px;
  font-size: 15px; font-weight: 600;
  color: var(--text);
}
.bl-card .post-arrow svg{ transition: transform .3s cubic-bezier(.22, 1, .36, 1); }
.bl-card:hover .post-arrow svg{ transform: translateX(4px); }

/* ── 3. the reader ──────────────────────────────────────────────────────────*/
.bl-reader{
  position: fixed;
  inset: 0;
  z-index: 950;                     /* over the nav (100) and its menu; under the curtain */
}
/* Author display rules would beat the UA's [hidden]; be explicit. */
.bl-reader[hidden], .bl-reader [hidden]{ display: none !important; }

/* The page behind, dimming as the card lifts off it. */
.bl-reader-scrim{
  position: absolute; inset: 0;
  background: rgba(250,246,241,.6);
  opacity: 0;
}
/* The shadow under the growing card. A clipped shell casts none, so this
   travels the same rectangle one layer down. */
.bl-reader-lift{
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  border-radius: 0;
  background: var(--bg-card, #fff);
  box-shadow: 0 48px 120px rgba(24,24,24,.24), 0 12px 32px rgba(24,24,24,.10);
  opacity: 0;
  will-change: left, top, width, height, opacity;
}
/* The reader itself: full size from the first frame, revealed through a
   clip that opens from the card's rectangle to the viewport. */
.bl-reader-shell{
  position: absolute; inset: 0;
  background: var(--bg);
  clip-path: inset(0 0 0 0 round 0);
  will-change: clip-path;
}
.bl-reader-scroll{
  position: absolute; inset: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;     /* reaching the end never moves the page beneath */
  -webkit-overflow-scrolling: touch;
  outline: none;                    /* it takes focus so the keyboard scrolls it */
}
.bl-reader-body{ min-height: 100%; }
.bl-reader-body iframe{
  display: block;
  width: 100%;
  border: 0;
  /* the script sets the real height, from the document inside */
  height: 100vh;
}

/* The card's face, cloned, grown along with the window and dissolved once
   it is mostly open. It has the card's classes for the card's layout; this
   pins it and takes the card's own motion off it. */
.bl-reader .bl-reader-cover{
  position: absolute; left: 0; top: 0;
  translate: none;
  transform: none;
  margin: 0;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
  z-index: 5;
  will-change: left, top, width, height, opacity;
}

/* The reader's own bar: back to the deck on the left, the guide's own page
   on the right. Sticky inside the scroller and pulled up by its own height,
   so it holds the top without taking room from the guide — and a wheel over
   it scrolls like a wheel anywhere else. */
.bl-reader-bar{
  position: sticky; top: 0;
  z-index: 6;
  height: 64px;
  margin-bottom: -64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 round(clamp(16px, 2.64vw, 40px), 4px);     /* the nav's own gutters */
  border-bottom: 1px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease, background-color .3s ease, border-color .3s ease;
}
.bl-reader.is-open .bl-reader-bar{ opacity: 1; pointer-events: auto; }
.bl-reader-bar.is-scrolled{
  background: rgba(255,255,255,.86);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom-color: var(--border);
}
.bl-reader-close{
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font: 600 13.5px/1 var(--font, inherit);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.bl-reader-close:hover{ border-color: var(--border-hover, rgba(0,0,0,.15)); box-shadow: var(--shadow-md); }
.bl-reader-close:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.bl-reader-close svg{ transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
.bl-reader-close:hover svg{ transform: translateX(-3px); }
.bl-reader-open{
  font-size: 13.5px; font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color .2s;
}
.bl-reader-open:hover{ color: var(--text); }

/* While a guide is open the page under it holds still — and keeps its width,
   so nothing under the growing card shifts when a classic scrollbar goes. */
html.bl-reading{ overflow: hidden; }
html.bl-reading body{ padding-right: var(--bl-sbw, 0px); }

/* ── phones, and less motion: a list, not a deck ───────────────────────────*/
@media (max-width: 760px){
  .bl-head-grid{ align-items: start; }
  .bl-head-grid > :first-child, .bl-head-grid > :last-child{ grid-column: 1 / -1; }   /* the same selectors as the placement, so this wins */
  .bl-desc{ padding-bottom: 0; }
  .bl-deck{ margin-top: 0; pointer-events: auto; }
  .bl-deck-track{ padding-top: 8px; }
  .bl-deck-track::after{ display: none; }
  .bl-card-wrap{ position: static; padding-top: 0; }
  /* No stack here, so nothing for the edges to be the back of. */
  .bl-deck-edges{ display: none; }
  .bl-card{
    transform: none !important;
    width: auto; height: auto;
    margin: 0 24px 16px;
    grid-template-columns: 1fr;
  }
  .bl-card-thumb{ flex: none; max-height: none; min-height: 180px; }
  .bl-card-thumb.is-dark{ min-height: 0; aspect-ratio: 2000 / 922; }   /* the whole banner */
  .bl-card-thumb.is-top{ min-height: 0; aspect-ratio: 10000 / 3567; }   /* the same window as the desk */
  .bl-card-meat{ flex: none; }
  .bl-card-thumb svg{ width: 140px; }
  .bl-card-meat{ grid-template-columns: 1fr; gap: 8px; padding: 20px 24px 24px; }
  .bl-reader-bar{ height: 56px; margin-bottom: -56px; }
  .bl-reader-open{ display: none; }   /* the bar is the back button on a phone */
}
@media (prefers-reduced-motion: reduce){
  .bl-deck{ margin-top: 0; pointer-events: auto; }
  .bl-deck-track::after{ display: none; }
  .bl-card-wrap{ position: static; padding-top: 0; }
  /* No stack here, so nothing for the edges to be the back of. */
  .bl-deck-edges{ display: none; }
  .bl-card{
    transform: none !important;
    margin: 0 auto 16px;
  }
  .bl-reader-bar{ transition: none; }
}
