/* ==========================================================================
   The Frestonian — Normanton Grammar School archive
   Single stylesheet. Design tokens taken from the Claude Design artboards.
   ========================================================================== */

:root {
  --paper:      #f4f0e6;  /* page background            */
  --panel:      #fbf9f3;  /* cards, inputs              */
  --frame:      #e9e2d6;  /* image wells                */
  --ink:        #26221c;  /* headings / strong text     */
  --body:       #3a352c;  /* running text               */
  --muted:      #6b6559;  /* captions, metadata         */
  --green:      #1e3a2f;  /* primary                    */
  --maroon:     #7a2e2e;  /* accent                     */
  --gold:       #b08d3a;  /* rules and marks            */
  --line:       rgba(38, 34, 28, 0.18);
  --line-soft:  rgba(38, 34, 28, 0.14);
  --line-firm:  rgba(38, 34, 28, 0.28);

  --serif:   'EB Garamond', Georgia, 'Times New Roman', serif;
  --display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --mono:    ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --shell: 1040px;
  --gutter: 32px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--green); color: var(--paper); }

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

a { color: var(--green); }
a:hover { color: var(--maroon); }

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

/* Skip link ---------------------------------------------------------------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--green);
  color: var(--paper);
  padding: 12px 20px;
  text-decoration: none;
}
.skip:focus { left: 0; color: var(--paper); }

/* Layout ------------------------------------------------------------------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.rule-top { height: 4px; background: var(--green); }

.prose { max-width: 40em; }
.measure { max-width: 44em; }

section { padding-top: 44px; }
section:first-of-type { padding-top: 56px; }

/* Masthead ----------------------------------------------------------------- */

.masthead { padding-top: 30px; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 22px;
}
.wordmark:hover { color: inherit; }
.wordmark svg { flex: none; }

.wordmark-name {
  display: block;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: var(--green);
}
.wordmark-sub {
  display: block;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-top: 5px;
}

.nav-bar {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 13px 0;
  margin: 0;
  list-style: none;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 2px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--maroon); border-bottom-color: var(--maroon); }
.nav a[aria-current='page'] { color: var(--maroon); }

.nav-toggle { display: none; }

/* Headings ----------------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--display);
  color: var(--green);
  margin: 0;
  font-weight: 600;
}

h1 {
  font-weight: 500;
  font-size: clamp(40px, 7.4vw, 56px);
  line-height: 1.04;
  margin-bottom: 16px;
}
.h1-hero { font-size: clamp(44px, 9vw, 64px); line-height: 1.02; margin-bottom: 20px; }

h2 { font-size: clamp(26px, 4.4vw, 34px); line-height: 1.15; margin-bottom: 18px; }
.h2-sm { font-size: clamp(25px, 4vw, 30px); }
h3 { font-size: clamp(21px, 3.4vw, 24px); line-height: 1.3; }

.kicker {
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--maroon);
  margin: 0;
}

.lead {
  font-size: clamp(18px, 2.6vw, 21px);
  line-height: 1.6;
  color: var(--body);
  max-width: 30em;
  margin: 0 0 30px;
}

.dinkus { width: 46px; height: 1px; background: var(--gold); margin-bottom: 20px; }

p { color: var(--body); margin: 0 0 22px; }
p:last-child { margin-bottom: 0; }

.prose p, .measure p { font-size: clamp(17.5px, 2.3vw, 19.5px); line-height: 1.78; }

.note {
  font-size: clamp(17px, 2.2vw, 18.5px);
  line-height: 1.7;
  max-width: 38em;
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.text-link {
  text-decoration: none;
  border-bottom: 1px solid var(--maroon);
  color: var(--maroon);
}
.text-link:hover { background: rgba(122, 46, 46, 0.07); }

/* Buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  background: var(--green);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 15px 28px;
  border: 1px solid var(--green);
  cursor: pointer;
}
.btn:hover { background: var(--maroon); border-color: var(--maroon); color: var(--paper); }

/* Search fields ------------------------------------------------------------ */

.searchbar {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 34em;
}
.searchbar input {
  flex: 1;
  min-width: 14em;
  font-family: var(--serif);
  font-size: 18px;
  padding: 13px 15px;
  border: 1px solid var(--line-firm);
  background: var(--panel);
  color: var(--ink);
  border-radius: 0;
  -webkit-appearance: none;
}
.count { font-size: 16px; color: var(--muted); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 26px 0 0;
}
.chip {
  font-family: var(--serif);
  font-size: 15px;
  padding: 7px 15px;
  cursor: pointer;
  border: 1px solid var(--line-firm);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
}
.chip:hover { border-color: var(--green); }
.chip[aria-pressed='true'] { background: var(--green); border-color: var(--green); color: var(--paper); }

/* Home ---------------------------------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: start;
}

.figure { margin: 0; }
.figure .well { box-shadow: 7px 7px 0 rgba(30, 58, 47, 0.08); }
.figure figcaption {
  font-size: 17px;
  color: #4a463c;
  margin-top: 12px;
  text-align: center;
}

.well {
  aspect-ratio: 4 / 3;
  background: var(--frame);
  border: 1px solid rgba(38, 34, 28, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.well img { width: 100%; height: 100%; object-fit: cover; }

/* Uniform 4:3 tiles suit the gallery grid, but the wide hall photograph on
   the home page would lose its ends to the crop, so it keeps its own ratio. */
.well.is-natural { aspect-ratio: auto; }
.well.is-natural img { height: auto; object-fit: fill; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(38, 34, 28, 0.2);
  background: var(--panel);
  padding: 22px 24px;
  display: block;
}
.card:hover { border-color: var(--green); color: inherit; }
.card-title {
  display: block;
  font-family: var(--display);
  font-size: 25px;
  color: var(--green);
  line-height: 1.2;
}
.card-desc {
  display: block;
  font-size: 16.5px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

/* Magazine grid ------------------------------------------------------------- */

.docs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc { display: block; text-decoration: none; color: inherit; }
.doc:hover .doc-cover { border-color: var(--green); }
.doc:hover .doc-name { color: var(--maroon); }

.doc-cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  background: var(--panel);
  border: 1px solid rgba(38, 34, 28, 0.2);
  overflow: hidden;
}

/* Typographic stand-in, shown when no cover scan has been uploaded yet. */
.doc-plate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  gap: 0;
}
.doc-plate b {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  color: var(--green);
}
.doc-plate span { width: 24px; height: 1px; background: var(--gold); margin: 9px 0; }
.doc-plate i {
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--maroon);
}
.doc-plate em {
  font-style: normal;
  font-family: var(--display);
  font-size: 30px;
  color: var(--ink);
  line-height: 1;
  margin-top: 3px;
}

.doc-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--panel);
}

.doc-name {
  display: block;
  margin-top: 9px;
  font-size: 15px;
  color: #4a463c;
  line-height: 1.4;
}

.empty { font-size: 19px; color: var(--maroon); margin: 10px 0 0; }

/* Photo gallery ------------------------------------------------------------- */

.photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.photo { margin: 0; }
.photo button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  text-align: left;
  color: inherit;
}
.photo button:hover .well { border-color: var(--green); }
.photo figcaption {
  font-size: 16.5px;
  color: #4a463c;
  margin-top: 10px;
  line-height: 1.45;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(30, 58, 47, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 18px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(100%, 1200px);
  max-height: 76vh;
  object-fit: contain;
  border: 1px solid rgba(244, 240, 230, 0.3);
}
.lightbox p {
  color: var(--paper);
  font-size: 17px;
  text-align: center;
  margin: 0;
  max-width: 44em;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1px solid rgba(244, 240, 230, 0.5);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 18px;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(244, 240, 230, 0.14); }
.lightbox-nav { display: flex; gap: 12px; }
.lightbox-nav button {
  background: transparent;
  border: 1px solid rgba(244, 240, 230, 0.5);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 9px 20px;
  cursor: pointer;
}
.lightbox-nav button:hover { background: rgba(244, 240, 230, 0.14); }

/* In memoriam --------------------------------------------------------------- */

.entries { list-style: none; margin: 0; padding: 0; max-width: 44em; }
.entry { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.entry-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.entry-name { font-family: var(--display); font-size: 24px; color: var(--green); line-height: 1.2; }
.entry-role { font-size: 16.5px; color: var(--muted); }
.entry-ref { font-size: 17px; color: var(--body); margin-top: 5px; line-height: 1.55; }
.entry-note { font-size: 16.5px; color: var(--maroon); margin-top: 3px; line-height: 1.5; }

/* References ---------------------------------------------------------------- */

.numeral { color: var(--maroon); }

.archive-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 36px;
  align-items: start;
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 26px;
  font-size: 17.5px;
  line-height: 1.6;
  color: var(--body);
}
.archive-box p { font-size: inherit; line-height: inherit; margin: 0; }
.label {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--maroon);
  margin-bottom: 8px;
}
.aside-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 16.5px;
  color: var(--muted);
}
.hours { list-style: none; margin: 0; padding: 0; max-width: 24em; }
.hours li {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(38, 34, 28, 0.1);
}
.hours span { color: var(--muted); }

.ref-list { list-style: none; margin: 0; padding: 0; max-width: 44em; }
.ref-item { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.ref-title { font-family: var(--display); font-size: 22px; color: var(--green); line-height: 1.3; margin-bottom: 6px; }
.ref-item.numbered .ref-title { font-size: 24px; }
.ref-body { font-size: 17.5px; line-height: 1.62; color: var(--body); margin: 0; }

/* Miscellaneous / placeholders ---------------------------------------------- */

.stub {
  padding: 26px 28px;
  border: 1px dashed rgba(38, 34, 28, 0.3);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12.5px;
  color: #7a6f5c;
  line-height: 1.6;
}

.hairline-top { padding-top: 26px; border-top: 1px solid var(--line); }

/* Contact ------------------------------------------------------------------- */

.contact-card {
  max-width: 32em;
  padding: 30px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.contact-address {
  font-family: var(--display);
  font-size: clamp(24px, 4.6vw, 32px);
  color: var(--green);
  line-height: 1.25;
  margin: 0 0 6px;
  word-break: break-word;
}
.contact-address a { text-decoration: none; border-bottom: 1px solid var(--gold); }

/* Footer -------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 84px;
}
.site-footer .shell {
  padding-top: 24px;
  padding-bottom: 56px;
  font-size: 14.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* Utility ------------------------------------------------------------------- */

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

.noscript-list { columns: 2; font-size: 16px; }
.noscript-list a { color: var(--green); }

/* Shown only when scripting is unavailable; site.js/inline script adds .js
   to <html> before first paint, so there is never a flash of this content. */
.js .nojs-only { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .docs { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 860px) {
  :root { --gutter: 24px; }

  .split { grid-template-columns: 1fr; gap: 32px; }
  .cards { grid-template-columns: 1fr; }
  .docs { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .photos { grid-template-columns: repeat(2, 1fr); }
  .archive-box { grid-template-columns: 1fr; gap: 24px; }
}

/* Collapse the eight-item nav behind a toggle on small screens — but only
   when JavaScript is running, so the list stays open for no-JS visitors. */
@media (max-width: 760px) {
  .js .nav-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 13px 0;
    background: transparent;
    border: 0;
    font-family: var(--serif);
    font-size: 12.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    cursor: pointer;
  }
  .js .nav-toggle::after {
    content: '';
    width: 9px; height: 9px;
    border-right: 1.5px solid var(--maroon);
    border-bottom: 1.5px solid var(--maroon);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .18s ease;
  }
  .js .nav-toggle[aria-expanded='true']::after {
    transform: rotate(-135deg) translate(-2px, -2px);
  }
  .js .nav {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0 0 12px;
  }
  .js .nav-toggle[aria-expanded='true'] + .nav { display: flex; }
  .js .nav li { border-top: 1px solid var(--line-soft); }
  .js .nav a { display: block; padding: 12px 0; }
  .js .nav a:hover { border-bottom-color: transparent; }
}

@media (max-width: 560px) {
  :root { --gutter: 20px; }

  body { font-size: 18px; }
  section { padding-top: 36px; }
  section:first-of-type { padding-top: 40px; }

  .docs { grid-template-columns: repeat(2, 1fr); }
  .photos { grid-template-columns: 1fr; }
  .noscript-list { columns: 1; }

  .btn { width: 100%; justify-content: center; }
  .searchbar input { min-width: 0; width: 100%; flex-basis: 100%; }

  .site-footer { margin-top: 56px; }
  .site-footer .shell { flex-direction: column; gap: 8px; }

  .contact-card { padding: 24px 22px; }
  .wordmark-name { font-size: 25px; }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .nav-bar, .site-footer, .searchbar, .chips, .skip, .lightbox { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
}
