/* AppyOurs front door. Colour tokens are paired with the art palette in art.js
   (--ground = the sky's top stop) so text contrast can be audited against real pixels. */
@font-face {
  font-family: "Bricolage";
  src: url("/a/bricolage-grotesque.1c14bd7c.woff2") format("woff2");
  font-weight: 250 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
:root {
  --ground: #c3cbe9;
  --ink: #17184a;
  --ink-soft: #2c2e66;
  --ghost: #8d92c6;
  --paren: #b8371f;
  --paren-text: #a3301a;
  --focus: #17184a;
  --gutter: clamp(18px, 5.2vw, 56px);
  --slide-ms: 1100ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* Sizes are capped by height too: the page must fit one screen without scrolling. */
  --mark: min(calc((100vw - 2 * var(--gutter)) / 2.42), 18.5dvh);
  --quote: clamp(1.25rem, min(7.4vw, 4.3dvh), 3.6rem);
  --creed: clamp(1.05rem, min(5.7vw, 3.15dvh), 2.6rem);
  --small: clamp(0.875rem, 0.82rem + 0.25vw, 1rem);
  font-family: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light dark;
  background: var(--ground);
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #13163d;
    --ink: #f5f1ff;
    --ink-soft: #cdc9ef;
    --ghost: #4f4e8e;
    --paren: #ffb36b;
    --paren-text: #ffb36b;
    --focus: #ffd59a;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  /* Swipes belong to the slides; pinch zoom stays available. */
  touch-action: pinch-zoom;
}
#art, .fallback, .fallback img { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.fallback img { object-fit: cover; }

.frame {
  position: fixed; inset: 0; z-index: 1;
  display: grid;
  grid-template: "top top" auto ". ." 1fr "bottom bottom" auto "pager team" auto / minmax(0, 1fr) auto;
  padding: max(var(--gutter), env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right))
           max(calc(var(--gutter) * 0.7), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.slot-top, .mark, .creed { grid-area: top; }
.slot-bottom, .quote, .signoff { grid-area: bottom; }
.slot-top, .slot-bottom { pointer-events: none; }
.panel { display: contents; }
.home-pager, .back-pager { grid-area: pager; justify-self: start; }
.team { grid-area: team; justify-self: end; }
.home-pager, .back-pager, .team { margin-top: clamp(0.4rem, 1.6dvh, 1.2rem); }

/* ---- type ------------------------------------------------------------------- */
.mark {
  font-size: var(--mark);
  font-weight: 790; font-stretch: 75%; font-optical-sizing: auto;
  line-height: 0.84; letter-spacing: -0.025em;
  align-self: start; width: fit-content;
}
.mark .w { display: block; white-space: nowrap; }
.mark .g { color: var(--ink); animation: ghost 1.1s var(--ease-in-out) 2.3s forwards; }
.mark .p {
  display: inline-block; overflow: hidden; vertical-align: top;
  color: var(--paren); font-weight: 300;
  max-width: 0; opacity: 0;
  animation: open 1.1s var(--ease-in-out) 2.3s forwards;
}
/* The pun, played once: "Happy / Hours" opens its brackets and becomes H(app)y H(ours). */
@keyframes open { to { max-width: 0.42em; opacity: 1; } }
@keyframes ghost { to { color: var(--ghost); } }

.quote {
  font-size: var(--quote);
  font-weight: 560; font-stretch: 88%;
  line-height: 1.04; letter-spacing: -0.022em;
  max-width: 15.5ch; text-wrap: balance; align-self: end;
}
.creed {
  list-style: none; align-self: start;
  font-size: var(--creed); font-weight: 480; font-stretch: 90%;
  line-height: 1.12; letter-spacing: -0.012em;
  display: grid; gap: 0.55em; max-width: 21ch;
}
.creed li { overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.creed li > span { display: block; text-wrap: balance; }
/* Stagger index per line (no inline styles: the CSP forbids them). */
.creed li:nth-child(1) { --i: 0; } .creed li:nth-child(2) { --i: 1; }
.creed li:nth-child(3) { --i: 2; } .creed li:nth-child(4) { --i: 3; }
.signoff {
  font-size: var(--creed); font-weight: 480; font-stretch: 90%;
  line-height: 1.16; letter-spacing: -0.012em;
  max-width: 22ch; align-self: end; color: var(--ink-soft); text-wrap: balance;
}
.signoff .pun { color: var(--ink); font-weight: 700; font-stretch: 80%; white-space: nowrap; }
.signoff .pun b { color: var(--paren-text); font-weight: 400; }

.frame a {
  color: var(--ink); font-size: var(--small); font-weight: 560; letter-spacing: 0.005em;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  display: inline-flex; align-items: center; gap: 0.6em; min-height: 44px;
}
.frame a:hover { text-decoration-color: currentColor; }
.pager { text-decoration: none !important; }
.pager .label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.3em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
/* Two pips, one per slide: the filled one is where you are. */
.pips { display: inline-flex; gap: 5px; }
.pips i { width: 7px; height: 7px; border-radius: 2.4px; border: 1.25px solid currentColor; }
.pips i.on { background: currentColor; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 3px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- slides ----------------------------------------------------------------------
   Home is the default. JS sets data-slide; without JS, #manifesto:target does the same. */
.mark, .quote, .home-pager { transition: opacity 0.45s var(--ease-out), transform 0.7s var(--ease-out), visibility 0s; }
.creed li > span { transform: translateY(105%); transition: transform 0.35s ease-in, visibility 0s 0.35s; visibility: hidden; }
.signoff, .back-pager { opacity: 0; visibility: hidden; transform: translateY(0.4em);
  transition: opacity 0.3s ease-in, transform 0.3s ease-in, visibility 0s 0.3s; }

:root[data-slide="manifesto"] .mark, :root[data-slide="manifesto"] .quote, :root[data-slide="manifesto"] .home-pager,
:root:not([data-slide]) body:has(#manifesto:target) :is(.mark, .quote, .home-pager) {
  opacity: 0; visibility: hidden; transform: translateY(-0.35em);
  transition: opacity 0.3s ease-in, transform 0.4s ease-in, visibility 0s 0.4s;
}
:root[data-slide="manifesto"] .creed li > span,
:root:not([data-slide]) body:has(#manifesto:target) .creed li > span {
  transform: none; visibility: visible;
  transition: transform 0.95s var(--ease-out) calc(0.45s + var(--i) * 0.11s), visibility 0s;
}
:root[data-slide="manifesto"] :is(.signoff, .back-pager),
:root:not([data-slide]) body:has(#manifesto:target) :is(.signoff, .back-pager) {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.8s var(--ease-out) 0.95s, transform 0.9s var(--ease-out) 0.95s, visibility 0s;
}

/* ---- landscape: wordmark and copy on the left, the sun on the right ------------------ */
@media (min-aspect-ratio: 1/1) {
  :root {
    --mark: min(14vw, 21dvh);
    --quote: clamp(1.15rem, min(3.7vw, 6.6dvh), 4.4rem);
    --creed: clamp(1rem, min(2.5vw, 4.4dvh), 2.7rem);
  }
  .frame { grid-template: "top top top" auto ". . ." 1fr "bottom pager team" auto / minmax(0, 1fr) auto auto; column-gap: clamp(1.25rem, 2.6vw, 2.5rem); }
  .creed { max-width: 26ch; }
  .home-pager, .back-pager, .team { margin-top: 0; align-self: end; justify-self: end; }
}

/* Short landscape (phones on their side): the wordmark goes on one line to leave sky for the sun. */
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
  :root { --mark: min(8.2vw, 20dvh); --quote: clamp(1rem, 6.2dvh, 1.6rem); --creed: clamp(0.9rem, 4.6dvh, 1.3rem); }
  .mark .w { display: inline; }
  .mark .w + .w::before { content: " "; }
  .creed { gap: 0.3em; max-width: 34ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; transition-delay: 0s !important; }
}
