/**
 * School Modern — template stylesheet.
 *
 * Loaded after the shared front-end foundation and before the site's compiled
 * design tokens, so this file can restyle anything the foundation provides while
 * the site owner's colour and font choices still win over both.
 *
 * The rule this template follows throughout: **never hardcode a colour, radius,
 * or spacing value.** Everything reads a custom property. That is the only
 * reason the Live Design Panel can recolour an entire school website instantly,
 * and it is what a third-party template author has to respect too.
 */

/* ------------------------------------------------------------------ */
/* Section rhythm                                                     */
/* ------------------------------------------------------------------ */

/* Alternating sections get a subtle tint so a long home page reads as distinct
   bands rather than one continuous scroll. Applied with :nth-of-type on the
   builder's section wrapper, which means it keeps working no matter how the
   editor reorders, adds, or removes sections — the alternation is positional,
   not baked into any individual section's content. */
[data-section-id]:nth-of-type(even) > div:not([class*="bg-"]) {
  background-color: var(--ui-surface-muted);
}

/* ------------------------------------------------------------------ */
/* Header                                                             */
/* ------------------------------------------------------------------ */

/* A confident brand bar across the top of the page. The gradient uses two steps
   of the brand ramp, so it re-derives itself from whatever primary colour the
   school picks — a maroon school and a navy school both get a coherent header
   with no further work. */
.site-header-accent {
  background: linear-gradient(
    100deg,
    var(--ui-brand-700) 0%,
    var(--ui-brand-600) 45%,
    var(--ui-brand-500) 100%
  );
}

/* The header lifts onto a shadow once the page scrolls, so it separates from
   content without a permanent border competing with the hero. */
header[data-scrolled="true"] {
  box-shadow: var(--ui-shadow-md);
}

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

/* An underline rule beneath section headings — a convention parents recognise
   from school prospectuses, and a cheap way to make a page feel considered. */
.site-heading::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 4px;
  margin-top: 0.875rem;
  border-radius: var(--site-radius-pill);
  background: linear-gradient(90deg, var(--ui-brand-600), var(--ui-accent-500));
}

/* Centred sections need the rule centred with them. */
.text-center .site-heading::after {
  margin-inline: auto;
}

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

/* Without a background image the hero still needs presence, so it takes a soft
   brand wash rather than sitting on flat white. */
[data-section-type="hero_banner"] > div:not(:has(img)) {
  background:
    radial-gradient(48rem 32rem at 12% -20%, color-mix(in oklch, var(--ui-brand-500) 16%, transparent), transparent 62%),
    radial-gradient(36rem 28rem at 108% 118%, color-mix(in oklch, var(--ui-accent-500) 14%, transparent), transparent 58%),
    var(--ui-surface);
}

/* Slightly more generous hero spacing than the global section rhythm — the
   first thing a visitor sees earns the room. */
[data-section-type="hero_banner"] .site-section {
  padding-block: clamp(4rem, 9vw, 8rem);
}

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

/* A brand-coloured top edge that appears on hover. Scaling a pseudo-element
   rather than animating height keeps the whole effect on the compositor, so it
   stays smooth on the low-end Android devices most parents will be using. */
.site-card {
  position: relative;
}

.site-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ui-brand-600), var(--ui-accent-500));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms ease;
}

.site-card:hover::before,
.site-card:focus-within::before {
  transform: scaleX(1);
}

/* ------------------------------------------------------------------ */
/* Notice board                                                       */
/* ------------------------------------------------------------------ */

/* Notices are the most-visited part of a school site, so they get a marker that
   makes each row scannable at a glance. */
[data-section-type="notice_board"] li a {
  border-left: 3px solid transparent;
  transition: border-color 200ms ease, padding-left 200ms ease;
}

[data-section-type="notice_board"] li a:hover {
  border-left-color: var(--ui-brand-500);
  padding-left: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* Counters                                                           */
/* ------------------------------------------------------------------ */

/* Tabular figures so the numbers do not jitter horizontally while counting up. */
[data-counter] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------------ */
/* Principal's message                                                */
/* ------------------------------------------------------------------ */

/* A large decorative quotation mark, marked as presentational so a screen
   reader does not announce a stray punctuation character before the message. */
[data-section-type="principal_message"] blockquote {
  position: relative;
}

[data-section-type="principal_message"] blockquote::before {
  content: "\201C";
  position: absolute;
  top: -2.5rem;
  left: -0.5rem;
  font-family: var(--site-font-heading);
  font-size: 6rem;
  line-height: 1;
  color: var(--ui-brand-500);
  opacity: 0.14;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Print                                                              */
/* ------------------------------------------------------------------ */

/* Schools print pages far more than most organisations — fee structures,
   notices, admission forms go straight to a printer. Worth the twelve lines. */
@media print {
  header,
  footer,
  .site-btn,
  [data-nav-toggle] {
    display: none !important;
  }

  .site-section {
    padding-block: 1rem;
  }

  /* Expand link targets so a printed page remains usable off-screen. */
  .site-prose a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}
