/* Memoed shared chrome — canonical tokens, global header, editorial footer,
   unobstructed film facade and shared UI primitives.
   Loaded first on /, /for-judge/ and /workspace/. Page stylesheets load after it.
   Green = your record. Amber = saved reading. Cobalt = interactive action. */

:root {
  --paper: #faf9f6;
  --paper-2: #f3f0e8;
  --white: #ffffff;
  --ink: #191d1a;
  --ink-2: #2f3530;
  --muted: #5b615b;
  --faint: #7c827b;
  --line: #e2ded4;
  --line-2: #d3cfc4;
  --accent: #264dae;
  --accent-hover: #1e3f93;
  --accent-soft: #edf2fc;
  --lived: #1f6b43;
  --lived-bg: #e8f3ec;
  --lived-line: #b9dcc6;
  --reading: #9a5b13;
  --reading-bg: #fbf4e6;
  --reading-line: #ebd6ad;
  --warn: #a3361f;
  --warn-bg: #fdf1ee;
  --warn-line: #f0c9bf;
  --forest: #0f1714;
  --forest-2: #16221d;
  --forest-line: rgba(255, 255, 255, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 60px;
  --shadow-sm: 0 1px 2px rgba(25, 29, 26, 0.06), 0 2px 8px rgba(25, 29, 26, 0.04);
  --shadow-md: 0 2px 6px rgba(25, 29, 26, 0.06), 0 18px 48px -18px rgba(25, 29, 26, 0.22);
}

/* ------------------------------------------------------------------
   Safe base (zero-specificity where a page may want to differ)
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:where(img) {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(button, input, textarea, select) {
  font: inherit;
  color: inherit;
}

:where(button) {
  cursor: pointer;
}

:where(a) {
  color: inherit;
}

:where(code) {
  font-family: var(--mono);
}

:where(blockquote) {
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:where(body:not(.workspace-body)) .skip-link {
  position: absolute;
  left: 14px;
  top: -60px;
  z-index: 200;
  padding: 9px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

:where(body:not(.workspace-body)) .skip-link:focus {
  top: 12px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ------------------------------------------------------------------
   Global header
   ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  height: var(--header-h);
  background: rgba(250, 249, 246, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(25, 29, 26, 0.08);
  font-family: var(--sans);
  color: var(--ink);
}

.header-inner {
  max-width: 1320px;
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.site-header .brand {
  justify-self: start;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  text-decoration: none;
}

.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--ink);
  color: var(--white);
}

.brand-mark svg {
  width: 16px;
  height: 16px;
}

.site-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.45;
  text-decoration: none;
  white-space: nowrap;
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
  background: rgba(25, 29, 26, 0.045);
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}

.header-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.header-btn-primary {
  padding: 0 16px;
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--ink);
}

.header-btn-primary:hover {
  background: #2f3530;
  border-color: #2f3530;
  color: var(--white);
}

.header-btn-primary[aria-current="page"] {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(25, 29, 26, 0.14);
}

.header-btn-secondary {
  padding: 0 15px;
  background: #edeae2;
  color: var(--ink);
  border: 1px solid #dbd6ca;
}

.header-btn-secondary:hover {
  background: #e3dfd4;
  border-color: #cbc5b7;
  color: var(--ink);
}

.header-btn-secondary[aria-current="page"] {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(25, 29, 26, 0.14);
}

.header-btn-secondary[aria-current="page"]:hover {
  background: #2f3530;
  border-color: #2f3530;
  color: var(--white);
}

.header-actions:has(.header-btn-secondary[aria-current="page"]) .header-btn-primary,
.judge-body .header-btn-primary {
  background: #edeae2;
  color: var(--ink);
  border-color: #dbd6ca;
  box-shadow: none;
}

.header-actions:has(.header-btn-secondary[aria-current="page"]) .header-btn-primary:hover,
.judge-body .header-btn-primary:hover {
  background: #e3dfd4;
  border-color: #cbc5b7;
  color: var(--ink);
}

.nav-menu {
  display: none;
  position: relative;
}

.nav-menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.nav-menu summary::-webkit-details-marker {
  display: none;
}

.nav-menu summary > span {
  width: 14px;
  height: 9px;
  border-top: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transition: transform 160ms var(--ease);
}

.nav-menu[open] summary {
  border-color: var(--ink);
}

.nav-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(260px, calc(100vw - 28px));
  padding: 8px;
  display: grid;
  gap: 2px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.nav-menu-panel a {
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 550;
  text-decoration: none;
}

.nav-menu-panel a:hover {
  background: var(--paper-2);
}

.nav-menu-panel a[aria-current="page"] {
  color: var(--ink);
  font-weight: 650;
  background: rgba(25, 29, 26, 0.06);
}

.nav-menu-panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 6px;
}

/* ------------------------------------------------------------------
   Editorial footer
   ------------------------------------------------------------------ */
.site-footer {
  padding: 64px 0 34px;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--sans);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 1.1fr 1.15fr;
  gap: 36px 40px;
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line);
}

.footer-col {
  min-width: 0;
}

.footer-tagline {
  max-width: 30ch;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.footer-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-pills li {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.footer-heading {
  margin: 0 0 14px;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-transform: uppercase;
}

.footer-links,
.footer-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.footer-links a,
.footer-meta a {
  color: var(--ink-2);
  font-weight: 500;
  text-decoration: none;
  transition: color 140ms var(--ease);
}

.footer-links a:hover,
.footer-meta a:hover {
  color: var(--accent);
}

.footer-meta strong {
  color: var(--ink-2);
  font-weight: 650;
}

.footer-disclosure {
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.48;
}

.footer-bottom {
  padding-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  color: var(--faint);
  font-size: 12.5px;
}

.footer-copy {
  margin: 0;
}

.footer-surfaces {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ------------------------------------------------------------------
   Film facade — play control lives in the lower-left, never over the
   poster's centered caption or the presenter's face.
   ------------------------------------------------------------------ */
.film {
  width: 100%;
  margin: 0;
}

.film-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 22px;
  background: #0f1714;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 80px -30px rgba(25, 29, 26, 0.45),
    0 2px 10px rgba(25, 29, 26, 0.08);
}

.film-play {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.film-play:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.film-poster {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform 700ms var(--ease);
}

.film-play:hover .film-poster {
  transform: scale(1.015);
}

.film-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(15, 23, 20, 0) 58%, rgba(15, 23, 20, 0.72) 100%);
}

.film-cta-pill {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 20px 0 8px;
  border-radius: 999px;
  background: rgba(250, 249, 246, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  white-space: nowrap;
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}

.film-cta-icon {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  transition: background-color 220ms var(--ease);
}

.film-cta-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin: -6px 0 0 -4px;
  border-style: solid;
  border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent var(--white);
}

.film-cta-label {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.film-cta-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.film-play:hover .film-cta-pill,
.film-play:focus-visible .film-cta-pill {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

.film-play:hover .film-cta-icon,
.film-play:focus-visible .film-cta-icon {
  background: var(--accent);
}

.film-meta-pill {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 2;
  max-width: calc(100% - 260px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 20, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.film-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.film-caption {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  text-align: left;
}

.film-caption a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.film-caption a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------------
   Shared primitives (buttons scoped away from the workspace app,
   which ships its own .btn system)
   ------------------------------------------------------------------ */
:where(body:not(.workspace-body)) .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}

:where(body:not(.workspace-body)) .btn:active {
  transform: translateY(1px);
}

:where(body:not(.workspace-body)) .btn-ink {
  background: var(--ink);
  color: var(--white);
}

:where(body:not(.workspace-body)) .btn-ink:hover {
  background: var(--accent);
}

:where(body:not(.workspace-body)) .btn-line {
  background: var(--white);
  border-color: var(--line-2);
  color: var(--ink);
}

:where(body:not(.workspace-body)) .btn-line:hover {
  border-color: var(--ink);
}

:where(body:not(.workspace-body)) .btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}

.btn-play {
  flex: none;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}

.text-link {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms var(--ease);
}

.text-link:hover {
  border-bottom-color: currentColor;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.eyebrow-light {
  color: rgba(233, 240, 234, 0.72);
}

.eyebrow-light > span {
  color: #e9f0ea;
  border-color: var(--forest-line);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}

.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tag-lived {
  color: var(--lived);
  background: var(--lived-bg);
}

.tag-reading {
  color: var(--reading);
  background: var(--reading-bg);
}

.tag-muted {
  color: var(--muted);
  background: #ecebe5;
}

/* ------------------------------------------------------------------
   Responsive chrome
   ------------------------------------------------------------------ */
@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
  }
}

@media (max-width: 920px) {
  .header-inner {
    display: flex;
    justify-content: space-between;
    padding: 0 18px;
    gap: 12px;
  }

  .site-nav,
  .header-btn-secondary {
    display: none;
  }

  .header-btn-primary {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  .nav-menu {
    display: block;
  }

  .nav-menu summary {
    height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }
}

@media (max-width: 860px) {
  .wrap {
    padding: 0 22px;
  }
}

@media (max-width: 560px) {
  .wrap {
    padding: 0 18px;
  }

  .site-footer {
    padding: 48px 0 28px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .film-frame {
    border-radius: 14px;
  }

  .film-cta-pill {
    left: 14px;
    bottom: 14px;
    gap: 9px;
    height: 42px;
    padding: 0 15px 0 6px;
  }

  .film-cta-icon {
    width: 28px;
    height: 28px;
  }

  .film-cta-icon::before {
    margin: -5px 0 0 -3px;
    border-width: 5px 0 5px 9px;
  }

  .film-cta-label {
    font-size: 13px;
  }

  .film-meta-pill {
    right: 14px;
    bottom: 14px;
    max-width: calc(100% - 210px);
    padding: 5px 10px;
    font-size: 11px;
  }

  .film-meta-long {
    display: none;
  }

  .film-caption {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .header-btn-primary {
    display: none;
  }
}

@media (max-width: 340px) {
  .film-cta-time {
    display: none;
  }

  .film-meta-pill {
    max-width: calc(100% - 172px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .film-poster,
  .film-cta-pill,
  .film-cta-icon,
  .site-nav a,
  .header-btn {
    transition: none;
  }
}
