/* Register B — the editorial register (DESIGN_BRIEF.md rev 2 §5).
 *
 * This file is THE token source for every server-rendered surface: the public
 * page (`GET /p/{token}`) and the embed widget (`GET /embed/{token}`). Before
 * it existed, both templates carried their own copy of the same six hex
 * values, so a palette change meant editing two Python f-strings and hoping
 * they stayed in step (POLISH P-49).
 *
 * Only the per-calendar accent stays inline, because it is data: the colour
 * arrives from the row, not from the design system.
 *
 * Contrast is measured against the cream ground #FAF8F3, not asserted:
 *   ink     #1C1A17  16.36:1  AAA
 *   muted   #5C564C   6.85:1  AA
 *   border  #857C6C   3.88:1  AA non-text (controls)
 *   accent  #7C2D2D   8.72:1  AA, and 9.25:1 for white on accent
 *   rule    #E3DED2   1.26:1  DECORATIVE HAIRLINE ONLY — never carries text
 * Rev 1 shipped #A8A093 as muted text here at 2.44:1. That value is gone.
 */

/* Self-hosted, same-origin. Both surfaces computed to `Georgia, serif`
 * before this — the brief's typeface was named in the CSS and never served
 * (POLISH P-48). `swap` because a public page must be readable during the
 * font fetch; the fallback metrics are close enough that reflow is minor. */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/p/_assets/fonts/public-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/p/_assets/fonts/public-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/p/_assets/fonts/fraunces-latin-600-normal.woff2") format("woff2");
}

:root {
  --cream:  #FAF8F3;
  --ink:    #1C1A17;
  --muted:  #5C564C;
  --border: #857C6C;
  --rule:   #E3DED2;
  --tint:   #F1EDE4;
  --accent: #7C2D2D;         /* overridden per calendar, inline */
  --accent-strong: #6A2626;
  --accent-pressed: #581F1F;   /* --a-800 in the app's ramp */
  --tint-pressed:   #E8E2D6;
  --on-accent:      #FFFFFF;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Rev 1's print scale, retained (brief §5). */
  --t-12: 12px; --t-14: 14px; --t-16: 16px; --t-20: 20px;
  --t-24: 24px; --t-32: 32px; --t-48: 48px;

  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 var(--t-16)/1.5 var(--font-body);
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 680px; margin: 0 auto; padding: 48px 24px 96px; }

/* Elevation is not used in Register B. Depth comes from hairlines and
 * whitespace — brief §5, unchanged from rev 1. */
h1 {
  font-family: var(--font-display);
  font-size: var(--t-32);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 24px;
}
.eyebrow {
  font: 400 var(--t-14)/1.4 var(--font-body);
  color: var(--muted);
  margin: 0 0 12px;
}
hr { border: 0; border-top: 1px solid var(--rule); margin: 24px 0; }

ul.events { list-style: none; margin: 0; padding: 0; }
ul.events li {
  padding: 16px 0 16px 12px;
  border-left: 2px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  display: grid;
  gap: 4px;
}
.when {
  font: 400 var(--t-14)/1.4 var(--font-body);
  color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}
.what { font-family: var(--font-display); font-size: var(--t-20); font-weight: 600; }
.where { font-size: var(--t-14); color: var(--muted); }
li.empty { color: var(--muted); border-left-color: var(--rule); }
img { max-width: 100%; height: auto; margin-top: 8px; border-radius: var(--radius); }

/* ── Controls ─────────────────────────────────────────────────────────
 * The public page had ZERO anchors and ZERO buttons (POLISH P-47, DARK):
 * the only subscribe affordance was a relative path inside a <code> tag,
 * which resolves to nothing when copied. These are the states that the
 * finding says were never designed. */
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 600 var(--t-14)/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms cubic-bezier(0.2, 0, 0, 1),
              border-color 120ms cubic-bezier(0.2, 0, 0, 1);
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
/* Hover and pressed fill with the FIXED dark maroon, so their text is always
   white; only the resting fill is the calendar's color, whose text color the
   server picks per calendar (--on-accent, CRITIC C12-5). */
.btn--primary:hover { background: var(--accent-strong); color: #FFFFFF; }
.btn--primary:active { background: var(--accent-pressed); color: #FFFFFF; }
.btn--secondary { background: transparent; color: var(--ink); border-color: var(--border); }
.btn--secondary:hover { background: var(--tint); }
.btn--secondary:active { background: var(--tint-pressed); }

/* One ring, on :focus-visible only — a mouse click on a link should not
 * paint a ring, and a keyboard tab must. */
.btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* Copy-target context — the one place mono is permitted (brief §2.2). */
code {
  font: 400 var(--t-14)/1.5 var(--font-mono);
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: block;
  word-break: break-all;
  color: var(--ink);
}

.subscribe { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); }
.subscribe h2 {
  font: 600 var(--t-16)/1.3 var(--font-body);
  margin: 0 0 8px;
}
.subscribe p { margin: 0 0 16px; color: var(--muted); font-size: var(--t-14); }
.footer-links { margin-top: 24px; font-size: var(--t-14); }

/* Attribution badge: the last element on both surfaces. */
.badge {
  margin: 32px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: var(--t-14);
  color: var(--muted);
}
.badge a { color: inherit; text-decoration: underline; }
body.widget .badge { margin-top: 16px; }

/* ── Responsive ───────────────────────────────────────────────────────
 * P-50: neither surface declared a single breakpoint. The widget is framed
 * at 360px by third-party sites and the page is read on phones. */
@media (max-width: 560px) {
  .wrap { padding: 32px 16px 64px; }
  h1 { font-size: var(--t-24); }
  .what { font-size: var(--t-16); }
  .btn { width: 100%; justify-content: center; }
}

/* ── Widget ───────────────────────────────────────────────────────────
 * Framable, credential-less, and rendered at final state with no motion. */
body.widget { background: var(--cream); }
body.widget .wrap { padding: 16px; }
body.widget h1 {
  font-family: var(--font-body);
  font-size: var(--t-14);
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 12px;
}
body.widget ul.events li { padding: 12px 0 12px 12px; }
body.widget .what { font-size: var(--t-16); }
@media (max-width: 400px) {
  body.widget .wrap { padding: 12px; }
  body.widget .what { font-size: var(--t-14); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Event page (SPEC_RSS_FLIER RF-9). */
/* A persistent cue, not hover-only: on a phone there is no hover, and the
   title is the way into the event page (CRITIC C12-13). */
a.what { color: var(--ink); text-decoration: underline; text-decoration-color: var(--border);
         text-decoration-thickness: 1px; }
a.what:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
p.when { margin: 0 0 4px; font-size: var(--t-16); }
p.where { margin: 0 0 16px; }
p.note { margin: 0 0 8px; font-weight: 600; color: var(--muted); }
.description { white-space: pre-line; margin: 0 0 16px; }
/* Free text breaks anywhere rather than widening the page: a pasted sign-up
   URL made the event page 907px wide at 360px (CRITIC C12-12, AC-60). */
.description, h1, .what, .where, a.more, .btn { overflow-wrap: anywhere; }
.btn { max-width: 100%; }
a.flier { display: block; margin: 0 0 8px; }
.wrap > .actions { margin-top: 24px; }

/* An event's own web link (SPEC_EVENT_LINK EL-6). */
a.more { font-size: var(--t-14); justify-self: start; max-width: 100%; }
/* The event page's date: the start and the end are each kept whole, and a
   narrow screen breaks the line only between them (operator, 2026-11-17). */
.when-part { display: inline-block; max-width: 100%; }

/* ══ Brand Refresh v2 — out loud (screens 18, 19), scoped to body.v2 ═══
 * The public page and the v2 embed. v1 embeds (`/embed/{token}`) do not
 * carry the class and render exactly as before (README-REFRESH §9 phase 5).
 * Kit colors: Parchment ground, Linen rules, Ink text, Vestry Navy buttons,
 * Playfair Display 500 titles, Work Sans text. */
@font-face { font-family: "Playfair Display"; font-weight: 500; font-display: swap;
  src: url("/p/_assets/fonts/playfair-display-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 400; font-display: swap;
  src: url("/p/_assets/fonts/work-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-weight: 600; font-display: swap;
  src: url("/p/_assets/fonts/work-sans-latin-600-normal.woff2") format("woff2"); }
body.v2 {
  --cream: #F4F0E8; --ink: #2B2B2B; --muted: #4A4F58; --rule: #DDD5C8; --border: #DDD5C8;
  --navy: #0B3A8C; --blue: #1F4CA0;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: var(--cream); color: var(--ink); font-family: var(--font-body);
}
body.v2 .wrap { max-width: 760px; padding: 56px 24px 80px; }
body.v2 .head { margin-bottom: 20px; }
body.v2 .eyebrow { display: flex; align-items: center; gap: 8px; font: 600 11px/1 var(--font-body);
  letter-spacing: .18em; text-transform: uppercase; color: var(--blue); margin: 0 0 14px; }
body.v2 .eyebrow .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
body.v2 h1 { font: 500 44px/1.1 var(--font-display); margin: 0 0 12px; letter-spacing: -.01em; }
body.v2 .about { margin: 0 0 18px; color: var(--muted); max-width: 56ch; }
body.v2 .actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
body.v2 .btn { border-radius: 10px; font: 600 15px/1 var(--font-body); padding: 13px 18px; }
body.v2 .btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
body.v2 .btn--primary:hover { background: #08296A; }
body.v2 .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
body.v2 .chip { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: #fff; color: var(--ink); font: 500 13px/1 var(--font-body); text-decoration: none; }
body.v2 .chip:hover { border-color: var(--blue); color: var(--blue); }
body.v2 ul.events li.row { border-left: 0; border-bottom: 1px solid var(--rule); padding: 18px 0; gap: 6px; }
body.v2 ul.events li.month { border: 0; padding: 26px 0 4px; }
body.v2 ul.events li.month h2 { margin: 0; font: 600 11px/1 var(--font-body); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
body.v2 .when { font: 600 13px/1.4 var(--font-body); color: var(--blue); }
body.v2 .what { font: 500 22px/1.25 var(--font-display); color: var(--ink); text-decoration: none; }
body.v2 a.what:hover { color: var(--blue); }
body.v2 .where { color: var(--muted); font-size: 14px; }
body.v2 .more { color: var(--blue); font-weight: 600; }
body.v2 .more::after { content: " →"; }
body.v2 ul.events img { border-radius: 8px; border: 1px solid var(--rule); max-width: 260px; margin-top: 6px; }
body.v2 .subscribe { margin-top: 40px; background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 22px 24px; }
body.v2 .subscribe h2 { font: 500 22px/1.2 var(--font-display); margin: 0 0 8px; }
body.v2 .subscribe p { color: var(--muted); margin: 0 0 12px; }
body.v2 .subscribe code { display: block; padding: 10px 12px; background: var(--cream); border-radius: 8px;
  font-size: 12px; overflow-wrap: anywhere; user-select: all; }
body.v2 .foot { display: flex; align-items: center; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--rule); }
body.v2 .foot .badge { margin: 0; color: var(--muted); font-size: 13px; }
body.v2 .foot .badge a { color: var(--blue); }
body.v2 .mark { flex: none; }
/* The v2 widget: denser, inside someone else's page. */
body.widget.v2 .wrap { max-width: none; padding: 18px; }
body.widget.v2 h1 { font-size: 26px; margin-bottom: 10px; }
body.widget.v2 .btn { padding: 9px 14px; font-size: 13px; }
body.widget.v2 ul.events li.row { padding: 12px 0; }
body.widget.v2 .what { font-size: 18px; }
body.widget.v2 .seeall { margin: 14px 0 0; }
body.widget.v2 .seeall a { color: var(--blue); font-weight: 600; text-decoration: none; }
body.widget.v2 .foot { margin-top: 18px; padding-top: 12px; }
@media (max-width: 480px) { body.v2 h1 { font-size: 32px; } body.v2 .what { font-size: 19px; } }
@media print {
  body.v2 { background: #fff !important; }
  body.v2 .actions, body.v2 .chips, body.v2 .subscribe { display: none; }
  body.v2 ul.events li.row { break-inside: avoid; }
}
body.v2 .foot .badge { border: 0; padding: 0; }
