/* ---------- Grid module ----------
   _includes/modules/grid.njk + js/grid.js. A horizontally scrolling wall of
   thumbnails fills the whole section and slides underneath a narrow info
   side-panel floating on the right. Clicking a thumbnail opens the "stage":
   the video plays centered in the viewer area (everything left of the panel).
   Shared pieces (.page-info, tabs, drawer-mode) live in style.css. */

.grid-page {
  position: relative;
  overflow: hidden;
  /* --panel-w (the side panel's width) is on :root in style.css, shared
     with the menu. How much of the section's right side the panel covers -- the wall's
     end padding, the right-hand nav button and the stage all key off it.
     Zero in drawer-mode, where the panel is a bottom sheet instead. */
  --panel-occ: var(--panel-w);
  --grid-pad: clamp(24px, 4vw, 64px);
  --grid-gap: 12px; /* read by grid.js for its row math */
}

.grid-page.drawer-mode {
  --panel-occ: 0px;
}

/* ---------- Thumbnail wall ---------- */

.video-grid {
  position: absolute;
  inset: 0;
  background: var(--wall-bg); /* style.css .page */
}

.video-grid-track {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  /* Sideways trackpad swipes past either end shouldn't trigger the
     browser's back/forward gesture. */
  overscroll-behavior-x: contain;
  padding-block: clamp(32px, 8svh, 88px);
  cursor: grab;
}

.video-grid-track.is-dragging {
  cursor: grabbing;
}

.grid-page.drawer-mode .video-grid-track {
  /* Clear the hamburger above and the drawer's peek strip below. */
  padding-top: 80px;
  padding-bottom: calc(var(--drawer-peek) + 24px);
}

/* Padding lives on this inner (non-scrolling) box rather than the track,
   so the end padding reliably counts toward the scroll width -- lets the
   last column scroll fully out from behind the side-panel. */
.video-grid-rows {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
  padding-left: var(--grid-pad);
  padding-right: calc(var(--panel-occ) + var(--grid-pad));
  /* Centers a short wall in the viewer area; auto margins collapse to 0
     once it overflows, so a long wall still starts flush left. */
  margin-inline: auto;
}

.video-grid-row {
  display: flex;
  gap: var(--grid-gap);
}

/* Width/height are set inline by grid.js (row height x video aspect). */
.grid-tile {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  background: #111;
  border-radius: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  filter: saturate(0.92) brightness(0.86);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
    filter 0.35s ease, box-shadow 0.35s ease;
}

.grid-tile:hover,
.grid-tile:focus-visible,
.grid-tile.is-current {
  transform: scale(1.035);
  filter: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.grid-tile:focus-visible,
.grid-tile.is-current {
  outline: 2px solid var(--text-color);
  outline-offset: 3px;
}

.video-grid-track.is-dragging .grid-tile {
  transform: none;
}

.grid-tile-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

/* Same glossy sheen as .carousel-item. */
.grid-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.06) 20%,
    rgba(255, 255, 255, 0) 45%,
    rgba(255, 255, 255, 0) 70%,
    rgba(255, 255, 255, 0.1) 100%
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

.grid-tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 32px 10px 8px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-color);
  text-align: left;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.grid-tile:hover .grid-tile-caption,
.grid-tile:focus-visible .grid-tile-caption {
  opacity: 1;
  transform: none;
}

.grid-tile-duration {
  flex-shrink: 0;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

@media (hover: none) {
  .grid-tile-caption {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Side-panel ---------- */

.grid-page .page-info {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--panel-w);
  min-width: 0;
  z-index: 3;
  justify-content: flex-start;
  gap: 10px;
  /* Content starts at the top. The top band (the menu bar's row, plus a
     hair) is kept clear for the fixed hamburger in this corner. */
  padding: calc(var(--menu-row) + 4px) 32px 48px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.35);
}

/* Panel glass: the side panel's dark, blurred see-through fill, for
   anything that should read as part of the panel (the side panel itself,
   the private-video password block). The tint follows the page's own
   background (--page-bg). */
.grid-page .page-info,
.panel-glass {
  background: color-mix(in srgb, color-mix(in srgb, var(--page-bg), white var(--panel-lift)) 62%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}

.grid-page .page-info::before {
  content: none;
}

/* Short screens (js/screens.js): the panel keeps its side, with less
   padding below (the top band shrinks with --menu-row). */
.screen-short .grid-page .page-info {
  padding-bottom: 24px;
}

/* Bottom-sheet overrides on top of the shared drawer-mode rules in
   style.css, undoing the side-panel bits that don't apply there. */
.grid-page.drawer-mode .page-info {
  top: auto;
  /* Over the open stage (5) too, so an item's tags and write-up can be
     read beside it; only the menu and the drawer button sit higher. */
  z-index: 6;
  border-left: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- Stage (player) ---------- */

.grid-stage {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: var(--panel-occ);
  /* The viewer area, as a size container: the box below sizes its margins
     from the viewer's shape (cq units). */
  container-type: size;
  z-index: 5; /* over the wall and its nav; under the drawer (6) */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.grid-stage.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.grid-stage-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* The box the media sits in. Its margins follow the viewer's shape: full
   (64px top and bottom, 96px at the sides, clear of the panes) on a wide
   viewer, closing to nothing as the viewer nears square, so on a square
   or taller viewer the media takes all the room it can, behind the panes
   -- like the photo slideshow. The margin is a quarter of how much wider
   than tall the viewer is (stage cq units), capped. Registered properties
   (below), so they're worked out here, against the stage, and the strip
   inherits them as lengths (--strip-bleed).
   Also a size container, so the frame and slides fit themselves inside it
   with cq units. */
@property --stage-x {
  syntax: '<length>';
  inherits: true;
  initial-value: 96px;
}

@property --stage-y {
  syntax: '<length>';
  inherits: true;
  initial-value: 64px;
}

.grid-stage-box {
  --stage-x: min(96px, max(0px, 100cqw - 100cqh) / 4);
  --stage-y: min(64px, max(0px, 100cqw - 100cqh) / 4);
  position: absolute;
  inset: var(--stage-y) var(--stage-x);
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-stage-frame {
  position: relative;
  aspect-ratio: var(--ar, 0.5625);
  width: min(100cqw, 100cqh * var(--ar, 0.5625));
  background: #000;
  box-shadow: var(--media-shadow);
  transform: scale(0.96);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.grid-stage.is-open .grid-stage-frame {
  transform: none;
}

.grid-stage-poster,
.grid-stage-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

.grid-stage-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  z-index: 1; /* above the full-height prev pane */
}

.grid-stage-close::before,
.grid-stage-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.grid-stage-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.grid-stage-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Edge panes (.edge-pane): the one prev/next side button, used by the
   stage (.grid-stage-step), the wall's paging (.grid-nav), the photo
   slideshow (.slideshow-step) and the parked carousel (.carousel-nav). A
   dark inner shadow on its outer edge (.prev / .next), darkest at the edge
   and fully transparent toward the centre, with a white chevron; it deepens
   on hover and press. No blur, so whatever passes under it stays sharp.
   Each user only places and sizes its own panes. */
.edge-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  --shade: 0.45;
  transition: opacity 0.25s ease, --shade 0.25s ease;
}

.edge-pane::before {
  content: '';
  width: 18px;
  height: 18px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
}

.edge-pane.prev {
  background: linear-gradient(to right, rgba(0, 0, 0, var(--shade)), rgba(0, 0, 0, 0));
}

.edge-pane.prev::before {
  transform: translateX(4px) rotate(-45deg);
}

.edge-pane.next {
  background: linear-gradient(to left, rgba(0, 0, 0, var(--shade)), rgba(0, 0, 0, 0));
}

.edge-pane.next::before {
  transform: translateX(-4px) rotate(135deg);
}

.edge-pane:hover {
  --shade: 0.62;
}

.edge-pane:active {
  --shade: 0.75;
}

.edge-pane:disabled {
  opacity: 0;
  pointer-events: none;
}

/* Animates the shade on hover / press. */
@property --shade {
  syntax: '<number>';
  inherits: false;
  initial-value: 0.45;
}

/* Stage, wall and slideshow panes: full height at the section's edges. */
.grid-stage-step,
.grid-nav,
.slideshow-step {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--pane-w, 96px);
}

.grid-stage-step.prev,
.grid-nav.prev,
.slideshow-step.prev {
  left: 0;
}

.grid-stage-step.next,
.grid-nav.next,
.slideshow-step.next {
  right: 0;
}

/* Drawer-mode: the stage ends above the drawer's peek strip, so the
   drawer never covers the slide while closed. */
.grid-page.drawer-mode .grid-stage {
  bottom: var(--drawer-peek);
}

.grid-page.drawer-mode .grid-stage-box {
  inset: 0; /* edge to edge; the stage already clears the peek strip */
}


/* Wall nav: sized to the wall's edge padding; the right one sits against
   the side-panel. Hidden (disabled by grid.js) whenever the wall can't
   scroll that way. */
.grid-nav {
  z-index: 2;
  width: max(56px, var(--grid-pad));
}

.grid-nav.next {
  right: var(--panel-occ);
}

@media (hover: none) {
  .grid-nav {
    display: none;
  }
}

/* ---------- Tag menu / now playing (side-panel, built by grid.js) ---------- */

/* Shrinks and scrolls before the title does; the article tabs below it
   share the leftover height (both are min-height: 0 flex items). */
/* Page description under the subheading (`blurb`, page-info.njk). */
.page-blurb {
  flex-shrink: 0;
}

.grid-info {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0 16px;
}

/* In the drawer the body starts flush under the title strip. */
.grid-page.drawer-mode .grid-info {
  padding-top: 0;
}

/* Tag clouds: one line pitch throughout -- a pill (~25px) plus --tag-gap,
   the same gap whether a line wraps inside a label group or starts the
   next group, so groups don't read as separate paragraphs. */
.grid-tags {
  --tag-gap: var(--pill-gap);
  display: flex;
  flex-direction: column;
  gap: var(--tag-gap);
}

/* One left-justified line of pills per label, wrapping like a paragraph:
   the label as a solid pill (.grid-tag-label, the one label pill), then its
   values as outlined bubbles with counts. */
.grid-tag-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tag-gap, var(--pill-gap));
}

/* The one pill: every pill on the site -- label pills, tags, sort buttons,
   links -- is this box, so they're all one size (~19px tall on desktop:
   12px text at 1.4, a 1px outline, no vertical padding). What differs is only the fill
   (solid / outlined / active) below. Its size is the --pill-* properties,
   set once on :root (style.css): compact screens raise it to a 44px touch
   target. */
.grid-tag,
.grid-tag-label {
  font-family: var(--font-body);
  font-size: var(--pill-font);
  line-height: var(--pill-line);
  min-width: var(--pill-min);
  text-align: center;
  justify-content: center;
  padding: 0 var(--pill-pad);
  border-radius: 999px;
  border: 1px solid transparent;
}

.grid-tag-label {
  display: inline-block;
}

/* Solid pills: the one reversed fill, for the label pill (names a row)
   and for tags that act as buttons or descriptors rather than values
   (.grid-tag.is-solid: the microdrama sort buttons and links). A solid
   tag still inverts when it's .is-active (black, below). */
.grid-tag-label,
.grid-tag.is-solid:not(.is-active) {
  background: var(--text-color);
  border-color: var(--text-color);
  color: var(--page-bg);
}

.grid-tag-label,
.grid-tag.is-solid {
  font-weight: 700;
}

.grid-tag.is-solid:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.8);
}

/* Values flow in the same line as the label pill. */
.grid-tag-values {
  display: contents;
}

.grid-tag {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-color);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Touch target: the tappable box reaches half the gap past every edge, so
   neighbouring pills' targets meet flush in the middle of the gap, never
   overlapping (24px pill + 8px gap = a 32px target on compact screens). */
.grid-tag::after {
  content: '';
  position: absolute;
  inset: calc(var(--pill-gap) / -2);
}

.grid-tag:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Value carried by the hovered thumbnail. */
.grid-tag.is-hit {
  border-color: rgba(255, 255, 255, 0.75);
}

/* The active pill (a filter -- click it again to clear -- or a sort button):
   inverted, black with white text, whether it was outlined or solid. The
   border keeps the fill's colour, so the pill stays the one pill size. */
.grid-tag.is-active {
  background: #000;
  border-color: #000;
  color: #fff;
}

.grid-tag.is-active:hover {
  background: #1c1c1c;
  border-color: #1c1c1c;
}

.grid-tag-count {
  font-size: calc(var(--pill-font) - 1px);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.grid-tag.is-active .grid-tag-count {
  opacity: 0.8;
}

/* ---------- Sort buttons (wall.js sortButton) ----------
   Every panel's sort control: a menu row's head (Audio/Video, Photos) or a
   Microdramas sort row. A solid tag (.is-solid) at the one pill size, with a
   direction arrow -- dimmed until it's the active sort. */
.grid-sort {
  align-items: center;
}

.grid-sort-arrow {
  width: 9px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.grid-sort:not(.is-active) .grid-sort-arrow {
  opacity: 0.4;
}

/* ---------- Tag pairs: a label pill + its value ----------
   The one label/value pattern: carousel metadata (page-info.njk) and the
   microdrama readout (js/microdramas.js).
     <div class="tag-pairs">
       <div class="tag-pair"><span class="grid-tag-label">Cast</span>
         <span class="tag-pair-value">...</span></div>
     </div>
   Pairs flow one after another and wrap, like the wall's tiles: a pair
   moves to the next line whole when it doesn't fit, and only a pair wider
   than its box wraps inside itself, under its pill like a paragraph. Every
   line is one pitch (--tag-pair-line: the pill's height + the tag clouds'
   gap), wrapped or not. */
.tag-pairs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 16px; /* line spacing comes from --tag-pair-line alone */
}

.tag-pair {
  --tag-pair-line: calc(var(--pill-h) + var(--pill-gap));
  max-width: 100%;
  line-height: var(--tag-pair-line);
}

.tag-pair .grid-tag-label {
  margin-right: 2px;
}

.tag-pair-value {
  font-family: var(--font-body);
  font-size: 14px;
}

/* An aside after a value, e.g. "(highest of any video)" in a video's stats. */
.tag-pair-note {
  opacity: 0.6;
}

/* A list value's entries (e.g. cast names) never split across lines. */
.keep-together {
  white-space: nowrap;
}

.grid-now {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* H3: the item on stage, a microdrama's title, an item's description
   header. Coded below the page's h2 (.subheading), but visually the step
   right under the site title: it sits further down the panel, after the
   tag controls. */
.grid-now-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
}

.video-grid-empty {
  padding-left: var(--grid-pad);
  font-family: var(--font-body);
  color: var(--text-color);
  opacity: 0.6;
}

/* Per-video description (grid.js descriptionView, and the editor's
   preview of it): header as an h3 in .grid-now-title, body after .tab-pane. */
/* A panel block set off from what's above it: a hairline and 14px. */
.grid-divided {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.grid-desc {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Database descriptions are plain text: a single line break stays one. */
.grid-desc .prose > p {
  white-space: pre-line;
}

/* ---------- Microdramas panel (js/microdramas.js) ---------- */

.md-leave {
  width: 9px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Static pills: the tag look without the button behaviour. */
.md-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pill-gap);
}

/* Links are solid tags (.is-solid) with the leave-the-site arrow. */
.md-link {
  align-items: center;
  text-decoration: none;
}

/* Topline totals after the Views / Follows sort buttons. Line height 1
   keeps the 16px number from making its row taller than a pill row. */
.md-total {
  margin-left: 4px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ---------- Form fields: the one field style ----------
   Every form on the site uses these: the About page's contact form
   (_includes/partials/contact-form.njk) and the local editor
   (editor/editor.js -- its own selectors are listed alongside, since
   editor/editor.css never ships). Restyle fields here, once.
     .form-field   an input with its problem (.form-error) under it; the
                   box is cued by its gray placeholder, its <label> kept
                   for screen readers only (.visually-hidden)
     .field-input  text inputs, selects, textareas; .is-optional = an
                   optional box, with a dimmer placeholder
     .form-check   a checkbox with its text
     .form-error   a field's problem, under it
     .form-status  the form's outcome line (.is-error for a failure)
     .form-submit  a form's send button: the standard solid pill
                   (.grid-tag.is-solid), placed
     .form-button  the editor's action buttons */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Hidden on screen, still read out by screen readers (e.g. a field's
   <label> when its placeholder does the visual cueing). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.field-input,
.ed input,
.ed select,
.ed textarea.ed-desc-body {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 0;
}

textarea.field-input,
.ed textarea.ed-desc-body {
  line-height: 1.5;
  padding: 8px;
  min-height: 120px;
  resize: vertical;
}

.field-input::placeholder,
.ed input::placeholder,
.ed textarea.ed-desc-body::placeholder {
  color: var(--text-color);
  opacity: 0.4;
}

/* Optional boxes: a dimmer cue. */
.field-input.is-optional::placeholder {
  opacity: 0.25;
}

.field-input:focus,
.ed input:focus,
.ed textarea.ed-desc-body:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

.field-input[aria-invalid='true'] {
  border-color: #ff8a80;
}

select.field-input option,
.ed select option {
  color: #111;
}

.form-error {
  font-family: var(--font-body);
  font-size: 12px;
  color: #ff8a80;
}

.form-status,
.ed-status {
  font-family: var(--font-body);
  font-size: 12px;
  opacity: 0.6;
  min-height: 1.3em;
}

.form-status.is-error,
.ed-status.is-error {
  color: #ff8a80;
  opacity: 1;
}

/* A line under a form (the contact form's "Or email ..."): dimmed, its
   link at full strength. */
.form-note {
  opacity: 0.6;
}

.form-note a {
  color: var(--text-color);
}

.form-button,
.ed-new-add,
.ed-hide {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
  transition: background 0.2s ease;
}

.form-button:hover,
.ed-new-add:hover,
.ed-hide:hover {
  background: rgba(255, 255, 255, 0.1);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
}

/* Drawn to match the fields (the site resets form controls with
   appearance: none, css/style.css): the field fill and outline, solid with
   a check mark when ticked. */
.form-check input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  background: rgba(255, 255, 255, 0.06) center / 11px no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.form-check input:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.form-check input:focus-visible {
  outline: 2px solid var(--text-color);
  outline-offset: 2px;
}

.form-check input:checked {
  background-color: var(--text-color);
  border-color: var(--text-color);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='%23121212' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-submit {
  align-self: flex-start;
  cursor: pointer;
}

.form-submit:disabled {
  opacity: 0.4;
  cursor: progress;
}

/* The bot trap: off-screen, out of the tab order, ignored by screen readers. */
.form-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The contact form in a side panel scrolls on its own if it runs long. */
.page-form {
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 8px;
}

/* ---------- Tile badges ----------
   A tile's corner icon, telling what's behind it: .is-play (the item has
   sample videos, wall.js `playable`; on the stage they follow its poster
   in the strip, below) or .is-stats (the item has a stats readout,
   meta.stats). Built in one place in wall.js:
     <span class="grid-tile-badges"><span class="grid-tile-badge is-play"></span></span>
   The holder places them in the upper right corner and draws the corner
   glow once; .grid-tile-badge is the one look (size, translucent white,
   drawn as a mask); a modifier only picks the icon. Each icon's drawing
   carries its own padding so they read at the same weight (solid bars
   look heavier than a triangle). New badge = one modifier + one line in
   wall.js. Size follows the wall's row height (--row-h, set by wall.js),
   within limits, so it reads the same on short and tall walls. */
.grid-tile-badges {
  --badge: clamp(20px, calc(var(--row-h, 260px) * 0.12), 32px);
  --badge-inset: calc(var(--badge) * 0.5);
  position: absolute;
  top: var(--badge-inset);
  right: var(--badge-inset);
  z-index: 1; /* over the sheen (::after) */
  display: flex;
  gap: calc(var(--badge) * 0.3);
  pointer-events: none;
}

/* A soft shadow in the tile's corner behind the badges: 80% black at the
   corner, fading out. Drawn from the tile's corner and kept under the
   icons (z-index -1 inside the holder's own stacking context); the tile's
   overflow clips it. */
.grid-tile-badges::after {
  content: '';
  position: absolute;
  top: calc(var(--badge-inset) * -1);
  right: calc(var(--badge-inset) * -1);
  z-index: -1;
  width: calc(var(--badge) * 4.3);
  height: calc(var(--badge) * 4.3);
  background: radial-gradient(circle at top right, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0) 70%);
}

/* A bare translucent white icon (no backing), cut out by --icon. */
.grid-tile-badge {
  width: var(--badge);
  height: var(--badge);
  background: rgba(255, 255, 255, 0.92);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* Play: a triangle, nudged right of center so it looks centered. */
.grid-tile-badge.is-play {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpolygon points='4,0 29,15 4,30'/%3E%3C/svg%3E");
}

/* Stats: three rising bars, inset 2 so their solid mass matches the triangle. */
.grid-tile-badge.is-stats {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Crect x='2' y='17' width='7' height='11'/%3E%3Crect x='11.5' y='10' width='7' height='18'/%3E%3Crect x='21' y='2' width='7' height='26'/%3E%3C/svg%3E");
}

/* ---------- Stage strip (js/strip.js) ----------
   Walls with `slides` (Microdramas, Audio/Video): the stage is one long
   carousel. The frame gives it the whole box and hides the poster. */
.grid-stage-frame.has-strip {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  background: none;
  box-shadow: none;
}

.grid-stage-frame.has-strip .grid-stage-poster {
  display: none;
}

/* The strip reaches past the box's side margins to the stage's edges
   (--strip-bleed, the box's own inset), so side slides run under the glass
   panes and off the window instead of stopping short. With a side panel it
   also runs on under it (--panel-occ), so a neighbour overhanging the
   viewer shows on, blurred, through the panel's glass. */
.strip {
  --strip-gap: 24px;
  --strip-bleed: var(--stage-x); /* the box's side margin */
  /* Slide size limits (box cq units): on a wide box a little short of its
     height and at most 78% of its width; both open up to the whole box as
     it nears square (same slack rule as the box's margins). */
  --strip-max-w: calc(100cqw - min(22cqw, max(0px, 100cqw - 100cqh) / 2));
  --strip-h: calc(100cqh - min(10cqh, max(0px, 100cqw - 100cqh) / 4));
  position: absolute;
  inset: 0 calc(-1 * (var(--strip-bleed) + var(--panel-occ))) 0 calc(-1 * var(--strip-bleed));
}

/* For that the stage sits at the panel's own layer (3; the panel comes
   later in the page, so it paints on top) -- still above the wall and its
   nav (2). In drawer-mode the drawer stays over the stage (6 over 5). */
.grid-page:not(.drawer-mode) .grid-stage:has(.has-strip) {
  z-index: 3;
}

/* Drawer-mode (compact screens): the active slide goes edge to edge --
   the screen's full width, or the stage's full height (it already stops
   at the drawer's peek strip), whichever comes first. The hamburger, the
   close button and the side panes lie over it; the drawer stays clear. */
.grid-page.drawer-mode .strip {
  --strip-bleed: 0px;
  --strip-gap: 12px;
  --strip-max-w: 100cqw;
  --strip-h: 100cqh;
}

/* "The middle" is the middle of the visible viewer, left of the panel.
   Half a viewer of padding each end lets the first and last slides reach
   it, whatever their width; scroll-padding keeps snapping to it
   (js/strip.js reads the same scroll-padding). */
.strip-track {
  --strip-view: calc(100% - var(--panel-occ));
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--strip-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-right: var(--panel-occ);
  padding-left: calc(var(--strip-view) / 2);
  padding-right: calc(var(--strip-view) / 2 + var(--panel-occ));
  overscroll-behavior-x: contain;
}

/* Snapping would fight drag-scroll (Bunny.enableDragScroll) and the
   strip's own stepping. */
.strip-track.is-dragging,
.strip-track.is-stepping {
  scroll-snap-type: none;
}

.strip-track.is-dragging {
  cursor: grabbing;
}

/* Each slide at its own aspect ratio (--ar, set per slide): --strip-h
   tall, unless that would make it wider than --strip-max-w. The
   box (.grid-stage-box) is a size container, hence cq units. Side slides
   stay solid and sit back behind a dark overlay. */
.strip-slide {
  position: relative;
  flex: 0 0 auto;
  width: min(calc(var(--strip-h) * var(--ar)), var(--strip-max-w));
  aspect-ratio: var(--ar);
  background: #000;
  box-shadow: var(--media-shadow);
  scroll-snap-align: center;
  cursor: pointer;
  transform: scale(0.86);
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.strip-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.strip-slide.is-active {
  transform: none;
  cursor: default;
}

.strip-slide.is-active::after {
  opacity: 0;
}

/* Only the active slide and its direct neighbours (.is-near) show; slides
   further out would peek in as slivers at the stage's edges. */
.strip-slide:not(.is-active):not(.is-near) {
  visibility: hidden;
}

/* The slide's picture or player (img, video, Bunny's iframe). Side slides
   don't take clicks -- the click goes to the slide, which centers it. */
.strip-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  pointer-events: none;
}

.strip-slide.is-active .strip-media {
  pointer-events: auto;
}

/* Private slides (Strip.privateSlide, js/access.js): until unlocked, the
   item's picture as it is, and on the active slide a
   password box (the shared form fields) with Unlock and a Contact link
   under it. */
.strip-lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

.strip-lock-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* The password box across, then Unlock (left) and Contact (right) under it. */
.strip-lock-form {
  position: relative;
  z-index: 2;
  width: min(84%, 260px);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 8px;
}

.strip-lock-form .field-input {
  grid-column: 1 / -1;
}

.strip-lock-form .form-submit {
  align-self: center;
  justify-self: start;
}

.strip-lock-contact {
  justify-self: end;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-color);
  text-decoration: underline;
}

.strip-lock-form .form-status {
  grid-column: 1 / -1;
}

/* No message yet: no reserved line, so the box ends at its buttons. */
.strip-lock-form .form-status:empty {
  display: none;
}

.strip-slide:not(.is-active) .strip-lock-form {
  display: none;
}

/* "Lock again" in the panel, for a private item once unlocked. */
.access-lock {
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 12px;
  text-decoration: underline;
  opacity: 0.6;
  cursor: pointer;
}

.access-lock:hover {
  opacity: 1;
}

/* ---------- About module (_includes/modules/about.njk) ----------
   Portrait + paragraph, centered in the viewer area: the section minus the
   side panel (--panel-occ, 0 in drawer-mode). The viewer area is a size
   container, so the layout answers to the room it actually has (screen
   minus panel), not to the screen: side by side when there's room, the
   portrait stacked over the text when there isn't (below), and it scrolls
   if the stack runs taller than the screen. */

.about {
  position: absolute;
  inset: 0;
  right: var(--panel-occ);
  container: about / size;
  overflow-y: auto;
  background: color-mix(in srgb, var(--page-bg) 85%, black);
  color: var(--text-color);
}

.about-body {
  min-height: 100%; /* centered when it fits; grows (and scrolls) when not */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(32px, 8svh, 88px) var(--grid-pad);
}

.about-portrait {
  flex: 0 1 auto;
  height: min(62svh, 560px);
  width: auto;
  max-width: 45%;
  object-fit: cover;
  border-radius: 4px;
}

/* Text: the shared .prose module (style.css); this just sizes it here. */
.about-intro {
  flex: 0 1 40rem; /* room for the jobs table's three columns */
  min-width: 0;
}

/* Focus areas per job (_includes/partials/jobs-table.njk): one block per
   job, side by side, each a name/years header over a tight skills list.
   Each block spans two grid rows and shares them (subgrid): headers sit
   bottom-aligned on a common baseline in the first, lists all start at
   the top of the second. A long name just grows upward. */
.jobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  grid-auto-rows: auto;
  column-gap: 16px;
  /* Jobs that wrap onto a new row sit one standard space below the row
     above: 1em, the same spacing .prose puts between its modules. Each
     job's own row-gap (.job, a subgrid) still keeps its header tight to
     its skills, so this only opens up between rows of jobs. */
  row-gap: 1em;
  /* Text size: .small-text (style.css), set in jobs-table.njk. */
}

.job {
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 6px;
}

/* Header width, measured in Montserrat 700 13px: "Opera Software" is
   ~106px and fits; "for State Senate" is ~109px and must fit too; "Jaron
   Brandon for" is ~123px and must not, so the line breaks after
   "Brandon". 8.9em (~116px) is mid-range. In em, so it scales with the
   font size. */
.job-head {
  align-self: end;
  max-width: 8.9em;
}

.job-name {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
}

.job-years {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.6;
}

.job-skills {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Stacked: the portrait over the text, once side by side would crowd.
   Side by side needs the portrait (its width follows the screen height,
   up to ~430px) plus a readable text column (~26rem) plus the gaps, so it
   stacks in a viewer area narrower than 48rem (a ~1050px-wide screen with
   the panel) or taller than it is wide (portrait-shaped windows, e.g. a
   vertical monitor). The drawer layout (phones) always lands here too. */
@container about (width < 48rem) or (aspect-ratio < 1) {
  .about-body {
    flex-direction: column;
  }

  .about-portrait {
    height: auto;
    width: min(70%, 320px);
    max-width: none;
  }

  .about-intro {
    flex: none;
    width: 100%;
    max-width: 40rem;
  }
}

/* Bottom-sheet layout: clear of the hamburger and the drawer's peek. */
.grid-page.drawer-mode .about-body {
  padding-top: 80px;
  padding-bottom: calc(var(--drawer-peek) + 24px);
}

