/* ==========================================================================
   Shared school design system.

   Mirrors the real app's approach (packages/ui/src/tokens.ts + globals.css):
   every component draws from custom properties, and a tenant stylesheet only
   ever re-points those properties. No component here hardcodes a brand colour.
   ========================================================================== */

*,
*::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: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--display-weight, 600);
  line-height: 1.1;
  letter-spacing: var(--display-tracking, -0.01em);
  margin: 0 0 var(--space-3);
  color: var(--heading);
  text-wrap: balance;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }

p { margin: 0 0 var(--space-3); max-width: 68ch; text-wrap: pretty; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }

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

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

.wrap {
  width: min(100% - var(--gutter) * 2, var(--measure));
  margin-inline: auto;
}

.section { padding-block: clamp(3.5rem, 8vw, 7.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4.5rem); }
.section--dark { background: var(--brand-dark); color: var(--on-brand); }

/* A dark section can take a photographic backdrop; the scrim keeps the type
   legible whether or not the image has arrived. */
.section--photo {
  position: relative;
  background-image: var(--photo, none), var(--section-fallback, var(--plate-bg));
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  isolation: isolate;
}

.section--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--section-scrim, rgb(0 0 0 / 0.68));
}

@media (hover: none) {
  .section--photo { background-attachment: scroll; }
}
.section--dark h2,
.section--dark h3 { color: var(--on-brand); }
.section--tint { background: var(--surface); }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-2);
}

.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--text-muted);
}

.section--dark .lede { color: var(--on-brand-muted); }

.section-head { max-width: 62ch; margin-bottom: var(--space-6); }
.section-head--center { margin-inline: auto; text-align: center; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.75em;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn--primary:hover { background: var(--accent-strong); box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--accent) 70%, transparent); }

.btn--ghost {
  border-color: color-mix(in srgb, currentColor 35%, transparent);
  color: inherit;
  background: transparent;
}
.btn--ghost:hover { border-color: currentColor; background: color-mix(in srgb, currentColor 8%, transparent); }

.btn--solid { background: var(--brand); color: var(--on-brand); }
.btn--solid:hover { background: var(--brand-dark); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--brand);
}
.link-arrow::after { content: "->"; transition: transform 0.18s ease; }
.link-arrow:hover::after { transform: translateX(4px); }
.section--dark .link-arrow { color: var(--accent); }

/* --- Site header -------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 78px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}

.brand-lockup__seal { width: 46px; height: 46px; flex: none; }
.brand-lockup__name {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: var(--display-weight, 600);
  letter-spacing: var(--lockup-tracking, 0.02em);
  line-height: 1.05;
  display: block;
}
.brand-lockup__sub {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.72;
  display: block;
}

.site-nav { display: flex; align-items: center; gap: var(--space-4); }
.site-nav a {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: inherit;
  padding: 0.4rem 0;
  position: relative;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.site-nav a:hover::after { transform: scaleX(1); }

/* Over the hero the header is transparent with light type; once scrolled it
   solidifies. `.is-stuck` is toggled by js/home.js. */
.site-header { background: transparent; color: var(--on-brand); }
.site-header.is-stuck {
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  color: var(--text);
  border-bottom-color: var(--border);
  box-shadow: 0 10px 30px -22px rgb(0 0 0 / 0.6);
}
.site-header.is-stuck .brand-lockup__seal--light { display: none; }
.site-header .brand-lockup__seal--ink { display: none; }
.site-header.is-stuck .brand-lockup__seal--ink { display: block; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .nav-toggle {
    display: inline-flex;
    background: none;
    border: 1px solid currentColor;
    border-radius: var(--radius-btn);
    color: inherit;
    padding: 0.55rem 0.9rem;
    font: inherit;
    font-size: var(--step--1);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .site-nav.is-open {
    display: flex;
    position: absolute;
    inset: 78px 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-3) var(--gutter) var(--space-4);
    background: var(--page);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 40px -30px rgb(0 0 0 / 0.7);
  }
  .site-nav.is-open a { padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
  .site-nav.is-open .btn { margin-top: var(--space-3); justify-content: center; }
}

/* --- Hero --------------------------------------------------------------- */

.hero {
  position: relative;
  margin-top: -78px;
  padding-top: calc(78px + clamp(4rem, 12vh, 9rem));
  padding-bottom: clamp(4rem, 12vh, 8rem);
  color: var(--on-brand);
  overflow: hidden;
  isolation: isolate;
}

/* Photography is layered as a background rather than an <img> so a slot with
   no file yet falls back to the brand gradient instead of a broken image.
   Each page sets --photo inline; see assets/photos/IMAGE-BRIEF.md. */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--photo, none), var(--hero-fallback);
  background-size: cover;
  background-position: var(--photo-position, center);
  background-repeat: no-repeat;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-scrim);
}

.hero h1 {
  font-size: var(--step-6);
  color: var(--on-brand);
  margin-bottom: var(--space-4);
}

.hero__motto {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.hero__motto-en {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-brand-muted);
  margin-bottom: var(--space-5);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

.hero__rule {
  width: 88px;
  height: 2px;
  background: var(--accent);
  border: 0;
  margin: 0 0 var(--space-4);
}

/* --- Stat band ---------------------------------------------------------- */

.stat-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-5);
  border-block: 1px solid var(--rule);
  padding-block: var(--space-5);
}

.stat__value {
  font-family: var(--font-display);
  font-size: var(--step-4);
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.stat__label {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-brand-muted);
  margin: 0;
}

/* --- Cards -------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: var(--space-4);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  box-shadow: 0 22px 45px -30px rgb(0 0 0 / 0.55);
}

.card__figure {
  aspect-ratio: 16 / 10;
  background-image: var(--photo, none), var(--figure-bg);
  background-size: cover;
  background-position: center;
  position: relative;
  display: grid;
  place-items: center;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:hover .card__figure { transform: scale(1.04); }

.card__figure-clip { overflow: hidden; }

.card__figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--figure-overlay, none);
}

.card__body { padding: var(--space-4); display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.card__kicker {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0;
  font-weight: 600;
}
.card h3 { margin: 0; font-size: var(--step-1); }
.card p { margin: 0; color: var(--text-muted); font-size: var(--step--1); }
.card__foot { margin-top: auto; padding-top: var(--space-3); }

/* --- Editorial split ---------------------------------------------------- */

.split {
  display: grid;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split--wide-left { grid-template-columns: 1.15fr 0.85fr; }
}

.plate {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-card);
  background-image: var(--photo, none), var(--plate-bg);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.plate img { width: 62%; }
/* When a photo is in the slot the seal overlay is dropped, so the photograph
   carries the panel on its own. */
.plate--photo img { display: none; }

.plate--framed::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--plate-frame);
  border-radius: calc(var(--radius-card) - 8px);
  pointer-events: none;
}

/* --- Quote -------------------------------------------------------------- */

.quote {
  max-width: 46ch;
  margin-inline: auto;
  text-align: center;
}

.quote blockquote {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.3;
  font-style: italic;
  color: var(--on-brand);
}

.quote figcaption {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- CTA banner --------------------------------------------------------- */

.cta {
  background-image: var(--photo, none), var(--cta-fallback, linear-gradient(var(--brand), var(--brand)));
  background-size: cover;
  background-position: center;
  color: var(--on-brand);
  isolation: isolate;
  border-radius: var(--radius-card);
  padding: clamp(2.25rem, 5vw, 4rem);
  display: grid;
  gap: var(--space-4);
  align-items: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--cta-scrim, none);
}

@media (min-width: 820px) {
  .cta { grid-template-columns: 1.4fr auto; }
}

.cta h2 { color: var(--on-brand); margin-bottom: 0.5rem; }
.cta p { color: var(--on-brand-muted); margin: 0; }

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

.site-footer {
  background: var(--brand-dark);
  color: var(--on-brand-muted);
  padding-block: clamp(3rem, 7vw, 5rem) var(--space-5);
  font-size: var(--step--1);
}

.footer-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  padding-bottom: var(--space-5);
  border-bottom: 1px solid color-mix(in srgb, var(--on-brand) 14%, transparent);
}

.site-footer h4 {
  color: var(--on-brand);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-body);
  margin-bottom: var(--space-3);
}

.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer-list a { color: var(--on-brand-muted); text-decoration: none; }
.footer-list a:hover { color: var(--on-brand); text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-5);
  opacity: 0.75;
}

.footer-bottom p { margin: 0; }

/* The one visible seam between the two halves of this project: the polished
   school site links out to the alumni portal, which is a catastrophe. */
.portal-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

/* --- Scroll reveal ------------------------------------------------------ */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

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