/* Educated by Nature — site styles. Brand rules: see pages/brand.py and the Brand Guidelines PDF. */

/* Type (pp.18-21). "EBN Display" is Chivo Black, the approved fallback, until a Community Gothic web licence
   is bought; then point this src at CommunityGothic-Black.woff2 and re-measure the djiti perch offset (.perch > .djiti). */
@font-face { font-family: "EBN Display"; src: url("../fonts/Chivo-Black.e4f2408eb9f3.woff2") format("woff2"); font-weight: 900; font-display: swap; }
@font-face { font-family: "Bastardo Grotesk"; src: url("../fonts/BastardoGrotesk-Light.9b3fcb053752.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Bastardo Grotesk"; src: url("../fonts/BastardoGrotesk-Semibold.f162b580c68a.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bastardo Grotesk"; src: url("../fonts/BastardoGrotesk-Bold.aa373ceda84e.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Chivo Mono"; src: url("../fonts/ChivoMono-Regular.e0e22717221a.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Chivo Mono"; src: url("../fonts/ChivoMono-Bold.7c0688e114da.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --font-display: "EBN Display", "Chivo", sans-serif;
  --font-text: "Bastardo Grotesk", "Archivo", sans-serif;
  --font-technical: "Chivo Mono", monospace;
  --size-body: 1.125rem;
  --size-technical: 0.8125rem;
  --size-h3: 1.5rem;
  --size-h2: clamp(2rem, 4vw, 2.75rem);
  --size-display: clamp(3rem, 9vw, 7rem);
  --gutter: clamp(1rem, 4vw, 3rem);
  --max: 82rem;
  /* The one corner radius, taken from the logo blocks and masking shapes (radius / block height ≈ 0.16). */
  --radius: 0.16;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 300 var(--size-body)/1.55 var(--font-text); background: var(--soot); color: var(--soot); }
main { background: var(--wandoo); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
p, ul, ol { margin: 0 0 1em; }
strong, b { font-weight: 600; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 10; padding: 0.5rem 1rem; }
.skip:focus { left: 0; }

/* Roles */
.display { font: 900 var(--size-display)/0.9 var(--font-display); text-transform: uppercase; letter-spacing: -0.01em; margin: 0; }
.h-upper { font: 700 var(--size-h2)/1 var(--font-text); text-transform: uppercase; letter-spacing: -0.01em; margin: 0 0 0.6em; }
.h-sentence { font: 600 var(--size-h3)/1.15 var(--font-text); margin: 0 0 0.5em; }
.technical { font: 400 var(--size-technical)/1.4 var(--font-technical); text-transform: uppercase; letter-spacing: 0.16em; margin: 0; }
.technical strong, .technical.bold { font-weight: 700; }
.prose { max-width: 38em; }
.prose a { font-weight: 600; }

/* Button: Technical type in a solid block with the brand radius (roll-up banners, pp.49-50). */
.btn {
  --h: 3em;
  display: inline-flex; align-items: center; min-height: var(--h); padding: 0 1.25em;
  font: 700 var(--size-technical)/1 var(--font-technical); text-transform: uppercase; letter-spacing: 0.16em;
  text-decoration: none; background: var(--fg); color: var(--alt); border: 0;
  border-radius: calc(var(--h) * var(--radius)); cursor: pointer;
}
.btn:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.btns { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }

/* Header: sits on the opener's ground so the page leads with one colour field. */
.edge { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem; }
.edge > p { white-space: nowrap; }
.masthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; padding-top: 1.5rem; }
.logo { width: var(--logo-w); height: auto; }
.masthead .logo-link { display: block; flex: none; }
.nav-toggle { display: none; }
.nav > ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; margin: 0; padding: 0; list-style: none; }
.nav a, .nav summary { font: 700 var(--size-technical)/1 var(--font-technical); text-transform: uppercase; letter-spacing: 0.16em; text-decoration: none; cursor: pointer; padding: 0.5rem 0; display: block; }
.nav a[aria-current="page"], .nav a:hover, .nav summary:hover { text-decoration: underline; }
.nav summary { list-style: none; }
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after { content: " +"; }
.nav details[open] summary::after { content: " –"; }
.nav details { position: relative; }
.nav details ul { list-style: none; margin: 0; padding: 0.75rem 1.25rem; position: absolute; z-index: 5; left: -1.25rem; min-width: 16rem; background: var(--bg); color: var(--fg); }
.nav details li a { font-weight: 400; }

@media (max-width: 860px) {
  .js .nav-toggle { display: inline-flex; }
  .js .nav { display: none; flex-basis: 100%; }
  .js .nav.is-open { display: block; }
  .masthead { flex-wrap: wrap; }
  .nav > ul { flex-direction: column; gap: 0; }
  .nav details ul { position: static; padding: 0 0 0.5rem 1rem; min-width: 0; }
}

/* Opener: one colour field, display line, one masking device. */
.opener { padding-bottom: clamp(2.5rem, 6vw, 5rem); overflow: hidden; }
.opener-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gutter); align-items: end; margin-top: clamp(2.5rem, 7vw, 6rem); }
.opener-grid.no-image { grid-template-columns: minmax(0, 1fr); }
.opener-text { container-type: inline-size; }
.opener-text .technical { margin-bottom: 1.25rem; }
/* Shrink the display line so its longest word always fits the column (≈0.68em per Chivo Black capital). */
.opener-text .display, .welcome-heading .display { font-size: min(var(--size-display), 100cqi / (var(--chars) * 0.68)); }
.opener-intro { margin: 1.5rem 0 0; max-width: 30em; }
@media (max-width: 800px) { .opener-grid { grid-template-columns: minmax(0, 1fr); } .opener-figure { order: -1; } }

/* Masking shapes (pp.31-33): the supplied SVG is the mask, its own tilt and radius untouched. */
.masked { margin: 0; aspect-ratio: var(--ratio); mask: var(--mask) center / 100% 100% no-repeat; -webkit-mask: var(--mask) center / 100% 100% no-repeat; }
.masked img { width: 100%; height: 100%; object-fit: cover; }

/* Djiti-djiti (pp.34-35): small, flat, one per page, perched on type or in the margin. Never mirrored. */
/* Inline SVG (not a CSS mask) so it stays crisp when the heading is rotated. */
.djiti { display: block; width: 0.55em; height: auto; aspect-ratio: 4871 / 5532; fill: currentColor; fill-rule: evenodd; pointer-events: none; }
.perch { position: relative; display: inline-block; }
.display:has(.perch) { padding-top: 0.45em; }
/* Feet sink 0.08em into the capitals (p.35). Cap top sits 0.11em below the perch top: Chivo Black ascent 0.94 − cap 0.686 − half-leading 0.145 at line-height 0.9. */
.perch > .djiti { position: absolute; bottom: calc(100% - 0.11em - 0.08em); }
.perch.at-end > .djiti { right: 0.08em; }
.perch.at-start > .djiti { left: 0.08em; }
.djiti.margin { position: absolute; font-size: 6rem; color: var(--soot); }
.djiti.margin-top { top: -2.6rem; right: var(--gutter); }
.djiti.margin-bottom { bottom: 0; left: var(--gutter); }
main { position: relative; }
main:has(.djiti.margin-top) > .section:first-of-type, main:has(.djiti.margin-top) > :first-child { padding-top: 4rem; }

/* Sections */
.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section > .wrap > .technical:first-child { margin-bottom: 2rem; }
.section > .wrap > * + * { margin-top: 2rem; }
.block-text { max-width: 38em; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gutter); align-items: center; }
.split.image-left .split-figure { order: -1; }
.cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--gutter); }
.cols .technical { margin-bottom: 0.75rem; }
@media (max-width: 800px) { .split, .cols { grid-template-columns: minmax(0, 1fr); } .split.image-left .split-figure { order: 0; } }

.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: min(80%, 34rem); gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 1rem; }
.carousel figure { margin: 0; scroll-snap-align: start; }
.carousel img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.embed iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }

.faq details { border-top: 1px solid currentColor; padding: 1rem 0; }
.faq details:last-child { border-bottom: 1px solid currentColor; }
.faq summary { font: 600 1.25rem/1.3 var(--font-text); cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-technical); }
.faq details[open] summary::after { content: "–"; }
.faq .answer { padding-top: 0.75rem; max-width: 38em; }

.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 2.5rem var(--gutter); list-style: none; margin: 0; padding: 0; }
.team img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; margin-bottom: 1rem; }
.team .h-sentence { margin: 0 0 0.25rem; }

.posts { list-style: none; margin: 0; padding: 0; }
.posts li { border-top: 1px solid currentColor; padding: 1.25rem 0; display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 0.5rem 2rem; }
.posts + .h-sentence { margin-top: 2.5rem; }
.posts h4.h-sentence { margin: 0 0 0.25rem; }
.posts li:last-child { border-bottom: 1px solid currentColor; }
.posts .h-sentence a { text-decoration: none; }
.posts .h-sentence a:hover { text-decoration: underline; }
@media (max-width: 640px) { .posts li { grid-template-columns: minmax(0, 1fr); } }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; padding: 0; margin: 0 0 2rem; }
.tags a[aria-current] { text-decoration: underline; }

/* Forms */
.form { max-width: 38em; display: grid; gap: 1.25rem; }
.form label { display: block; font: 700 var(--size-technical)/1.4 var(--font-technical); text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 0.4rem; }
.form input:not([type=checkbox]):not([type=radio]), .form textarea, .form select {
  width: 100%; font: 300 var(--size-body)/1.4 var(--font-text); color: var(--soot); background: var(--wandoo);
  border: 1px solid var(--fg); border-radius: 0; padding: 0.7rem 0.8rem; }
.form .helptext, .form .errorlist { font-size: 0.9rem; }
.form .errorlist { list-style: none; padding: 0; font-weight: 600; }
.form .hp { position: absolute; left: -9999px; }

/* Footer */
.footer { padding: clamp(3rem, 6vw, 5rem) 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 2rem var(--gutter); align-items: start; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.footer ul a { text-decoration: none; }
.footer ul a:hover { text-decoration: underline; }
.footer address { font-style: normal; }
.footer-edge { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 4rem; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: minmax(0, 1fr); } }

/* Welcome: sized from the viewport height so the doors are on screen at first load. */
.welcome { padding: clamp(1.5rem, 5vh, 4rem) 0 calc(clamp(1.5rem, 5vh, 4rem) + 3.5vw); text-align: center; }
.welcome .wrap { display: flex; flex-direction: column; align-items: center; gap: clamp(0.75rem, 2.5vh, 2rem); }
/* Tagline lockup never below its 94px minimum (p.12). */
.welcome-logo { width: clamp(94px, 21vh, var(--logo-w)); }
.welcome-heading { container-type: inline-size; width: 100%; }
.welcome-heading .display { font-size: min(var(--size-display), 11vh, 100cqi / (var(--chars) * 0.68)); }
.welcome-intro { margin: 0; max-width: 34em; }
.doors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); width: 100%; text-align: left; margin-top: clamp(0.5rem, 2vh, 1.5rem); }
.door { display: block; text-decoration: none; padding: clamp(1.25rem, 3.5vh, 2.5rem) clamp(1.25rem, 3vw, 2.5rem); border-radius: calc(4rem * var(--radius)); }
.door .h-upper { font-size: clamp(1.5rem, 3.8vh, 2.75rem); margin-bottom: 0.75rem; }
.door p { margin: 0; }
.door:hover .h-upper { text-decoration: underline; text-decoration-thickness: 2px; }
@media (max-width: 800px) { .doors { grid-template-columns: minmax(0, 1fr); } .door .h-upper { font-size: 1.5rem; } }

/* Graphic device (pp.31-33): colour fields meet on angled edges, and headings, markers and buttons follow the
   field's tilt. Base tier, ±2°, alternating so the page zig-zags; body text stays straight to keep it readable. */
.opener, .welcome { --tilt: -2deg; }
.section, .footer { --tilt: -2deg; --edge: polygon(0 100%, 100% 0, 100% 100%); position: relative; }
.section:nth-child(even of .section), .footer { --tilt: 2deg; --edge: polygon(0 0, 100% 100%, 0 100%); }
/* The wedge is this field's colour laid over the bottom of the field above (tan 2° ≈ 0.035). */
.section::before, .footer::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 3.5vw;
  background: var(--bg); clip-path: var(--edge); pointer-events: none; }
.opener-text .display, .opener-text > .technical, .welcome-heading .display,
.section .h-upper, .section > .wrap > .technical:first-child, .section .btn { transform: rotate(var(--tilt)); transform-origin: left center; }
.section .btn { transform-origin: center; }
.welcome-heading .display { transform-origin: center; }
.door { transform: rotate(-1.5deg); }
.door:nth-child(even) { transform: rotate(1.5deg); }
.djiti.margin { z-index: 1; }
