/* Key Notes: the blog index, the post layout and the photo gallery.
   Loaded only by pages in /key-notes/, after styles.css. Tokens and contrast pairings
   come from styles.css; nothing here introduces a new color.
   Pairings used: --text on the page ground (Aubergine on Moonlight 12.70:1, Moonlight on
   Aubergine 12.70:1), --link (Amethyst on Moonlight 6.89:1, Lilac on Aubergine 8.98:1). */

/* ---------- Shared ---------- */
.kn-meta { font-size: 1rem; margin: 0; }
.kn-meta a { color: inherit; }
.hero-band .kn-meta { color: var(--text-on-deep); }
.hero-band .kn-meta a { color: var(--link-on-deep); }

/* ---------- Index: a real list of posts, newest first ---------- */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
@media (min-width: 768px) { .post-list { grid-template-columns: repeat(2, 1fr); } }
.post-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow-1);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.post-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.post-card .post-card-body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
/* Post titles are h2s on the index (one h1 per page). Card size, not section size. */
body.editorial .post-card h2 { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.2; letter-spacing: .01em; margin: 0; }
.post-card h2 a { color: var(--text); text-decoration: none; }
/* One link per card: the title link stretches over the whole card, so the card has one accessible name. */
.post-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
/* The focus ring stays on the title link itself (never removed). */
.post-card h2 a:hover { text-decoration: underline; }
.post-card p { margin: 0; }
.post-card .kn-meta { order: -1; }

/* ---------- Post ---------- */
.post-body > .wrap > * { max-width: var(--measure); }
.post-body h2 { margin-top: var(--space-5); }
.post-body h2:first-child { margin-top: 0; }
/* Post section headings sit inside one article; the sitewide flourish stays off them. */
.post-body .wrap > h2::after { display: none; }
body.editorial .post-body h2 { font-size: clamp(1.875rem, 1.6vw + 1.1rem, 2.5rem); }

/* Lead photo and inline photos: a still image with a visible caption. */
.post-photo { margin: var(--space-4) 0; max-width: 60rem; }
.post-photo img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow-1); }
.post-photo.lead { margin-top: 0; }
.post-photo figcaption { max-width: var(--measure); }
/* Tall (portrait) photos keep their own shape, never cropped to 16:9. The class is "tall", not "portrait":
   styles.css already uses .portrait for the About page photo panel, which would frame and crop the image and hide its caption. */
.post-photo.tall { max-width: 30rem; }
.post-photo.tall img { aspect-ratio: auto; object-fit: initial; }
/* "whole" shows a landscape photo uncropped at its own shape (for example 4:3), full width. Use the file's real width and height. */
.post-photo.whole img { aspect-ratio: auto; object-fit: initial; }

/* Video block: captions are required (the track element) and a transcript link sits under it. */
.post-video { margin: var(--space-4) 0; max-width: 60rem; }
.post-video video { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--bg-deep); }
.post-video figcaption a { font-style: normal; }

/* Closing paragraph and the way back to the index */
.post-close { font-size: clamp(1.125rem, .4vw + 1rem, 1.25rem); }
.post-nav { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--card-border); }
.post-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between; }
.post-nav a { display: inline-block; min-height: 24px; padding-block: .25rem; }
.post-nav .label { display: block; font-size: .9375rem; }

/* ---------- Photo gallery ----------
   Never moves by itself. Built on native scrolling with scroll snap, so swipe works and every
   photo stays reachable with scripts off. The Previous and Next buttons and the "Photo n of N"
   status only appear once gallery.js has run (it adds .is-ready). */
.gallery { margin: var(--space-4) 0; max-width: 60rem; }
.gallery-track {
  display: flex; gap: var(--space-2);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  list-style: none; margin: 0; padding: 0 0 var(--space-1);
  border-radius: 8px;
}
.gallery-track:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.gallery-slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; margin: 0; position: relative; }
/* position: relative keeps the hidden "Photo n of N" text inside the strip, so the page never scrolls sideways. */
/* contain, not cover: a portrait photo is never cropped, so the alt text always matches what shows. */
.gallery-slide img {
  width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain;
  background: var(--card-bg-solid); border-radius: 8px;
}
.gallery-slide figcaption { max-width: var(--measure); }

.gallery-controls { display: none; }
.gallery.is-ready .gallery-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-1) var(--space-2); margin-top: var(--space-2);
}
.gallery-buttons { display: flex; gap: var(--space-1); }
.gallery-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px; min-width: 44px; padding: .5rem 1rem;
  font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--link); background: var(--panel-bg);
  border: 2px solid var(--link); border-radius: 8px; cursor: pointer;
  transition: background-color 150ms ease;
}
.gallery-btn:hover { background: var(--card-bg); }
.gallery-btn svg { width: 1.125rem; height: 1.125rem; flex: none; }
/* At either end the button stays in the tab order (aria-disabled, not disabled) and says so. */
.gallery-btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.gallery-status { margin: 0; font-size: 1rem; }

/* Narrow screens: buttons share the row; the status takes its own line. */
@media (max-width: 479px) {
  .gallery.is-ready .gallery-controls { flex-direction: column; align-items: stretch; }
  .gallery-buttons { justify-content: space-between; }
  .gallery-btn { flex: 1; justify-content: center; }
}

/* Asked for less motion: no sliding, no lift. */
@media (prefers-reduced-motion: reduce) {
  .gallery-track { scroll-behavior: auto; }
  .post-card:hover { transform: none; }
}

/* Forced colors (Windows High Contrast): keep the buttons and the focus ring visible. */
@media (forced-colors: active) {
  .gallery-btn { border-color: ButtonText; color: ButtonText; }
  .gallery-btn[aria-disabled="true"] { color: GrayText; border-color: GrayText; opacity: 1; }
}

/* ---------- Photo frame (added 2026-12-01, darker version the same day at Tara's request) ----------
   Every post photo sits in a dark frame with a Lilac Mist mat, like a framed print:
   the border is the frame (Aubergine), the padding is the mat (Lilac Mist).
   On the dark theme the frame is the deepest purple with a fine lilac edge, so it still reads against the page.
   Decorative only: no text sits on the frame or mat, and the caption stays below. */
:root { --frame-base: var(--aubergine); --frame-mat: var(--lilac); --frame-edge: transparent;
  --frame-b: clamp(.4375rem, 1.3vw, .75rem); --frame-p: clamp(.25rem, .8vw, .4375rem); }
[data-theme="dark"] { --frame-base: #24123A; --frame-mat: var(--lilac); --frame-edge: rgba(217, 204, 236, .5); }
.post-photo img, .gallery-slide img {
  border: var(--frame-b) solid var(--frame-base);
  padding: var(--frame-p);
  background: var(--frame-mat);
  border-radius: 10px;
  box-shadow: var(--shadow-1);
  outline: 1px solid var(--frame-edge);
  outline-offset: 0;
}
/* Gallery photos are shown whole (contain) in a 16:9 window. Sizing the window by its content box keeps the
   window itself 16:9, so the mat is the same width on all four sides. */
.gallery-slide img { box-sizing: content-box; width: calc(100% - 2 * (var(--frame-b) + var(--frame-p))); }
@media (forced-colors: active) { .post-photo img, .gallery-slide img { outline: none; } }

/* ---------- Scorecard (added 2026-12-01) ----------
   A small callout that keeps score in real text, never an image. Hidden punctuation in the markup
   makes it read aloud as one sentence, for example "Universe: 2, Tara: 0".
   Pairings: Aubergine on Lilac Mist in light, Moonlight on Aubergine in dark. */
.scorecard {
  --score-bg: var(--lilac); --score-text: var(--aubergine);
  display: grid; grid-template-columns: 1fr 1fr; position: relative;
  max-width: 22rem; margin: var(--space-4) 0;
  color: var(--score-text); background: var(--score-bg);
  border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--shadow-1);
  text-align: center;
}
[data-theme="dark"] .scorecard { --score-bg: var(--aubergine); --score-text: var(--moonlight); }
/* Two classes deep on purpose: ".post-body > .wrap > *" sets every block to the reading measure and would win over ".scorecard" alone. */
.post-body > .wrap > .scorecard { max-width: 22rem; }
.scorecard .sc-side { display: grid; gap: .375rem; padding: var(--space-3) var(--space-2); }
.scorecard .sc-side:last-child { border-left: 1px solid var(--card-border); }
.scorecard .sc-name { font-family: var(--font-display); font-weight: 600; font-size: 1rem; letter-spacing: .08em; }
.scorecard .sc-num { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.75rem, 8vw, 3.75rem); line-height: 1; }
