/* =====================================================================
   The Tied Together Project — main stylesheet
   ---------------------------------------------------------------------
   1. Design tokens (colours, fonts)            5. Shared components
   2. Fonts (@font-face, self-hosted)           6. Header
   3. Base                                       7. Footer
   4. Layout system (desktop canvas + phones)    8. Animations (see bottom)

   How sizes work
   --------------
   The original was designed on a 1366px-wide canvas. Every size and
   position in these files is written in those "design px", multiplied by
   --u (one design px on screen):
     • ≥ 1366px wide   → --u = 1px, canvas centred (exactly like the original)
     • 1093–1365px     → --u shrinks with the window (whole design scales)
     • ≤ 1092px        → phone/tablet layout: elements stack in one column,
                         --u follows the scale the original used (0.75–0.98px)
   ===================================================================== */

/* 1. Design tokens -------------------------------------------------- */
:root {
  --ink: #283f62;          /* main text, icons, photo borders */
  --wordmark: #2555b7;     /* "The Tied Together Project" logo text */
  --accent: #f66844;       /* orange headings and text */
  --line: #ff9267;         /* orange outlines, nav dividers */
  --peach: #ffd5c1;        /* header/footer bands, cards */
  --sky: #b5e5ff;          /* light-blue bands and buttons */
  --sky-pale: #ade6ff;
  --teal: #498ca8;         /* About statistics band, Contact card outlines */
  --white: #ffffff;
  --black: #000000;

  --font-display: "Barlow Semi Condensed", "Arial Narrow", Impact, sans-serif; /* replaces Gagalin */
  --font-condensed: "Anton", Impact, "Arial Narrow", sans-serif;
  --font-nav: "Glacial Indifference", "Century Gothic", sans-serif;
  --font-label: "Archivo Black", "Arial Black", sans-serif;
  --font-ui: "Golos Text", system-ui, sans-serif;                                /* replaces Canva Sans */
  --font-logo: "Kalam", "Comic Sans MS", cursive;                                 /* replaces Lazydog */
  --font-home-nav: "Open Sauce One", var(--font-nav);

  --ease-rise: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 2. Fonts ---------------------------------------------------------- */
/* Original files (SIL Open Font License) */
/* Anton: metric override reproduces where Canva placed its baseline (measured ~0.108em higher than CSS default) */
@font-face { font-family: "Anton"; src: url("../fonts/anton-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; ascent-override: 92.2%; descent-override: 32.9%; }
@font-face { font-family: "Anton"; src: url("../fonts/anton-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; ascent-override: 92.2%; descent-override: 32.9%; }
@font-face { font-family: "Archivo Black"; src: url("../fonts/archivo-black-400.woff2") format("woff2"); font-weight: 400; font-display: swap; ascent-override: 62.2%; descent-override: 21%; }
@font-face { font-family: "Glacial Indifference"; src: url("../fonts/glacial-indifference-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Glacial Indifference"; src: url("../fonts/glacial-indifference-700.woff2") format("woff2"); font-weight: 700; font-display: swap; ascent-override: 73.6%; descent-override: 25%; }
@font-face { font-family: "Open Sauce One"; src: url("../fonts/open-sauce-one-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* Substitutes for fonts that cannot be used outside Canva (see NOTES.md).
   The metric overrides copy the originals' ascent/descent so text sits at the same height. */
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-900.woff2") format("woff2"); font-weight: 900; font-display: swap;
  ascent-override: 89.75%; descent-override: 30.25%; line-gap-override: 0%; }
@font-face { font-family: "Golos Text"; src: url("../fonts/golos-text-400.woff2") format("woff2"); font-weight: 400; font-display: swap;
  ascent-override: 96%; descent-override: 29.3%; line-gap-override: 0%; }
@font-face { font-family: "Golos Text"; src: url("../fonts/golos-text-700.woff2") format("woff2"); font-weight: 700; font-display: swap;
  ascent-override: 96%; descent-override: 29.3%; line-gap-override: 0%; }
@font-face { font-family: "Kalam"; src: url("../fonts/kalam-700.woff2") format("woff2"); font-weight: 700; font-display: swap;
  ascent-override: 70%; descent-override: 20%; line-gap-override: 0%; size-adjust: 106%; }

/* 3. Base ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--white); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
img { display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; font-weight: inherit; font-size: inherit; }
ul, ol { list-style: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 8px; font: 700 16px/1 var(--font-ui); }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--wordmark); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* 4. Layout system -------------------------------------------------- */
.page { container: page / inline-size; overflow-x: clip; }
.page > * { --u: calc(min(100cqi, 1366px) / 1366); }

/* A band = one full-width Canva section. Its background spans the window. */
.band { position: relative; background: var(--bg, transparent); overflow: clip; }
/* The canvas is the 1366-wide design area. Children are laid out on a
   single-cell grid and offset with --x / --y (design px). */
.canvas, .stack { display: grid; grid-template: minmax(0, auto) / minmax(0, 1fr); align-items: start; justify-items: start; }
.canvas { width: calc(1366 * var(--u)); min-height: calc(var(--h) * var(--u)); margin-inline: auto; }
.canvas > *, .stack > *, .canvas > .group > * { grid-area: 1 / 1; }
/* .group = a card on phones; on desktop it is invisible (its children sit on the canvas) */
.group { display: contents; }
.at { margin: calc(var(--y, 0) * var(--u)) 0 0 calc(var(--x, 0) * var(--u)); width: calc(var(--w) * var(--u)); }
.stack.at { height: calc(var(--h) * var(--u)); }

/* Text boxes. --fs = font size in design px. */
/* Canva lays out the first line as if line-height were 1.4 and adds any extra spacing below it;
   CSS splits it above and below. The "top" shift reproduces Canva's placement. */
.t { position: relative; top: calc((1.4 - var(--lh, 1.39)) * var(--fs) * var(--u) / 2); font-size: calc(var(--fs) * var(--u)); line-height: var(--lh, 1.39); letter-spacing: var(--ls, normal); text-align: var(--ta, center); color: var(--c, var(--ink)); overflow-wrap: break-word; }
.f-display { font-family: var(--font-display); font-weight: 900; text-transform: uppercase; letter-spacing: var(--ls, -0.008em); }
.f-anton { font-family: var(--font-condensed); font-weight: 400; }
.f-glacial { font-family: var(--font-nav); font-weight: 400; }
.f-glacial-b { font-family: var(--font-nav); font-weight: 700; }
.f-label { font-family: var(--font-label); font-weight: 400; }
.f-ui { font-family: var(--font-ui); font-weight: 400; }
.f-ui-b { font-family: var(--font-ui); font-weight: 700; }
.f-logo { font-family: var(--font-logo); font-weight: 700; text-transform: uppercase; }
.c-accent { --c: var(--accent); }
.c-white { --c: var(--white); }
.c-black { --c: var(--black); }
.c-peach { --c: var(--peach); }
.ta-left { --ta: left; }
.ta-justify { --ta: justify; }
.u { text-decoration: underline; text-decoration-thickness: from-font; text-underline-offset: 0.12em; }
.nowrap { white-space: nowrap; }

/* Text effects (values measured from the original, in em so they scale) */
.fx-echo { text-shadow: 0.0846em 0.0342em 0 rgb(255 255 255 / 0.5), 0.1692em 0.0684em 0 rgb(255 255 255 / 0.3); }
.fx-outline { paint-order: stroke fill; -webkit-text-stroke: var(--stroke) var(--stroke-c, var(--ink)); }

/* Pictures (see the {% pic %} shortcode in eleventy.config.js) */
.pic { position: relative; overflow: hidden; aspect-ratio: var(--w) / var(--h); border-radius: calc(var(--r, 0) * var(--u)); rotate: var(--rot, 0deg); }
.pic:not(.at) { width: 100%; }
.pic picture { display: contents; }
.pic__img { width: 100%; height: 100%; object-fit: cover; }
.pic--crop .pic__img { width: var(--cw); height: auto; max-width: none; margin: var(--cy) 0 0 var(--cx); }
.pic--border::after { content: ""; position: absolute; inset: 0; border: calc(var(--bw) * var(--u)) solid var(--bc); border-radius: inherit; pointer-events: none; }
.watermark { opacity: 0.05; }

/* 5. Shared components --------------------------------------------- */
/* Buttons: an artwork/CSS shape with a text label on top. */
.btn { display: grid; grid-template: minmax(0, auto) / minmax(0, 1fr); align-items: start; justify-items: start; }
.btn > * { grid-area: 1 / 1; }
.btn .pic { width: 100%; }
.btn.at { height: calc(var(--h) * var(--bu, var(--u))); }
.pill { border-radius: 999px; }
.pill--white { background: var(--white); }
.pill--outline { border: calc(var(--bw, 2.33) * var(--u)) solid var(--line); }

/* Phone / tablet layout (≤ 1092px). --u follows the original's measured scale. */
@container page (max-width: 1092px) {
  .page > * { --u: calc(0.9508px + (100cqi - 900px) * 0.000128646); }
}
@container page (max-width: 899.98px) { .page > * { --u: calc(0.9278px + (100cqi - 768px) * 0.000174242); } }
@container page (max-width: 767.98px) { .page > * { --u: calc(0.8868px + (100cqi - 600px) * 0.000244048); } }
@container page (max-width: 599.98px) { .page > * { --u: calc(0.8442px + (100cqi - 480px) * 0.000355); } }
@container page (max-width: 479.98px) { .page > * { --u: calc(0.7998px + (100cqi - 390px) * 0.000493333); } }
@container page (max-width: 389.98px) { .page > * { --u: calc(0.7998px + (100cqi - 390px) * 0.000658571); } }

@container page (max-width: 1092px) {
  /* Every canvas becomes a centred single column. Page files fine-tune order and spacing. */
  .canvas { display: flex; flex-direction: column; align-items: center; width: 100%; min-height: 0; padding: calc(40 * var(--u)) 16px; gap: calc(28 * var(--u)); }
  .canvas > .at, .canvas > .stack { margin: 0; max-width: 100%; }
  .canvas > .t { width: min(calc(var(--w) * var(--u)), 100%); }
  .pic.at { max-width: 100%; }
  /* Buttons wider than the screen shrink as a whole (artwork and label together) */
  .btn.at { --bu: min(var(--u), calc((100cqi - 24px) / var(--w))); width: calc(var(--w) * var(--bu)); }
  .btn.at > * { --u: var(--bu); }
  /* Readable text on phones: body copy never smaller than 16px */
  .t.body { font-size: max(16px, calc(var(--fs) * var(--u))); }
  .desktop-only { display: none !important; }
  /* big single-line headings may wrap on small screens */
  h1.nowrap, h2.nowrap, h3.nowrap, .canvas > p.nowrap { white-space: normal; }
  .canvas h1.t, .canvas h2.t, .canvas h3.t { width: auto !important; max-width: 100%; }
  .group { container-type: inline-size; display: flex; flex-direction: column; align-items: center; gap: calc(22 * var(--u)); width: min(calc(560 * var(--u)), 100%); padding: calc(44 * var(--u)) calc(26 * var(--u)); }
  .group > * { margin: 0 !important; max-width: 100%; }
}
@container page (min-width: 1093px) { .mobile-only { display: none !important; } }
.pic--natural { aspect-ratio: auto; }
.pic--natural .pic__img { height: auto; }

/* Line breaks copied from the original design (desktop only).
   <br class="lb"> marks where the original wrapped a line; on phones they are ignored and text
   wraps naturally. If you change a sentence, move or delete its lb markers. */
.lines { white-space: nowrap; }
sup { font-size: 0.6em; vertical-align: baseline; line-height: 0; }
@container page (max-width: 1092px) {
  .lb { display: none; }
  .lines { white-space: normal; }
}
/* Canva overlaps consecutive sections by 1px */
main > .band + .band, main + .site-footer { margin-top: -1px; }
