/* -----------------------------------------------
   PATTERN: valencia/press-rows — .valencia-press-rows
   Loaded by the theme's class-name loader whenever a block carries this
   class, and into the editor canvas by add_editor_style(). Only rules the
   block attributes and theme.json cannot express belong here (Rule 10):
   the grid, the hover card, the tilt, the rising logo.

   Mechanism, after the peeking image rows on trevornoah.com/watch-listen.
   On hover a tinted card fades in
   under the row and tilts by a degree that alternates per row; the text
   tilts with it; the outlet logo rises out of the card, level, into a
   lane reserved between the title and the chip, and stops with its
   bottom sliver still under a "lip" that is the card's bottom band
   painted again above the logo. Off under reduced motion. On touch the
   sticky tap-hover does the job; the phone stack drops the logo.

   ----------------------------------------------- */

/* The list needs the 1120px shell, not the page's 900px wide width: the
   date, title, logo lane and chip do not fit in 900 without the title
   wrapping every other row. The block stays alignwide, so core keeps
   centring it and core-base's mobile gutter still applies; only the cap
   is raised. Three classes because core's `.wp-container-* > .alignwide`
   rule is (0,2,0) and prints later. (Not alignfull: core-mobile-nav.css
   bleeds every alignfull in post content to 100vw below 768px.) */
.wp-block-group.valencia-press-rows.alignwide {
  max-width: var(--wp--custom--shell);
  /* Overhang room so the first and last cards can tilt without meeting
     whatever sits above or below the list. */
  padding-block: var(--wp--preset--spacing--md);
}

/* The hover pill (::before below) is 103% of its row, so between the
   mobile breakpoint and the 1120px shell -- where the list already spans
   the viewport -- the resting pills poke 1.5% past each edge. Invisible
   (opacity 0), but a positioned box still widens the page: 23px of
   horizontal scroll at 900px, which the CSS guard's overflow check caught.
   Clip on main, not the list: at the viewport edge nothing shows anyway,
   and clipping the list itself would shear the pill's overhang and shadow
   at every width. Inline axis only; main's block axis must stay visible
   for the reveal-footer curtain. `clip` is not a scroll container. */
.valencia-content {
  overflow-x: clip;
}

/* Row: the positioning context for card, lip and logo. isolation keeps
   the z-order below local to the row. */
.wp-block-group.valencia-press-row {
  --angle: -1deg;
  --tile-lane: 220px;
  /* Fixed chip track (SPEAKER is the widest at ~78px) so the lane's
     centre, which the tile and lip are measured from, is exact. */
  --chip-track: 5.5rem;
  position: relative;
  isolation: isolate;
}
.wp-block-group.valencia-press-row:nth-child(even) { --angle: 1deg; }
.wp-block-group.valencia-press-row + .valencia-press-row .valencia-press-row-inner {
  border-top: 1px solid var(--wp--custom--hairline);
}

/* Text row. Grid: date | title+outlet | logo lane | chip. The lane is an
   empty track, so the rising logo never lands on the title; long titles
   wrap in their own column. Cancel the root blockGap between the rows'
   children: the grid gap governs here. */
.wp-block-group.valencia-press-row-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) var(--tile-lane) var(--chip-track);
  column-gap: var(--wp--preset--spacing--md);
  align-items: center;
  /* 3/4 of lg: the rows read as one list rather than a stack of
     panels (2026-10-06). Still room for the hover card's tilt. */
  padding: calc(var(--wp--preset--spacing--lg) * .75) var(--wp--preset--spacing--sm);
  /* The text does NOT tilt with the card (the source's does). Rotated
     text loses subpixel antialiasing and reads blurry, worst on a
     non-retina display; the card, the logo and the chip carry the
     motion and the type stays crisp. */
}
.wp-block-group.valencia-press-row-inner > * { margin-block: 0; }
.valencia-press-row-chip { grid-column: 4; }

/* Title link: the heading is the link, so it stays a heading for the
   outline and a link for the cursor. No underline at rest; theme.json's
   global link underline is beaten at :where() specificity, not with
   !important (the Rule 10 idiom). */
/* 500: the site's heading weight (blog lede, cards, archive). The
   global heading style is 600. */
.valencia-press-row-title { line-height: 1.2; text-wrap: balance; font-weight: 500; }
/* Dates read like the blog archive's: caption size and ink-deep come from
   block attributes; the small caps treatment lives here. */
.valencia-press-row-date { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
/* (0,1,1), same as core-single-post's accent-underline rule; this sheet
   prints after it (structural sheets are dependencies), so it wins. */
.valencia-press-row-title a,
.valencia-press-row-chip a {
  text-decoration: none;
  border-bottom: none;
  color: inherit;
}
/* Title and outlet sit tight: the text group's flow gap (root blockGap
   between its two children) is cancelled and the outlet gets one xs step. */
.wp-block-group.valencia-press-row-text > * { margin-block: 0; }
.wp-block-group.valencia-press-row-text > .valencia-press-row-outlet { margin-top: var(--wp--preset--spacing--xs); }

/* Chip. Background and type are block attributes; only the pill shape
   and tracking live here. */
.valencia-press-row-chip {
  justify-self: end;
  padding: .45em .9em;
  border-radius: 2em;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The card. Invisible at rest. Slightly wider than the row so its ends
   clear the text when it tilts; 4px corners, a sheet not a pill. */
.wp-block-group.valencia-press-row::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 103%;
  height: 80%;
  border-radius: 4px;
  background: var(--wp--custom--press-pill);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.02) rotate(0);
  transition:
    transform .45s cubic-bezier(.34, 1.4, .64, 1),
    opacity .2s ease;
}

/* The lip: the card's bottom band drawn again above the logo (z 3), so
   the logo's bottom sliver disappears behind it. Same box, radius, tilt
   and fade as the card; clip-path keeps only the bottom fifth and only
   the width under the lane, and clip applies before transform so it
   tracks the tilt. From the card's right edge: its 1.5% overhang, the
   widest chip (SPEAKER, ~78px), the column gap. */
.wp-block-group.valencia-press-row::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 50%; left: 50%;
  width: 103%;
  height: 80%;
  border-radius: 4px;
  background: var(--wp--custom--press-pill);
  clip-path: inset(78% calc(1.5% + var(--chip-track)) 0 calc(98.5% - var(--chip-track) - var(--tile-lane) - 32px));
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.02) rotate(0);
  transition:
    transform .45s cubic-bezier(.34, 1.4, .64, 1),
    opacity .2s ease;
}

/* Logo tile. Above the text (z 2). At rest it sits low inside the
   card's footprint, invisible with it. On hover it fades in and rises,
   level, and stops with its bottom sliver under the lip. Taller than
   the card so its top clears the card's upper edge. Centred on the lane:
   row padding, chip, gap, half the lane, measured from the right. */
.wp-block-image.valencia-press-row-logo {
  position: absolute;
  z-index: 2;
  bottom: calc(10% + 14px);
  right: calc(var(--wp--preset--spacing--sm) + var(--chip-track) + var(--wp--preset--spacing--md) + var(--tile-lane) / 2);
  width: 200px;
  height: 116px;
  margin: 0;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
  box-sizing: border-box;
  background: var(--wp--preset--color--surface);
  border: 1px solid var(--wp--custom--hairline);
  border-radius: 8px;
  /* Tight shadow: a long one darkens the card under the tile, and the
     flat-coloured lip then shows as a lighter rectangle over it. */
  box-shadow: 0 1px 3px rgba(0, 0, 0, .10);
  pointer-events: none;
  opacity: 0;
  transform: translate(50%, 40%);
  transition:
    transform .45s cubic-bezier(.34, 1.4, .64, 1),
    opacity .2s ease;
}
.wp-block-image.valencia-press-row-logo img {
  max-width: 150px;
  max-height: 76px;
  width: auto;
  height: auto;
}

/* Every width, not only desktop: iOS and Android apply :hover on the
   first tap and keep it until the next, so a tap on the row's date or
   white space shows the card; a tap on the title still follows the link. */
@media (prefers-reduced-motion: no-preference) {
  .wp-block-group.valencia-press-row:hover::before,
  .wp-block-group.valencia-press-row:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(var(--angle));
  }
  .wp-block-group.valencia-press-row:hover .valencia-press-row-logo {
    opacity: 1;
    transform: translate(50%, 0);
  }
  /* Hairlines under and over a tilted card would cut across it. */
  .wp-block-group.valencia-press-row:hover + .valencia-press-row .valencia-press-row-inner,
  .wp-block-group.valencia-press-row:hover .valencia-press-row-inner { border-top-color: transparent; }
}
.wp-block-group.valencia-press-row:hover .valencia-press-row-title { color: var(--wp--preset--color--ink-deep); }
.valencia-press-row-title a:focus-visible {
  outline: 2px solid var(--wp--preset--color--ink-deep);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Below 992px the source opts out of the effect. We keep it: the hover
   rules above are not width-gated, so a tap lights the row on touch.
   Two layout steps down from desktop. */

/* Tablet, 768–991: still one line per row. Date, title, a narrower logo
   lane, chip on the right. */
@media (max-width: 991px) {
  .wp-block-group.valencia-press-row {
    --tile-lane: 160px;
  }
  .wp-block-group.valencia-press-row-inner {
    grid-template-columns: 6rem minmax(0, 1fr) var(--tile-lane) var(--chip-track);
    /* Desktop's lg block padding is room for the card to tilt in; with
       no hover card, the rows sit at sm. */
    padding: var(--wp--preset--spacing--sm) 0;
  }
  .wp-block-image.valencia-press-row-logo {
    width: 150px;
    height: 88px;
    bottom: calc(10% + 10px);
    right: calc(var(--chip-track) + var(--wp--preset--spacing--md) + var(--tile-lane) / 2);
  }
  .wp-block-image.valencia-press-row-logo img { max-width: 112px; max-height: 56px; }
  .wp-block-group.valencia-press-row::after {
    clip-path: inset(78% calc(1.5% + var(--chip-track)) 0 calc(98.5% - var(--chip-track) - var(--tile-lane) - 32px));
  }
}

/* Phone, under 768: title first, then date and chip on one line. */
@media (max-width: 767px) {
  .wp-block-image.valencia-press-row-logo,
  .wp-block-group.valencia-press-row::after { display: none; }
  .wp-block-group.valencia-press-row-inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "text text"
      "date chip";
    row-gap: var(--wp--preset--spacing--xs);
    /* Room inside the card: it is a stacked block here, not a strip, so
       the text needs a margin from the card's edge on all four sides. */
    padding: var(--wp--preset--spacing--md) var(--wp--preset--spacing--sm);
  }
  .wp-block-group.valencia-press-row::before {
    width: 100%;
    height: calc(100% - var(--wp--preset--spacing--sm));
  }
  .valencia-press-row-text { grid-area: text; }
  .valencia-press-row-date { grid-area: date; }
  .valencia-press-row-chip { grid-area: chip; grid-column: auto; justify-self: start; }
  .valencia-press-row-title { font-size: var(--wp--preset--font-size--medium); }
}

/* Page intro (same deck as Notes and Now), placed as the list's first child
   so it shares the list's width, then indented to start where the row
   dates start (the row's inline padding), per breakpoint. */
.valencia-press-rows > .valencia-press-intro {
  padding-inline-start: var(--wp--preset--spacing--sm);
  padding-block-end: var(--wp--preset--spacing--md);
}
@media (max-width: 991px) {
  .valencia-press-rows > .valencia-press-intro {
    padding-inline-start: 0;
  }
}
@media (max-width: 767px) {
  .valencia-press-rows > .valencia-press-intro {
    padding-inline-start: var(--wp--preset--spacing--sm);
  }
}

/* Editor canvas: the logo is hidden until hover on the frontend, which
   would make it uneditable here. Show it parked in its lane, level, at
   rest, so it can be selected and swapped. */
.editor-styles-wrapper .wp-block-image.valencia-press-row-logo {
  opacity: 1;
  transform: translate(50%, 0);
  pointer-events: auto;
}
