/* Trisolas "How we work", hand-drawn sheet. Tokens: brand-tokens.css.
   Pen lettering: Caveat (SIL Open Font License 1.1), self-hosted latin + latin-ext (variable weight).
   Paper is cool only: white card, blue-grey ruled grid, navy ink, teal second pen. No cream, no beige.
   Final sheet is the default look. The script only hides things (via paused animations) once it has built the sheet, so no JS and reduced motion show the finished sheet.
   Animated properties: stroke-dashoffset, clip-path, opacity, transform. */

@font-face {
  font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/caveat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/caveat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.as {
  --as-ink: var(--ink, #1c2e4a);
  --as-pen2: var(--teal, #3fa0c0);
  --as-pen2-text: var(--teal-text, #1b6a88);
  --as-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  position: relative;
  color: var(--as-ink);
}
.as *, .as *::before, .as *::after { box-sizing: border-box; }
.as p, .as ul, .as ol { margin: 0; padding: 0; list-style: none; }

/* ---------- The sheet ---------- */
.as-sheet {
  position: relative;
  container-type: inline-size;
  aspect-ratio: var(--as-ar, 1082 / 290);
  background-color: #fff;
  background-image:
    linear-gradient(to bottom, rgba(91, 189, 232, .16) 1px, transparent 1px),
    linear-gradient(to right, rgba(226, 232, 240, .85) 1px, transparent 1px);
  background-size: 100% 24px, 24px 100%;
  background-position: 0 11px, 11px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.as-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.as-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.as-svg path[stroke-dasharray] { stroke-dasharray: 1.02 3; }

.as-labels { position: absolute; inset: 0; pointer-events: none; --u: calc(100cqw / var(--as-w, 1082)); }
.as-l {
  position: absolute; left: calc(var(--x) / var(--as-w, 1082) * 100%); top: calc(var(--y) / var(--as-h, 290) * 100%);
  font: 600 calc(var(--u) * var(--s, 22)) / 1 var(--as-hand);
  color: var(--as-ink); white-space: nowrap; transform: translate(0, -50%);
}
.as-l--c { transform: translate(-50%, -50%); }
.as-l--v { transform: translate(-50%, -50%) rotate(-90deg); }
.as-l--t { color: var(--as-pen2-text); }

.as-pen {
  position: absolute; left: 0; top: 0; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: var(--as-ink); opacity: 0; pointer-events: none; will-change: transform;
}

/* ---------- Captions ---------- */
.as-caps { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.as-caps.is-abs { display: block; position: relative; height: 38px; }
.as-cap { position: relative; padding: 6px 6px 6px 0; }
.as-caps.is-abs .as-cap { position: absolute; top: 0; left: var(--cx); translate: -50% 0; padding: 6px 4px; width: max-content; max-width: calc(var(--cw, 25%) - 12px); text-align: center; text-wrap: balance; }
.as-cap__n {
  position: relative; display: inline-block; margin: 0; padding: 0 2px; cursor: default;
  font: var(--fw-head) var(--fs-ui)/1.3 var(--font); letter-spacing: -.01em; color: var(--as-ink);
  transform-origin: 50% 50%; transform: scale(1);
  transition: transform var(--d-ui) var(--ease-out), color var(--d-ui) ease, opacity var(--d-ui) ease;
}
.as-caps:not(.is-abs) .as-cap__n { transform-origin: 0 50%; }
.as-cap__bar { position: absolute; left: 2px; right: 2px; bottom: -3px; height: 2px; border-radius: 2px; background: var(--as-pen2); transform-origin: 0 50%; transform: scaleX(0); transition: transform var(--d-ui) var(--ease-out); }
.as-cap__n:focus-visible { outline: 2px solid var(--as-pen2-text); outline-offset: 4px; border-radius: 4px; }
.as.is-drawing .as-cap:not(.is-active) .as-cap__n { color: var(--ink-2, #4a5b73); opacity: .7; }
.as-cap.is-active .as-cap__n, .as-cap__n.is-active, .as-cap__n:focus-visible { transform: scale(1.05); color: var(--as-ink); opacity: 1; }
.as-cap.is-active .as-cap__bar, .as-cap__n:focus-visible .as-cap__bar { transform: scaleX(1); }
@media (min-width: 760px) and (max-width: 1040px) { .as-caps.is-abs { height: 56px; } .as-cap__n { font-size: 14px; } }
@media (hover: hover) and (pointer: fine) { .as-cap__n { cursor: pointer; } }
@media (prefers-reduced-motion: reduce) {
  .as-cap__n { transition: color var(--d-press) ease, opacity var(--d-press) ease; }
  .as-cap.is-active .as-cap__n, .as-cap__n.is-active, .as-cap__n:focus-visible { transform: none; }
  .as-cap__bar { transition: none; }
}
/* The active phase's region of the sheet, tinted a little */
.as-reg { position: absolute; z-index: 0; background: rgba(91, 189, 232, .085); opacity: 0; pointer-events: none; transition: opacity var(--d-ui) ease; }
.as-reg.is-on { opacity: 1; }
.as-svg, .as-labels { z-index: 1; }

.as-chips { position: relative; }

/* No JS: the labels as a plain list under each caption. Hidden once the sheet is built. */
.as-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.as-chips li { font: var(--fw-ui) var(--fs-xs)/1.2 var(--font); color: var(--as-pen2-text); background: var(--wash-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 8px; }
.as.is-ready .as-chips { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Before the sheet is built: no JS shows only the captions and the label list; with JS pending the space is held, invisible. */
.as:not(.is-ready) .as-paper { display: none; }
html.js .as:not(.is-ready) .as-paper { display: block; visibility: hidden; }

/* ---------- Controls: two 28px icon buttons in the sheet's bottom-right corner (no extra height) ---------- */
.as-paper { position: relative; }
.as-ctl { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: flex; gap: 6px; }
.as-btn {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0; cursor: pointer;
  color: var(--as-pen2-text); background: transparent; border: 1px solid var(--line); border-radius: 50%;
  transition: transform var(--d-press) var(--ease-out), background-color var(--d-press) ease, border-color var(--d-press) ease;
}
.as-btn:active { transform: scale(.94); }
.as-btn[disabled] { opacity: .5; cursor: default; }
.as-btn:focus-visible { outline: 2px solid var(--as-pen2-text); outline-offset: 2px; }
.as-btn .i-play { display: none; }
.as-btn[data-state="pause"] .i-play { display: block; }
.as-btn[data-state="pause"] .i-pause { display: none; }
@media (hover: hover) and (pointer: fine) { .as-btn:not([disabled]):hover { background: var(--wash); border-color: var(--as-pen2); } }
.as:not(.is-ready) .as-ctl, .as.is-static .as-ctl { display: none; }
@media (prefers-reduced-motion: reduce) { .as-ctl { display: none; } }

/* ---------- Phones: vertical sheet ---------- */
@media (max-width: 759px) {
  .as-ctl { right: 4px; bottom: 4px; }
  .as-caps { grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 6px; }
  .as-sheet { aspect-ratio: var(--as-ar, 350 / 690); }
}
