/* PGP PRO Co'27 — "annotated notebook" design system.
   Language taken from the ME Session 1 interactive: Literata serif body,
   Caveat cursive display, Patrick Hand labels, IBM Plex Mono figures;
   paper ground, ink-navy text, red/green/blue annotation accents.
   Pages load: Caveat:wght@500;700, Literata (opsz 7..72, 400/600/it),
   Patrick Hand, IBM Plex Mono:wght@400;600 from Google Fonts.
   The tote (site/tote/) does NOT link this file and keeps its own look. */

[hidden] { display: none !important; }

:root {
  --bg: #f7f4ec;
  --panel: #fffdf8;
  --panel-2: #efeadf;
  --line: #dcd6c8;
  --ink: #1b2a4a;
  --ink-2: #4a5670;
  --ink-3: #7c869a;
  --accent: #2c4f9e;      /* annotation blue */
  --red: #b8322f;         /* annotation red */
  --ok: #2e7d5b;          /* annotation green */
  --hl: #ffe873;          /* highlighter */
  --hl-ink: #3d3200;
  --danger: #b8322f;
  --warn: #a8741b;
  --focus: #b8322f;
  --shadow: 0 1px 2px rgba(27, 42, 74, 0.08), 0 8px 24px -12px rgba(27, 42, 74, 0.25);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e2430;
    --panel: #252c3a;
    --panel-2: #171c26;
    --line: #333b4b;
    --ink: #e8e4d8;
    --ink-2: #b8b4a8;
    --ink-3: #8b93a3;
    --accent: #8fb0ff;
    --red: #ee7b74;
    --ok: #6fc79c;
    --hl: #c9a800;
    --hl-ink: #1a1500;
    --danger: #ee7b74;
    --warn: #e0b455;
    --focus: #ee7b74;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1e2430;
  --panel: #252c3a;
  --panel-2: #171c26;
  --line: #333b4b;
  --ink: #e8e4d8;
  --ink-2: #b8b4a8;
  --ink-3: #8b93a3;
  --accent: #8fb0ff;
  --red: #ee7b74;
  --ok: #6fc79c;
  --hl: #c9a800;
  --hl-ink: #1a1500;
  --danger: #ee7b74;
  --warn: #e0b455;
  --focus: #ee7b74;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* Legacy aliases (older markup still references these). */
:root {
  --card: var(--panel);
  --green: var(--accent);
  --green-ink: var(--panel);
  --ochre: var(--warn);
  --ochre-soft: var(--panel-2);
  --bar: var(--accent);
  --win: var(--hl);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Literata", Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--accent); }

/* Type roles */
h1 {
  font-family: "Caveat", cursive; font-weight: 700;
  font-size: clamp(38px, 6vw, 56px); line-height: 0.95;
  margin: 6px 0 10px; color: var(--accent); text-wrap: balance;
}
/* Pen-stroke underline: exactly as wide as the title text, wavy like a real
   hand. The motion block below animates it drawing in. */
.wrap h1 { width: fit-content; max-width: 100%; }
.wrap h1::after {
  content: ""; display: block; height: 8px; width: 100%; margin-top: 5px;
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'%3E%3Cpath d='M4 6 Q 60 2.5 120 6 T 240 5 T 396 6.5' stroke='black' stroke-width='4.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left center / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 12' preserveAspectRatio='none'%3E%3Cpath d='M4 6 Q 60 2.5 120 6 T 240 5 T 396 6.5' stroke='black' stroke-width='4.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left center / 100% 100%;
}
h1 em, h1 span { color: var(--red); font-style: normal; }
h2 {
  font-family: "Caveat", cursive; font-weight: 700; font-size: 34px;
  line-height: 1; margin: 44px 0 12px; color: var(--accent);
  text-wrap: balance; scroll-margin-top: 70px;
}
h3 {
  font-family: "Caveat", cursive; font-weight: 700; font-size: 25px;
  margin: 22px 0 6px; color: var(--red); line-height: 1.05;
}
.eyebrow {
  font-family: "Patrick Hand", cursive; color: var(--ink-3);
  letter-spacing: 0.06em; text-transform: uppercase; font-size: 13px;
}
.lede { font-size: 18px; color: var(--ink-2); max-width: 62ch; margin: 0 0 8px; }
.hand { font-family: "Patrick Hand", cursive; }
.num, .mono { font-family: "IBM Plex Mono", monospace; font-size: 0.92em; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); font-size: 15px; margin: 0 0 20px; }
.hl { background: linear-gradient(transparent 12%, var(--hl) 12%, var(--hl) 90%, transparent 90%); color: inherit; padding: 0 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; }

header.site {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header.site strong { font-family: "Caveat", cursive; font-weight: 700; font-size: 24px; color: var(--ink); }
header.site a { color: inherit; text-decoration: none; }
header.site a:hover { color: var(--red); }
header.site .who { font-family: "Patrick Hand", cursive; font-size: 15px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; }

/* Surfaces */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
a.card { text-decoration: none; color: inherit; display: block; transition: border-color 0.15s ease, transform 0.15s ease; }
a.card:hover { border-color: var(--red); transform: translateY(-1px); }
.card h3 { margin: 0 0 6px; color: var(--ink); font-size: 26px; }
.card h3 small { font-family: "Patrick Hand", cursive; font-weight: 400; font-size: 14px; color: var(--ink-3); margin-left: 8px; }
.grid-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* The wobbly hand-drawn callout from the interactives. */
.note {
  border: 1.5px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 12px 16px; margin: 14px 0;
  background: var(--panel); max-width: 70ch;
}
.note.r { border-color: var(--red); }
.note.g { border-color: var(--ok); }
.note.b { border-color: var(--accent); }
.note h4 { font-family: "Patrick Hand", cursive; font-size: 18px; margin: 0 0 4px; color: var(--red); font-weight: 400; }
.note.g h4 { color: var(--ok); }
.note.b h4 { color: var(--accent); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ink); color: var(--bg);
  border: 1.5px solid var(--ink); border-radius: 8px;
  padding: 7px 16px; font: 400 16px/1.3 "Patrick Hand", cursive;
  letter-spacing: 0.02em; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); border-color: var(--ink); }
.btn.warn { background: transparent; color: var(--red); border-color: var(--red); }
.btn.warn:hover { background: var(--red); color: #fff; }
.btn.small { padding: 4px 11px; font-size: 14px; }

.pill {
  display: inline-flex; align-items: center;
  font: 400 15px/1.4 "Patrick Hand", cursive;
  padding: 2px 12px; border-radius: 999px;
  border: 1.5px solid currentColor; background: transparent;
  color: var(--accent);
}
.pill.ok, .pill.approved, .pill.open { color: var(--ok); }
.pill.warn, .pill.pending, .pill.closed { color: var(--warn); }
.pill.danger, .pill.rejected { color: var(--red); }
.pill.settled { color: var(--ink-3); }

/* Form labels sit above their fields. */
label.hand { display: block; margin: 12px 0 4px; }

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"],
textarea, select {
  background: var(--panel); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font: 400 15px/1.5 "Literata", Georgia, serif;
  width: 100%;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th { font-family: "Patrick Hand", cursive; font-weight: 400; color: var(--red);
     text-align: left; border-bottom: 2px solid var(--red); padding: 6px 8px; font-size: 17px; }
td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
.tbl { overflow-x: auto; }

/* Boot state: pages start here; watchGate swaps to the real view.
   Prevents the sign-in view flashing before auth resolves. */
.boot { display: grid; place-items: center; min-height: 45vh; }
.boot .dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--red);
  animation: ppt-spin 0.8s linear infinite;
}
@keyframes ppt-spin { to { transform: rotate(360deg); } }

/* ---- motion: things draw and settle like ink on paper ----
   Animations fire when a hidden section renders, so no JS is needed.
   Everything lives behind the no-preference gate: reduced-motion users
   get the static page. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes ppt-rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
  @keyframes ppt-ink { from { width: 0; } to { width: 100%; } }
  @keyframes ppt-pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
  @keyframes ppt-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
  @keyframes ppt-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

  /* Page arrival: eyebrow, then the title with its pen-stroke underline. */
  .wrap .eyebrow { animation: ppt-rise 0.3s both; }
  .wrap h1 { animation: ppt-rise 0.35s 0.05s both; }
  .wrap h1::after { animation: ppt-ink 0.4s 0.3s both; }
  .lede, .sub { animation: ppt-rise 0.35s 0.15s both; }

  /* Cards ripple in, quickly. */
  .grid-cards > .card { animation: ppt-rise 0.35s both; }
  .grid-cards > .card:nth-child(2) { animation-delay: 0.05s; }
  .grid-cards > .card:nth-child(3) { animation-delay: 0.1s; }
  .grid-cards > .card:nth-child(4) { animation-delay: 0.15s; }
  .grid-cards > .card:nth-child(5) { animation-delay: 0.2s; }
  .grid-cards > .card:nth-child(n+6) { animation-delay: 0.25s; }

  /* Lifting a card off the desk. */
  a.card { transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease; }
  a.card:hover { transform: translateY(-2px) rotate(-0.3deg); }

  /* Fold-outs ease open instead of popping. */
  details[open] > .card, details[open] > div { animation: ppt-rise 0.25s both; }

  /* Viewers and popups ease in. */
  #viewerBox:not([hidden]), #lightbox:not([hidden]) .frame { animation: ppt-pop 0.18s ease-out both; }
  #lightbox:not([hidden]) { animation: ppt-rise 0.15s both; }

  /* The ticker slides down into place. */
  .ticker:not([hidden]) { animation: ppt-drop 0.35s 0.2s both; }

  /* Votes feel pressed; the chosen side pulses once when it lands. */
  .votebox button { transition: transform 0.1s ease; }
  .votebox button:active { transform: scale(0.88); }
  .votebox button.on { animation: ppt-pulse 0.3s ease; }
}

/* Source-citation chip: study pages cite the PDF they came from. */
.src {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 10px; border-radius: 999px;
  font: 400 14px/1.5 "Patrick Hand", cursive;
  color: var(--ink-3); background: transparent;
  border: 1px dashed var(--ink-3); text-decoration: none;
  vertical-align: 2px; white-space: nowrap;
}
.src:hover { color: var(--red); border-color: var(--red); }
