/*
 * A year or month page (templates/period.html, web/period_pages.py; docs/period-pages.md), on top of
 * site.css (its colours for day and night, the header and the footer). The play's full screen is at the
 * end (js/period-play.js). Phone first: one column, 760 px at most.
 */

.pp { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter) 40px; overflow-x: clip; }
.pp a { text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }

/* the story colours as a variable, for the pills (site.css colours .cN's background for its swatches) */
.pp-pill.c0, .pp-play .c0 { --c: var(--b0); } .pp-pill.c1, .pp-play .c1 { --c: var(--b1); }
.pp-pill.c2, .pp-play .c2 { --c: var(--b2); } .pp-pill.c3, .pp-play .c3 { --c: var(--b3); }
.pp-pill.c4, .pp-play .c4 { --c: var(--b4); } .pp-pill.c5, .pp-play .c5 { --c: var(--b5); }
.pp-pill.c6, .pp-play .c6 { --c: var(--b6); } .pp-pill.c7, .pp-play .c7 { --c: var(--b7); }
.pp-pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px; background: none;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); color: var(--c);
  font-size: 13px; font-weight: 600; line-height: 1.6; text-decoration: none; overflow-wrap: anywhere;
}
/* a story not named yet: an open ring and its founding headline, as the room's rings (not a pill: not a name) */
.pp-fresh.c0 { --c: var(--b0); } .pp-fresh.c1 { --c: var(--b1); } .pp-fresh.c2 { --c: var(--b2); } .pp-fresh.c3 { --c: var(--b3); }
.pp-fresh.c4 { --c: var(--b4); } .pp-fresh.c5 { --c: var(--b5); } .pp-fresh.c6 { --c: var(--b6); } .pp-fresh.c7 { --c: var(--b7); }
.pp-fresh { display: inline-flex; align-items: baseline; gap: 6px; background: none;   /* site.css paints .cN as a swatch */ color: var(--soft); font-size: 13.5px; text-decoration: none; }
.pp-fresh .pp-ring { flex: none; width: 9px; height: 9px; border: 2px solid var(--c); border-radius: 50%; transform: translateY(1px); }
.pp-fresh:hover { color: var(--text); }
.pp-srow .pp-fresh { font-size: 15px; }
.pp-full { margin-top: 4px; color: var(--muted); font-size: 14px; }
a.pp-pill:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }

/* ---------- the head: the topic's picture draws itself beside the title ---------- */
.pp-head { position: relative; padding: 26px 0 18px; }
.pp-art {
  position: absolute; right: 0; top: 10px; width: 46%; max-width: 300px; height: 92px; pointer-events: none;
  color: var(--muted); opacity: .7;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%); mask-image: linear-gradient(90deg, transparent, #000 25%);
}
.pp-art * { fill: none; stroke: currentColor; stroke-width: 1.2px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pp-head > :not(.pp-art) { position: relative; }
.pp-kicker { color: var(--muted); font-size: 14px; letter-spacing: .02em; }
.pp-kicker a { color: inherit; }
.pp-head h1 { font-size: 40px; line-height: 1.08; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; overflow-wrap: anywhere; }
.pp-dek { font-size: 20px; line-height: 1.35; margin-top: 12px; max-width: 34em; color: var(--soft); }
.pp-dates { color: var(--muted); font-size: 14px; margin-top: 10px; }
.pp-playbtn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 12px 22px 12px 18px; min-height: 48px;
  border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 650; font-size: 17px;
}
.pp-playbtn[hidden] { display: none; }   /* shown by the script: without one there is no play */
.pp-playbtn span { font-weight: 400; opacity: .85; font-size: 14px; }
.pp-playbtn:hover { filter: brightness(1.08); }

/* ---------- the still: upright on a phone, wide on a laptop; a day picture on a night page ---------- */
.pp-still { margin: 8px 0 0; }
.pp-still svg { width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 12px; }
.pp-tall { display: none; }
@media (max-width: 640px) { .pp-wide { display: none; } .pp-tall { display: block; } }
.pp-still figcaption { margin-top: 8px; }
.pp-save {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); font-size: 14px; text-decoration: none;
}
.pp-save:hover { border-color: var(--accent); }

/* ---------- sections ---------- */
.pp h2 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 36px 0 12px; }
.pp-k { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.pp-parts li { padding: 10px 0; border-top: 1px solid var(--border); }
.pp-parts p { font-size: 17px; font-weight: 600; line-height: 1.4; }
.pp-parts p a { text-decoration: none; }

/* the strip of months (or weeks) to walk: sticky, one row, the one in view marked */
.pp-strip {
  position: sticky; top: 0; z-index: 3; display: flex; gap: 4px; overflow-x: auto; padding: 10px 0; margin-top: 4px;
  background: var(--bg); border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.pp-strip::-webkit-scrollbar { display: none; }
.pp-strip a {
  flex: 1 0 auto; min-width: 44px; padding: 8px 6px; border-radius: 999px; text-align: center;
  color: var(--muted); font-size: 14px; text-decoration: none; white-space: nowrap;
}
.pp-strip a.is-empty { color: var(--faint); }
.pp-strip a.on { background: var(--surface-2); color: var(--text); font-weight: 650; }
.pp-list h2 { margin-bottom: 4px; }

.pp-sub { padding: 14px 0 16px; border-top: 1px solid var(--border); scroll-margin-top: 64px; }
.pp-sub:first-of-type { border-top: 0; }
.pp-sub h3 { font-size: 18px; line-height: 1.3; font-weight: 650; }
.pp-sname { display: block; font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: .02em; }
.pp-sub.is-empty h3 { color: var(--muted); font-weight: 500; }
.pp-text { margin-top: 6px; color: var(--soft); font-size: 15.5px; }
.pp-moves li { margin-top: 10px; font-size: 15.5px; color: var(--soft); }
.pp-moves time, .pp-turn time { color: var(--muted); font-size: 13px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.pp-moves b, .pp-item b { color: var(--text); font-weight: 600; }
.pp-mvh { margin-bottom: 2px; }
.pp-moves p { margin-top: 2px; }
.pp-item { margin-top: 10px; font-size: 15.5px; color: var(--soft); }
.pp-src { margin-top: 10px; font-size: 14px; }
.pp-src summary { color: var(--accent); cursor: pointer; padding: 4px 0; }
.pp-src li { margin-top: 6px; overflow-wrap: anywhere; }
.pp-pub { color: var(--muted); font-size: 13px; }
.pp-quiet { color: var(--muted); margin-top: 6px; font-size: 15px; }
.pp-more { margin-top: 10px; font-size: 14px; }
.pp-more a, .pp-back a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ---------- the period's stories ---------- */
.pp-story { padding: 14px 0; border-top: 1px solid var(--border); }
.pp-srow { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pp-srow .pp-pill { font-size: 15px; }
.pp-when { color: var(--muted); font-size: 14px; }
.pp-turn { margin-top: 6px; font-weight: 600; }
.pp-stand { margin-top: 6px; color: var(--soft); font-size: 15px; }
.pp-stand .pp-k { display: inline; margin-right: 4px; }
.pp-smore summary { cursor: pointer; color: var(--accent); padding: 10px 0; }

.pp-how p { color: var(--soft); font-size: 15px; }
.pp-back { margin-top: 26px; }

@media (max-width: 600px) {
  /* on a phone the picture has a band of its own above the kicker, so no word runs into it */
  .pp-head { padding-top: 70px; }
  .pp-head h1 { font-size: 34px; }
  .pp-dek { font-size: 18px; }
  .pp-art { width: 64%; height: 56px; top: 12px; }
}

/* ---------- the play: the whole screen ---------- */
html.pp-playing, html.pp-playing body { overflow: hidden; }
.pp-play {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  background: var(--bg); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.pp-play[hidden] { display: none; }
.pp-bar { display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter) 6px; max-width: 1080px; width: 100%; margin: 0 auto; }
.pp-bar .pp-t { flex: 1; font-weight: 650; }
.pp-bar button { border: 0; background: none; color: var(--muted); font-size: 15px; padding: 8px 4px 8px 12px; min-height: 44px; }
.pp-segs { display: flex; gap: 3px; padding: 0 var(--gutter); max-width: 1080px; width: 100%; margin: 0 auto; }
.pp-segs i { flex: 1; height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; }
.pp-segs i b { display: block; height: 100%; width: 0; background: var(--text); }
.pp-segs i.done b { width: 100%; }
.pp-segs i.now b { animation: pp-fill var(--ms) linear forwards; }
.pp-paused .pp-segs i.now b { animation-play-state: paused; }
@keyframes pp-fill { to { width: 100%; } }
.pp-fig { flex: 0 0 auto; min-height: 120px; padding: 8px var(--gutter) 0; display: flex; align-items: center; max-width: 1080px; width: 100%; margin: 0 auto; }
.pp-fig svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pp-fig .pp-row { transition: opacity .5s, stroke-width .5s; }
.pp-cap { flex: 1 1 auto; overflow-y: auto; padding: 10px var(--gutter) 6px; max-width: 760px; width: 100%; margin: 0 auto; min-height: 220px; }
.pp-cap .pp-k { margin-bottom: 4px; }
.pp-cap .pp-date { color: var(--muted); font-size: 14px; margin-right: 8px; }
.pp-cap .pp-pill { font-size: 13px; }
.pp-cap h3 { font-size: 24px; line-height: 1.22; font-weight: 680; margin-top: 8px; letter-spacing: -.01em; }
.pp-cap p { margin-top: 8px; color: var(--muted); font-size: 15px; }   /* quiet: the hold is timed on the headline */
.pp-cap > * { animation: pp-rise .5s ease both; }
.pp-cap h3 { animation-delay: .25s; }
.pp-cap p { animation-delay: .5s; }
@keyframes pp-rise { from { opacity: 0; transform: translateY(6px); } }
.pp-ctl { flex: none; display: flex; justify-content: center; gap: 18px; padding: 6px 0 14px; }
.pp-ctl button {
  display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pp-ctl svg { width: 18px; height: 18px; fill: currentColor; }
.pp-card { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px var(--gutter); max-width: 640px; width: 100%; margin: 0 auto; overflow-y: auto; }
.pp-card .pp-cart { color: var(--muted); height: 110px; }
.pp-card .pp-cart svg { width: min(100%, 420px); height: 100%; }
.pp-card .pp-cart svg * { fill: none; stroke: currentColor; stroke-width: 1.4px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pp-card h2 { font-size: 40px; line-height: 1.08; margin: 18px 0 10px; letter-spacing: -.02em; }
.pp-card .pp-dek { font-size: 19px; margin-top: 0; }
.pp-card .pp-meta { color: var(--muted); margin-top: 12px; font-size: 15px; }
.pp-card ol { margin-top: 14px; }
.pp-card ol li { padding: 9px 0; border-top: 1px solid var(--border); font-size: 15px; color: var(--soft); }
.pp-card ol li .pp-k { display: inline; margin-left: 6px; }
.pp-card .pp-addr { margin-top: 16px; color: var(--muted); font-size: 14px; }
.pp-card .pp-acts { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.pp-card .pp-acts button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 10px 16px; min-height: 44px; }
.pp-card .pp-acts button.pp-main { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 650; }
/* each control with its key under it; the keys show only on a computer with a keyboard (below) */
.pp-cb { display: inline-flex; }
.pp-play kbd { display: none; }
@media (max-width: 899.98px) { .pp-stage { display: contents; } }   /* a phone: as it was, the controls at the foot */
@media (min-width: 900px) {
  .pp-cap h3 { font-size: 30px; }
  .pp-fig { padding: 20px 60px 0; }
  /* a computer: the picture, the words and the controls one group on one left edge, centred in the screen's
     height (as the room's laptop play: the controls under the words); the words keep the room of the longest
     caption (period-play.js fitCap), so the controls stay put from step to step */
  .pp-play .pp-bar, .pp-play .pp-segs { max-width: 960px; }
  .pp-stage {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center;
    width: 100%; max-width: 960px; margin: 0 auto; padding: 0 var(--gutter) 5vh; position: relative;
  }
  .pp-stage .pp-fig { padding: 0; max-width: none; margin: 0; }
  .pp-stage .pp-cap { flex: none; max-width: 680px; margin: 0; padding: 22px 0 0; overflow: visible; min-height: 200px; }
  .pp-stage .pp-ctl { justify-content: flex-start; gap: 12px; padding: 14px 0 0; }
  .pp-stage .pp-cb { flex-direction: column; align-items: center; gap: 5px; }
  .pp-stage .pp-ctl button { width: 48px; height: 48px; cursor: pointer; }
}
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .pp-stage kbd { display: block; font: 500 11px/1 system-ui, sans-serif; color: var(--faint); letter-spacing: .02em; }
  .pp-stage .pp-ctl button:hover { background: var(--surface-2); }
}
@media (max-height: 700px) {
  .pp-cap { min-height: 0; }
  .pp-cap h3 { font-size: 21px; }
  .pp-cap p { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .pp-cap > * { animation: none; } .pp-segs i.now b { animation: none; width: 100%; } }
