/* ==========================================================================
   THEATRUM ANIMI — fonts, reset, base typography, focus
   ========================================================================== */

/* Subset to Latin + Latin Extended-A: the site is English only, and the partner
   names (Pozorište, Nedomyšleno, Dejvická, Ó Ruairc, Branà) all live in that range.
   5.7MB of variable TTF became 288KB of subset WOFF2. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("../fonts/NotoSerif-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Serif";
  src: url("../fonts/NotoSerif-Italic-Variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("../fonts/Caveat-Variable.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* --- reset ---------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul[class], ol[class] { list-style: none; padding: 0; }

img, picture, svg, video { display: block; max-width: 100%; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; padding: 0; cursor: pointer; }

table { border-collapse: collapse; width: 100%; }

/* --- document ------------------------------------------------------------- */

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 1rem); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-surface-page);
  color: var(--color-ink-primary);
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: var(--lh-prose);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--color-rasa); color: var(--color-crepito); }

/* --- headings ------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-heading);
  text-wrap: balance;
}

h1 { font-size: var(--type-h1); font-weight: 900; letter-spacing: var(--ls-h1); text-transform: uppercase; }
h2 { font-size: var(--type-h2); font-weight: 900; letter-spacing: var(--ls-h2); text-transform: uppercase; }
h3 { font-size: var(--type-h3); font-weight: 700; letter-spacing: -0.007em; }
h4 { font-size: var(--type-h4); font-weight: 700; }
h5 { font-size: var(--type-h5); font-weight: 600; line-height: var(--lh-tight); }

.display-xl {
  font-family: var(--font-display);
  font-size: var(--type-display-xl);
  font-weight: 900;
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  text-wrap: balance;
}

.display-lg {
  font-family: var(--font-display);
  font-size: var(--type-display-lg);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.022em;
  text-transform: uppercase;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--type-eyebrow);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-ink-secondary);
  margin-bottom: var(--space-2xs);
}

.lead {
  font-size: var(--type-lead);
  line-height: 1.55;
  color: var(--color-ink-secondary);
  max-width: var(--measure);
  text-wrap: pretty;
}

.body-lg { font-size: var(--type-body-lg); }
.body-sm { font-size: var(--type-body-sm); }

.meta {
  font-family: var(--font-display);
  font-size: var(--type-meta);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--color-ink-secondary);
}

.caption {
  font-family: var(--font-display);
  font-size: var(--type-caption);
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-ink-secondary);
}

/* --- prose ---------------------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-md); }
.prose p { text-wrap: pretty; }
.prose h2 { margin-top: var(--space-2xl); }
.prose h3 { margin-top: var(--space-xl); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: var(--space-2xs); }

/* --- links ---------------------------------------------------------------- */

a { color: inherit; }

.prose a,
a.link {
  color: var(--color-ink-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: text-decoration-thickness var(--motion-fast) var(--ease);
}
.prose a:hover,
a.link:hover { text-decoration-thickness: 3px; }

.is-inverse .prose a,
.is-inverse a.link { color: var(--color-crepito); }

/* --- the marginalia device ------------------------------------------------ */

.marginalia {
  font-family: var(--font-hand);
  font-size: var(--type-marginalia);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-ink-primary);
  max-width: 16rem;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.marginalia--underline::after {
  content: "";
  display: block;
  width: 78%;
  height: 2px;
  margin-top: var(--space-2xs);
  background: currentcolor;
  transform: rotate(-1.2deg);
  transform-origin: left center;
}
.marginalia--ellipse {
  display: inline-block;
  padding: 0.6em 1.2em;
  border: 2px solid currentcolor;
  border-radius: 50%;
  transform: rotate(-3deg);
}
.is-inverse .marginalia { color: var(--color-crepito); }

/* --- focus system (WCAG 2.4.11 / 2.4.13) ---------------------------------- */

:focus { outline: none; }

:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
  box-shadow: 0 0 0 calc(var(--focus-offset) + 1px) var(--focus-separator);
  border-radius: var(--radius-xs);
}

/* --- skip links ----------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: var(--z-skip-link);
  padding: var(--space-2xs) var(--space-md);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--color-rasa);
  color: var(--color-crepito);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(calc(-100% - var(--space-lg)));
  transition: transform var(--motion-fast) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

/* A second skip link sits beside the first on wide screens. Below that it takes
   the same position: only one can hold focus at a time, so they never collide,
   and neither is offset far enough down to peek past its hidden transform. */
.skip-link--second { left: 14rem; }
@media (max-width: 34rem) {
  .skip-link--second { left: var(--space-sm); }
}

/* --- utility -------------------------------------------------------------- */

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] { display: none !important; }

.is-inverse { color: var(--color-ink-inverse); }
.is-inverse .eyebrow,
.is-inverse .meta,
.is-inverse .caption,
.is-inverse .lead { color: var(--color-ink-inverse-secondary); }

/* --- motion ----------------------------------------------------------------
   Restraint is the voice here: this is a project about mental health, and
   nothing on the page should demand attention it has not earned. Motion is
   limited to a single hero settle on first load plus interaction feedback.
   Content is visible by default; the animation only refines an already-painted
   page, so a headless renderer or a paused tab never ships a blank section. */

@media (prefers-reduced-motion: no-preference) {
  /* transform-only: opacity is never animated, so the text is legible from the
     first painted frame even if the animation never runs. */
  .hero__inner > * {
    animation: ta-settle var(--motion-slow) var(--ease-expo);
  }
  .hero__inner > :nth-child(2) { animation-delay: 60ms; }
  .hero__inner > :nth-child(3) { animation-delay: 110ms; }
  .hero__inner > :nth-child(4) { animation-delay: 150ms; }
  .hero__inner > :nth-child(n + 5) { animation-delay: 190ms; }

  @keyframes ta-settle {
    from { transform: translateY(0.75rem); }
    to   { transform: none; }
  }

  .card { transition: border-color var(--motion-fast) var(--ease); }
  .card:hover { border-color: var(--color-border-strong); }
  .card__media img,
  .card--article .card__media img {
    transition: transform var(--motion-base) var(--ease);
  }
  .card:hover .card__media img,
  .card--article:hover .card__media img { transform: scale(1.02); }
}
