/* ============================================================================
   Print-Shop — shared brand stylesheet
   One source of truth for type, color, and the reusable "printed sheet" pieces.
   Linked by every surface: root picker, school home, viewer, admin.
   ========================================================================== */

/* ---- Self-hosted type (offline-capable, matching the vendored flip lib) --- */
@font-face {
  font-family: "Zilla Slab"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("/static/fonts/zillaslab-500.woff2") format("woff2");
}
@font-face {
  font-family: "Zilla Slab"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/static/fonts/zillaslab-700.woff2") format("woff2");
}
/* Newsreader ships as one variable file covering the weight range we use. */
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 400 600;
  font-display: swap; src: url("/static/fonts/newsreader.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/static/fonts/courierprime-400.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("/static/fonts/courierprime-700.woff2") format("woff2");
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  /* Paper is warm NEWSPRINT grey, not cream — the deliberate tell that keeps
     this out of the generic cream+serif+terracotta look. */
  --paper:        #E7E1D3;
  --paper-panel:  #F1ECE0;
  --ink:          #1C1917;
  --ink-soft:     #6B6456;
  --rule:         #C9C1AF;
  --press:        #CB3A1E;  /* single spot ink — functional accent only */

  /* Registration bar swatches (the printer's CMYK calibration strip). Used
     once per page as the signature; never as a general accent palette. */
  --cmyk-c: #1CA3C4;
  --cmyk-m: #D24C86;
  --cmyk-y: #E8B437;
  --cmyk-k: var(--ink);

  --display: "Zilla Slab", Georgia, serif;
  --body:    "Newsreader", Georgia, serif;
  --mono:    "Courier Prime", ui-monospace, "Courier New", monospace;

  --measure: 62rem;   /* the printed sheet's max column */
  --gutter:  1.5rem;
}

/* ---- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  /* faint fibrous newsprint tint — barely-there, not a loud texture */
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,.015) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,.015) 0, transparent 40%);
}

a { color: var(--press); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--press);
  outline-offset: 2px;
  border-radius: 1px;
}

/* ---- The printed sheet --------------------------------------------------- */
.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.5rem) var(--gutter) 4rem;
}

/* ---- Masthead ------------------------------------------------------------ */
.masthead { margin-bottom: 2.5rem; }

.masthead__over {           /* small utility line above the nameplate */
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.masthead__over a { color: var(--ink-soft); text-decoration: none; }
.masthead__over a:hover { color: var(--press); }
.masthead__over .spacer { flex: 1; }

.masthead__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6.5vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  margin: 0;
}

.dateline {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0.75rem 0 0;
}

/* the press-red rule that "prints in" on load */
.rule {
  height: 3px;
  background: var(--press);
  border: 0;
  margin: 1.1rem 0 0;
  transform-origin: left center;
  animation: print-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes print-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---- Registration strip (signature) -------------------------------------- */
/* The CMYK calibration bar printers put on a sheet edge. Small, once per page. */
.reg-strip {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.reg-strip span {
  width: 11px; height: 11px; border-radius: 1px;
  display: block;
}
.reg-strip .c { background: var(--cmyk-c); }
.reg-strip .m { background: var(--cmyk-m); }
.reg-strip .y { background: var(--cmyk-y); }
.reg-strip .k { background: var(--cmyk-k); }

/* ---- Section label ------------------------------------------------------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}

/* ---- Cover / nameplate grid ---------------------------------------------- */
.cover-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.75rem 1.5rem;
}
.cover-card { margin: 0; }
.cover-card a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.cover-card__frame {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--paper-panel);
  border: 1px solid var(--rule);
  overflow: hidden;
  box-shadow: 0 1px 0 var(--rule), 0 10px 22px -14px rgba(28,25,23,.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cover-card a:hover .cover-card__frame {
  transform: translateY(-3px);
  box-shadow: 0 1px 0 var(--rule), 0 16px 30px -14px rgba(28,25,23,.6);
}
.cover-card__frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* fallback tile when an edition has no rendered pages yet */
.cover-card__blank {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; text-align: center;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  color: var(--ink-soft);
}
.cover-card__meta { margin-top: 0.7rem; }
.cover-card__title {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  line-height: 1.15; margin: 0;
}
.cover-card__sub {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0.3rem 0 0;
}

/* Nameplate card variant (root school picker — no cover image) */
.plate-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}
.plate-grid li { margin: 0; }
.plate {
  display: block; color: inherit; text-decoration: none;
  background: var(--paper-panel);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--press);
  padding: 1.15rem 1.25rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 20px -16px rgba(28,25,23,.5);
}
.plate:hover { transform: translateX(3px); box-shadow: 0 12px 24px -16px rgba(28,25,23,.55); }
.plate__name {
  font-family: var(--display); font-weight: 700; font-size: 1.5rem;
  line-height: 1.05; margin: 0;
}
.plate__meta {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0.35rem 0 0;
}

/* ---- Press panel (upload / forms) ---------------------------------------- */
.press-panel {
  background: var(--paper-panel);
  border: 1px solid var(--rule);
  padding: 1.5rem;
  margin-top: 2.5rem;
}
.press-panel__head {
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  margin: 0 0 0.25rem;
}
.press-panel__note {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 1.25rem;
}

.field { display: block; margin-bottom: 1rem; }
.field__label {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft);
  display: block; margin-bottom: 0.35rem;
}
.field input[type=text],
.field input[type=date],
.field input[type=email],
.field input[type=file] {
  width: 100%;
  font-family: var(--body); font-size: 1rem;
  padding: 0.6rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
}
.field input:focus-visible { border-color: var(--press); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  font-family: var(--mono); font-weight: 700; font-size: 0.82rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 0; border-radius: 2px;
  padding: 0.7rem 1.3rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--press); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--ink-soft); cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn--ghost:hover { background: transparent; color: var(--press); border-color: var(--press); }
/* link styled as a button */
a.btn { text-decoration: none; display: inline-block; }

/* ---- Auth (admin) -------------------------------------------------------- */
.auth { max-width: 27rem; margin: 0 auto; padding: clamp(2rem, 8vh, 5rem) 1.5rem; }
.masthead--sm { margin-bottom: 1.75rem; }
.masthead--sm .masthead__title { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.hint { font-size: 0.95rem; color: var(--ink-soft); margin: 0 0 1.2rem; }
.hint strong { color: var(--ink); }

/* ---- Status line --------------------------------------------------------- */
.status {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--ink-soft); min-height: 1.5rem; margin-top: 1rem;
}
.status--error { color: var(--press); }

/* ---- Footer registration echo ------------------------------------------- */
.sheet-foot {
  margin-top: 3.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* ---- Motion / responsive ------------------------------------------------- */
@media (max-width: 30rem) {
  .cover-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .rule { animation: none; }
  .cover-card a, .plate, .btn { transition: none; }
  * { scroll-behavior: auto; }
}

/* Reveal-on-scroll: set by pages that opt in via JS (adds .reveal).
   Without JS or with reduced motion, content is always visible. */
.reveal { opacity: 0; transform: translateY(12px); }
.reveal.is-in { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s ease; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
