
/* ======================================================================
   Dark: a gallery at night, on a page built from the school's deep tone.
   The photographs are the only bright things. Each page opens on its own
   photo, which fades into the page under the title; the sections hang in a
   narrow column down the middle, some on a dark panel, none ruled off. One
   lit accent, the school colour lifted until it reads on the dark (--hi),
   fills the main button and marks the date numbers; nothing else uses it.
   Loads over mayfair.css for the type and the first screen. Every colour
   derives from the site's variables; the tokens are set on body so they win
   over the site's /theme.css on :root.
   ====================================================================== */
/* the site's light tint, kept here before body turns --accent-tint dark */
html { color-scheme: dark; --light-tint: var(--accent-tint); }
body {
  /* plain greys and the school's light tint for a browser without relative colour */
  --page: #16161A;
  --sheet: #222228;
  --ink: #F2F2F4;
  --muted: #C6C6CC;
  --hi: var(--light-tint);
  /* links are ink, underlined; the accent stays on the button and the dates */
  --link: var(--ink);
  --hair: rgb(255 255 255 / .15);
  --line: var(--hair);
  --field: var(--page);
  --plate: var(--page);
  --panel: var(--sheet);
  --close-field: var(--page);
  --paper: var(--page); --band: var(--sheet); --accent-tint: var(--sheet);
  --on-deep: var(--ink);
  --open: oklch(.86 .12 150); --wait: oklch(.88 .11 85);
  color: var(--ink);
}
@supports (color: color-mix(in srgb, red, red)) { body { --hair: color-mix(in oklab, var(--ink) 15%, var(--page)); } }
@supports (color: oklch(from red l c h)) {
  body {
    --page: oklch(from var(--deep) .2 min(c, .032) h);
    --sheet: oklch(from var(--deep) .245 min(c, .036) h);
    --ink: oklch(from var(--deep) .96 min(c, .012) h);
    --muted: oklch(from var(--deep) .8 min(c, .025) h);
    /* the school colour, lifted until it reads on the dark page (AA at any hue) */
    /* public-a11y-1#5: a near-grey accent lifts toward the ink, so the main button reads as a
       white fill, not a grey one that looks off */
    --hi: oklch(from var(--accent) max(l, .76 + .2 * clamp(0, (.04 - c) * 25, 1)) min(c, .16) h);
  }
}
h1, h2, h3, .facts b, .top .home, .rows a, .doc, .letter, .nav > nav a, .top .menu, .lines { color: var(--ink); }
a { text-decoration-color: var(--muted); }
.ic, .rows a .ic, .doc .ic, .items .mark, .hero .town .ic { color: var(--muted); }
.btn .ic { color: currentColor; }
.top { background: var(--page); }
/* a logo drawn for white paper sits on a small light chip */
.top .logo { background: var(--ink); padding: 4px 6px; height: 42px; box-sizing: border-box; border-radius: 3px; }
/* a wide wordmark beside the name stays a small chip, not a bright slab across the header */
.top .home > .logo:not(.alone) { max-width: min(180px, 40%); }
.top .home:has(> .name.sr) > .logo:not(.alone) { max-width: min(180px, 52vw); }
/* On the dark page the open menu gets its edge from a hairline of light; its shadow is the
   school's deep tone pressed towards black, in steps, not one black blur. */
.nav > nav { box-shadow: 0 1px 0 rgb(255 255 255 / .1), 0 6px 12px rgb(0 0 0 / .2), 0 18px 30px -8px rgb(0 0 0 / .3);
  box-shadow: 0 1px 0 rgb(255 255 255 / .1), 0 6px 12px color-mix(in oklch, color-mix(in oklch, var(--deep) 40%, #000) 26%, transparent),
    0 18px 30px -8px color-mix(in oklch, color-mix(in oklch, var(--deep) 40%, #000) 34%, transparent); }
.nav > nav a[aria-current="page"] { color: var(--ink); }

/* type on the dark page: a step heavier than on white, so light strokes hold in glare */
h1, h2 { font-weight: 400; }
.hero h1, .hero.bare h1, .page-head h1, .block h2 { font-weight: 400; color: var(--ink); }
.facts b, .table dd, .tile b, .foot .who b { font-weight: 400; }
.lede, .welcome p, .visit address { font-weight: 400; }
.hero-text, .hero.bare .hero-text { color: var(--ink); }
/* the name on a phone: the size of an inner page's title, a step above the section headings */
@media (max-width: 959px) { .hero h1 { font-size: 2.75rem; } .hero h1.long { font-size: 2.125rem; } }
.hero .town { color: var(--muted); }

/* the photo, taller, fades into the page under the name: the fade is solid by the time the
   name starts (--fade), so it reads on any photo. Eased, so the photo has no hard seam */
.hero img { height: 66vw; }
.hero.tall img { height: 76vw; }
.opening > .hero:not(.bare) .hero-text, :is(.page-head:has(> .head-photo) h1) { --fade: 60px; position: relative; margin: -88px 0 0; padding: 64px var(--pad) 12px;
  background: linear-gradient(to bottom, transparent, var(--page) var(--fade)); }
@supports (color: color-mix(in oklab, red, blue)) {
  .opening > .hero:not(.bare) .hero-text, :is(.page-head:has(> .head-photo) h1) {
    background: linear-gradient(to bottom, transparent, color-mix(in oklab, var(--page) 10%, transparent) calc(var(--fade) * .2),
      color-mix(in oklab, var(--page) 35%, transparent) calc(var(--fade) * .4), color-mix(in oklab, var(--page) 65%, transparent) calc(var(--fade) * .6),
      color-mix(in oklab, var(--page) 90%, transparent) calc(var(--fade) * .8), color-mix(in oklab, var(--page) 97%, transparent) calc(var(--fade) * .9),
      var(--page) var(--fade)); }
}
/* no photo: the name large on the page, nothing behind it */
.hero.bare::before { display: none; }
.hero.bare .hero-text { margin: 0; padding: 40px var(--pad) 4px; background: none; }

/* inner pages open the same way, on the page's own photo */
.page-head::before { display: none; }
.page-head > .head-photo { display: block; width: 100%; height: 72vw; object-fit: cover; }
.page-head h1 { width: auto; max-width: none; margin: 0; padding: 40px var(--pad) 4px; background: none; font-size: 2.75rem; }

/* the first screen */
.btn.main { background: var(--hi); color: var(--page); box-shadow: none; }
.btn.alt { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--muted); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 45%, var(--page)); }
/* the status: its colour on the dot only, the words in ink, a faint ring round it */
.status.open, .status.wait { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.status.open::before { background: var(--open); }
.status.wait::before { background: var(--wait); }
.status span { color: var(--muted); }
/* second#DES-27: the ring keeps to the words, so it never reads as an empty field */
.status.status { width: fit-content; max-width: 100%; }
.first { border-bottom: 0; }

/* dates: the day lit, in a faint frame */
.tile { background: transparent; border-color: var(--line); color: var(--hi); }
/* the month at a readable size, in ink */
.tile small { color: var(--ink); font-size: .875rem; }
.next { background: transparent; border-color: var(--line); }

/* no rules over figures, tables and lists: the panel or the space marks them */
.facts, .table, .list { border-top: 0; }
.facts div { border-color: var(--line); }
.facts div:first-child, .facts div:nth-child(2) { padding-top: 0; }
@media (max-width: 959px) { .intro > .facts { margin-top: 28px; } }
.welcome { border-left: 0; padding-left: 0; }
.letter { border: 0; padding: 0; }
.steps li::before { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.items .mark, .block.band .items .mark { background: transparent; border-color: var(--line); }

/* sections: on the page, or on a dark panel where the site marks a band. The photos hang
   on the bare page, edge to edge. */
.block.band, .block.band-wide, .pair.band-wide { background: var(--sheet); }
.block.band:has(> .photos, > .gallery, > .status:only-child) { background: none; }
.block.close, .block.close.band { padding: 48px var(--pad); background: var(--sheet); }
/* on a phone the dates and the newsletter share one panel, at the section rhythm inside it */
@media (max-width: 959px) { .pair > .block.band-wide + .block.band-wide { padding-top: 0; } }
.block:has(> .photos) { padding-inline: 0; }
.block:has(> .photos) > .head2 { padding-inline: var(--pad); }
.photos { gap: 3px; }
/* photos in the page: plain, a touch dimmer so a bright sky does not glare; the hero keeps its light */
/* second#DES-60: no dimming filter, so a dark indoor photo keeps its edge on the dark page */
.photos img, .gallery img { padding: 0; background: none; box-shadow: none; }
.letter svg, .doc .cover { filter: brightness(.94); }

.foot { background: #111114; border-top: 0; }
@supports (color: oklch(from red l c h)) { .foot { background: oklch(from var(--deep) .15 min(c, .028) h); } }
.foot .who b { color: var(--ink); }
.foot nav a { color: var(--muted); }
.foot nav a:hover { color: var(--ink); }

@media (min-width: 960px) {
  .hero img { height: clamp(400px, 58vh, 600px); }
  .hero.tall img { height: clamp(440px, 64vh, 680px); }
  .top-links a { color: var(--muted); }
  .top-links a:hover, .top-links a[aria-current="page"] { color: var(--ink); }
  .top-links a[aria-current="page"]::after { background: var(--ink); }
  .hero h1, .hero.bare h1 { font-weight: 400; }
  /* the name across the content width, on the photo's faded lower edge */
  .opening > .hero:not(.bare) .hero-text { --fade: 104px; width: auto; min-width: 0; max-width: none; margin: -168px 0 0; padding: 112px var(--side) 30px; }
  .hero.bare .hero-text { width: auto; min-width: 0; max-width: none; margin: 0; padding: 88px var(--side) 8px; }

  /* inner pages: one narrow column down the middle of the page; the photos keep the wide one */
  main:has(> .page-head) { --wide: max(var(--pad), calc((100% - 1120px) / 2)); --side: max(var(--pad), calc((100% - 720px) / 2)); }
  main:has(> .page-head) .block:has(> .gallery, > .list) { --side: max(var(--pad), calc((100% - 720px) / 2)); }
  main:has(> .page-head) .block:has(> .gallery, > .list) > :not(.gallery, .list, .more-photos) { margin-inline: 0; }
  main:has(> .page-head) .block:has(> .gallery) { --side: var(--wide); }
  .list { grid-template-columns: 1fr 1fr; column-gap: 32px; }
  /* the page's photo keeps to the wide column, so a wide screen neither crops it to a strip nor
     stretches it past its largest size */
  .page-head > .head-photo { width: calc(100% - 2 * var(--wide)); margin-inline: var(--wide); height: clamp(380px, 56vh, 560px); }
  /* second#DES-59: the photo is drawn above most of the faded strip under the title, so its
     focal point sits in the part that shows and heads are not cut at the top */
  .page-head > .head-photo { padding-bottom: 64px; }
  .page-head h1, :is(.page-head:has(> .head-photo) h1) { min-width: 0; max-width: none; width: auto; font-size: 4rem; font-weight: 400; letter-spacing: -.035em; }
  .page-head h1 { margin: 0; padding: 104px var(--side) 8px; }
  .page-head:has(> .head-photo) h1 { --fade: 104px; margin: -168px 0 0; padding: 112px var(--side) 8px; }
  main > .page-head + .first, main > .page-head + .block { padding-top: 40px; }

  /* in the column everything stacks: the heading over its text, one list a line */
  :is(body main:has(> .page-head) .block), :is(body .block:has(> .welcome)), :is(body main:has(> .page-head) .visit:not(:has(> .acts, > .rows))),
  body .block.close:not(.visit), :is(body .block.intro.intro.intro:not(:has(> .facts))),
  :is(body main:has(> .page-head) .block:is(:has(> h2 + .text:last-child), :has(> h2 + .table:not(:has(> :nth-child(3))):last-child))),
  :is(body main:has(> .page-head) .block:has(> h2 + .next:last-child)),
  :is(body main:has(> .page-head) .block.visit.visit.visit:not(:has(> address, > .acts))) { display: block; }
  main:has(> .page-head) .visit > .campuses { margin-top: 20px; }
  body main:has(> .page-head) :is(.table, .steps, .items, .docs):has(> :nth-child(3)) { display: block; }
  main:has(> .page-head) .block > :not(p, .text, .note) { max-width: none; }
  .block:has(> .welcome) > .welcome { margin-top: 20px; }
  body .block > h2 + *, :is(body main:has(> .page-head) .block > :not(:first-child):last-child),
  :is(body main:has(> .page-head) .block:is(:has(> h2 + .text:last-child), :has(> h2 + .table:not(:has(> :nth-child(3))):last-child)) > :last-child),
  :is(body main:has(> .page-head) .visit:not(:has(> .acts, > .rows)) > address) { margin-top: 20px; }
  /* second#DES-23: Mayfair's 8 px step beside the heading would win over the 20 px one here */
  body .block.intro.intro.intro:not(:has(> .facts)) > :nth-child(2),
  body .block.visit.visit.visit:not(:has(> address, > .acts)) > .rows { margin-top: 20px; }
  .block.close:not(.visit) > .acts { margin-top: 24px; }
  .block.close:not(.visit) > .rows { margin-top: 16px; }
  main:has(> .page-head) .first.touch { display: block; padding: 40px var(--side) 48px; }
  main:has(> .page-head) .first.touch .rows { margin-top: 16px; }

  /* the panels: inset from the page's edge by their own padding, so the text keeps the column */
  :is(.block.band-wide, .pair.band-wide, .block.close):not(.pair > *, :has(> .photos, > .gallery, > .status:only-child)) {
    --inset: max(0px, calc(var(--side) - 64px)); margin-inline: var(--inset); padding-inline: calc(var(--side) - var(--inset)); }
  :is(.block.band-wide:not(.pair > *, :has(> .photos, > .gallery, > .status:only-child))), .block.close { padding-block: 64px; }
  .pair.band-wide { padding-block: 64px; }
  .pair > .block, .pair > .block.band { background: none; }
  /* on Home the column is wide, so the panel stands further in from the edge */
  body main:not(:has(> .page-head)) .block.close.close { --inset: max(0px, calc(var(--side) - 40px)); }
  main:not(:has(> .page-head)) .pair.band-wide { background: none; }
  .block.close, .block.close.band { margin-bottom: 64px; background: var(--sheet); }
  .block.band:not(.band-wide) { background: none; }

  /* Home's photos edge to edge, three across and large */
  .block:has(> .photos) { padding: 64px 0; }
  .block:has(> .photos) > .head2 { padding-inline: var(--side); }
  .photos { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .photos img, .photos .wide, .photos:not(.two) :is(img, .wide) { grid-column: auto; grid-row: auto; height: auto; aspect-ratio: 3 / 2; }
}
