/* The daily ritual card — today's one small shared thing, the seal, and yesterday still open.
 *
 * This used to live in hub/ui/hub.css. It moved out the day the question moved onto the couple's
 * front page (`/`), because the card now renders in two rooms that have different tokens: the Hub's
 * warm register (`--hub-*`, defined on `[data-hub-theme]`) and the landing's cream one (`--teal`,
 * `--paper`, the base tokens). Every colour below is written as `var(--hub-x, fallback)`: inside the
 * Hub it takes the room's own palette exactly as before, and anywhere else it falls through to the
 * base/landing tokens. One stylesheet, no second copy of the card, no drift.
 *
 * The markup is hub/scenes/ritual.js — `ritualPiece()` and `carryPiece()` — and it renders what
 * /api/hub/state sent and calculates nothing (docs/RITUAL.md).
 */

/* The card itself. In the Hub `.piece` already supplies ground, border and padding; these agree. */
.ritual, .ritual-carry {
  background: var(--hub-card, var(--paper-raised));
  border: 1px solid var(--hub-line, var(--line));
  border-radius: var(--r16, 16px);
  box-shadow: var(--hub-shadow, var(--shadow-soft, var(--shadow-1)));
  padding: 18px 18px 20px;
  color: var(--hub-ink, var(--ink));
}
.ritual, .ritual-carry { --accent: var(--hub-accent, var(--teal-deep, var(--pink-label))); }

/* The one card that is only true today, so it is the loudest thing on the page and the only piece
   with a filled ground. */
.ritual {
  background: linear-gradient(160deg, var(--hub-card, var(--paper-raised)), var(--hub-paper, var(--paper)));
  border-color: var(--accent);
  box-shadow: var(--hub-shadow, var(--shadow-soft, var(--shadow-1))), inset 0 0 0 1px var(--hub-line, var(--line));
}
.ritual .piece-kicker, .ritual-carry .piece-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: var(--accent); margin: 0 0 10px;
}
/* The kicker names the MEDIUM now (docs/C5-DESIGN.md §4), so the deck title moves to the corner
   where there is one. Baseline-aligned rather than centred: two mono labels of different sizes
   sitting on the same line is the whole reason the row exists. */
.ritual-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
/* The kicker is the thing that must stay whole: it is the only place the card says what today
   IS, so a long deck title beside it shortens the title, never the medium. */
.ritual-top .piece-kicker { margin-bottom: 10px; flex: 0 0 auto; white-space: nowrap; }
.ritual-deck {
  margin: 0 0 10px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--hub-faint, var(--ink-faint)); text-align: right; flex: 0 1 auto; min-width: 0;
}

/* A message day has no question, and that IS the day (§4). The headline is the card's own words,
   so it is set as the card speaking rather than as a prompt: the same serif, a size down. */
.ritual-q.is-message, .ritual-q.is-play { font-size: clamp(18px, 2.8vw, 24px); }
.ritual-q.is-draw { font-family: inherit; font-weight: 700; font-size: clamp(18px, 3vw, 23px); }
.ritual-q {
  font-family: var(--serif); font-weight: 400; letter-spacing: -.01em;
  font-size: clamp(20px, 3.4vw, 28px); line-height: 1.28; margin: 2px 0 14px;
}
.ritual-q.is-photo { font-family: inherit; font-weight: 700; font-size: clamp(18px, 3vw, 23px); }

/* A savouring card is quoting the couple's own past back at them, so it is set as a quotation. */
.ritual-savor {
  margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--hub-a, var(--pink));
  background: var(--hub-a-tint, var(--pink-tint)); border-radius: 0 var(--r8, 8px) var(--r8, 8px) 0;
  display: flex; flex-direction: column; gap: 3px;
}
.savor-it { font-family: var(--serif); font-size: 16px; line-height: 1.4; color: var(--on-pink-tint); }
.savor-detail { font: 600 11px var(--mono); letter-spacing: .06em; color: var(--on-pink-tint); opacity: .85; }

.ritual-hint {
  margin: -6px 0 14px; padding: 9px 12px; border-radius: var(--r8, 8px);
  background: var(--hub-paper, var(--paper)); border: 1px dashed var(--hub-line, var(--line));
  font-size: 14px; color: var(--hub-soft, var(--ink-soft));
}
.ritual-waiting { margin: 0 0 8px; font-weight: 700; font-size: 14px; color: var(--accent); }
.ritual-input { width: 100%; resize: vertical; min-height: 76px; font-size: 15px; line-height: 1.45; }
.ritual-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.ritual-hintbtn { font-size: 13px; }

/* ── the seal ───────────────────────────────────────────────────────────────────────────────── */
.ritual-answers { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.answer-card {
  padding: 12px 14px; border-radius: var(--r8, 8px); border: 1px solid var(--hub-line, var(--line));
  background: var(--hub-card, var(--paper-raised)); min-width: 0;
}
.answer-card[data-side="a"] { border-left: 3px solid var(--hub-a, var(--pink)); }
.answer-card[data-side="b"] { border-left: 3px solid var(--hub-b, var(--blue)); }
.answer-card.is-sealed {
  background: repeating-linear-gradient(135deg, var(--hub-paper, var(--paper)), var(--hub-paper, var(--paper)) 7px, transparent 7px, transparent 14px);
}
.answer-who { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; color: var(--hub-faint, var(--ink-faint)); margin: 0 0 5px; }
.answer-text { margin: 0; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-sealed { margin: 0; font-size: 14px; color: var(--hub-soft, var(--ink-soft)); font-style: italic; }
.ritual-closed { grid-column: 1 / -1; margin: 4px 0 0; font-weight: 700; color: var(--accent); font-size: 14px; }

/* ── an either day: two big options, one tap ────────────────────────────────────────────────── */
/* The tap IS the send, so the buttons are the biggest thing on the card — a binary answered with
   a thumb on a phone in bed. Every colour is var(--hub-x, fallback), same as everything above. */
.ritual-either { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.either-btn {
  padding: 18px 14px; min-height: 64px; border-radius: var(--r8, 8px);
  border: 1.5px solid var(--hub-line, var(--line));
  background: var(--hub-paper, var(--paper));
  color: var(--hub-ink, var(--ink));
  font-family: var(--serif); font-size: 17px; line-height: 1.3;
  white-space: normal; overflow-wrap: anywhere;
}
.either-btn:hover:not(:disabled), .either-btn:focus-visible { border-color: var(--accent); }
.either-btn:disabled { opacity: .6; }
/* The server's one-word arithmetic. Spans both reveal columns, like .ritual-closed. */
.either-same {
  grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; letter-spacing: .18em;
  color: var(--accent); font-weight: 700;
}

/* ── a scale day: seven dots between two labels ─────────────────────────────────────────────── */
.ritual-scale { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; }
.scale-end {
  font: 600 11px var(--mono); letter-spacing: .06em; color: var(--hub-soft, var(--ink-soft));
  max-width: 8em; overflow-wrap: anywhere;
}
.scale-lo { text-align: right; }
.scale-dots { display: flex; gap: 6px; flex: 1; justify-content: space-between; }
.scale-dot {
  width: 38px; height: 38px; border-radius: 50%; flex: 0 1 38px;
  border: 1.5px solid var(--hub-line, var(--line));
  background: var(--hub-paper, var(--paper));
  color: var(--hub-soft, var(--ink-soft));
  font: 600 13px var(--mono);
}
.scale-dot:hover:not(:disabled), .scale-dot:focus-visible { border-color: var(--accent); color: var(--accent); }
.scale-dot:disabled { opacity: .6; }

/* The reveal: both marks on the one line. The spots carry no text, only fill — the side colours
   never have to hold a label, so there is nothing here to vanish in the dark register. */
.scale-answers { display: block; }
.scale-line { display: flex; gap: 6px; flex: 1; justify-content: space-between; align-items: center; }
.scale-spot {
  width: 22px; height: 22px; border-radius: 50%; text-align: center;
  color: var(--hub-faint, var(--ink-faint)); font-size: 14px; line-height: 22px;
}
.scale-spot.is-you { background: var(--hub-a, var(--pink)); }
.scale-spot.is-them { background: var(--hub-b, var(--blue)); }
.scale-spot.is-you.is-them {
  background: linear-gradient(90deg, var(--hub-a, var(--pink)) 50%, var(--hub-b, var(--blue)) 50%);
}
.scale-legend { display: flex; gap: 14px; margin: 8px 0 0; font-size: 10px; letter-spacing: .14em; }
.scale-key { color: var(--hub-faint, var(--ink-faint)); }
.scale-key.is-you { color: var(--on-pink-tint, var(--hub-ink, var(--ink))); }
.scale-key.is-them { color: var(--on-blue-tint, var(--hub-ink, var(--ink))); }
.scale-gap { margin: 8px 0 0; font-weight: 700; font-size: 14px; color: var(--accent); }

/* ── a guess day: you, and your guess at them ───────────────────────────────────────────────── */
.guess-field { display: block; margin: 0 0 8px; }
.guess-label {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  color: var(--hub-faint, var(--ink-faint)); margin: 0 0 4px;
}
.guess-answers { align-items: start; }
.guess-pair-label {
  margin: 8px 0 2px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--hub-faint, var(--ink-faint));
}
.guess-pair-label:first-of-type { margin-top: 0; }
.guess-second { margin-top: 8px; }

/* The verdict: a human tap, never a model. Spans the reveal grid like the closed line does. */
.verdict-row { grid-column: 1 / -1; margin: 4px 0 0; }
.verdict-ask { margin: 0 0 8px; font-weight: 700; font-size: 14px; color: var(--hub-ink, var(--ink)); }
.verdict-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.verdict-btn { font-size: 13px; }
.verdict-btn.on {
  border-color: var(--accent);
  background: var(--hub-a-tint, var(--pink-tint));
  color: var(--on-pink-tint);
}
.verdict-theirs {
  margin: 8px 0 0; font-size: 10px; letter-spacing: .14em; color: var(--hub-soft, var(--ink-soft));
}

/* ── yesterday, still open ──────────────────────────────────────────────────────────────────── */
.ritual-carry { border-style: dashed; }
.carry-q { margin: 0 0 10px; font-family: var(--serif); font-size: 17px; line-height: 1.35; }
.carry-note { margin: 0; font-size: 14px; color: var(--hub-soft, var(--ink-soft)); }
.carry-input { min-height: 58px; margin-bottom: 8px; }

/* ── the photo day (the PHOTO branch — an actual photograph, sealed like words) ─────────────── */
/* The real control is the file input; the button is its face. `display:none` keeps it out of the
   tab order without losing programmatic clicks (or the E2E suite's synthetic files). */
.photo-file { display: none; }
.photo-write { display: flex; flex-direction: column; gap: 10px; }
.photo-pick { align-self: flex-start; }

.photo-preview {
  display: block; max-width: 100%; max-height: 320px; object-fit: contain;
  border-radius: var(--r8, 8px); border: 1px solid var(--hub-line, var(--line));
  background: var(--hub-paper, var(--paper));
}
.photo-caption { width: 100%; font-size: 15px; }

/* The reveal: two photographs where two answers would be, same grid, same side accents. */
.answer-photo {
  display: block; width: 100%; max-height: 340px; object-fit: cover;
  border-radius: var(--r8, 8px); margin: 2px 0 0;
  background: var(--hub-paper, var(--paper));
}
.answer-caption {
  margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--hub-soft, var(--ink-soft));
  overflow-wrap: anywhere;
}

/* The honest sentence about a server with nowhere to keep bytes. */
.photo-ephemeral {
  grid-column: 1 / -1; margin: 2px 0 0;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  color: var(--hub-faint, var(--ink-faint));
}

/* ── a drawing day (C5 · B2) ──────────────────────────────────────────── */
/* The sheet itself is client/ui/drawpad.css. What belongs here is only how the day sits in the
   card — and the reveal, which is the photo day's reveal because it is the same day. */
.draw-write { display: flex; flex-direction: column; gap: 10px; }
.draw-host { min-height: 60px; }
/* The reveal borrows the photo day's grid and cards wholesale — a drawing day's reveal IS a photo
   day's reveal. Only the picture itself is different: square, contained rather than cropped (a
   drawing cropped to fill is a drawing with its edges cut off), and on white in every register,
   because that is the paper it was drawn on. It lives here and not in drawpad.css because /story
   renders it too and never loads the canvas. */
.answer-draw {
  display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain;
  background: #fff; max-height: none;
  border-radius: var(--r8, 8px);
  border: 1px solid var(--hub-line, var(--line));
  margin: 2px 0 0;
}

/* ── a message day (C5 · B1) ───────────────────────────────────────────── */
/* Four hundred characters is a long thing to write in a three-row box, and a message day is the
   one day that asks for a paragraph rather than a sentence. */
.message-write .ritual-input { min-height: 104px; }

/* ── a play day (C5 · B3) ─────────────────────────────────────────────── */
/* The tiles are `.card` from base.css and import no game's register (docs/STYLE-GUIDE.md §04):
   this is the shell, and a stranger must not be able to tell which game a tile belongs to by
   looking at the tile. 2×2 on a phone, four across from 1024px — the async four make the first
   row at both widths, which is what the sentence under them is describing. */
.play-write { display: flex; flex-direction: column; gap: 12px; }
.play-tiles { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.play-tile {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 12px 12px 10px; text-decoration: none;
  color: var(--hub-ink, var(--ink));
  background: var(--hub-card, var(--paper-raised));
  border-color: var(--hub-line, var(--line));
}
.play-tile:hover, .play-tile:focus-visible { border-color: var(--accent); }
.play-tile-emoji { font-size: 20px; line-height: 1; }
.play-tile-t { font-weight: 700; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.play-tile-when { font-size: 9px; letter-spacing: .14em; color: var(--hub-faint, var(--ink-faint)); }
.play-note { margin: 0; font-size: 13px; color: var(--hub-soft, var(--ink-soft)); }

/* The written fallback. Always on the card, never a thing that appears after a failure — it is
   what stops a play day being the one day that cannot complete (§4). */
.play-fallback {
  padding: 12px 14px; border-radius: var(--r8, 8px);
  border: 1px dashed var(--hub-line, var(--line));
  background: var(--hub-paper, var(--paper));
}
.play-fallback-ask { margin: 0; font-size: 14px; font-weight: 700; color: var(--hub-ink, var(--ink)); }
.play-fallback .ritual-row { flex-wrap: nowrap; }
.play-fallback-input { flex: 1 1 auto; min-width: 0; font-size: 15px; }
.play-fallback-send { flex: 0 0 auto; }

.play-done { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.3; }
.play-score { margin: 0; font-size: 11px; letter-spacing: .1em; color: var(--hub-soft, var(--ink-soft)); }
/* A play day is not sealed, and the card says so rather than pretending — so this line is the
   quiet status it actually is, not the pink "they are waiting on you" the sealed media use. */
.play-waiting { margin: 0; font-weight: 600; color: var(--hub-soft, var(--ink-soft)); }
.play-answers { margin: 0; }

/* ── the swap (C5 · B4) ──────────────────────────────────────────────── */
/* A LINE, not a chooser. It is collapsed to a link on purpose: if choosing were as loud as the
   card, nothing would ever be dealt (§5, "the swap becomes the product"). */
.ritual-swap { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--hub-line, var(--line)); }
.swap-open { font-size: 13px; }
.swap-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.swap-btn { font-size: 13px; }
.ritual-swapped {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--hub-line, var(--line));
  font-size: 10px; letter-spacing: .14em; color: var(--hub-faint, var(--ink-faint));
}

@media (min-width: 1024px) {
  .play-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .ritual-answers { grid-template-columns: 1fr; }
  .scale-dot { width: 34px; height: 34px; }
  .scale-end { max-width: 5.5em; font-size: 10px; }
  /* The swap row wraps to two lines rather than scrolling sideways (§4, "Both widths"). */
  .swap-btn { flex: 1 1 auto; }
  /* Two people's answers stack on a phone — but two drawings stay side by side, because a
     drawing pair read as a pair is the whole point of the day. (The photo day is untouched: a
     photograph shrunk to half a phone is not worth looking at, and a drawing is.) */
  .draw-answers { grid-template-columns: 1fr 1fr; }
  .play-fallback .ritual-row { flex-wrap: wrap; }
}
