/* SPDX-FileCopyrightText: 2026 Fryderyk Pryjma
   SPDX-License-Identifier: Apache-2.0

   ucho.app. Layout on top of tokens.css (the app's design system).
   Third colour for the website: forest green, against the blush page.
   CSP stays strict: no inline styles, no inline scripts, nothing third-party. */

/* Self-hosted fonts (SIL OFL 1.1, licences next to the files), subset to
   Latin + Latin Extended-A, so Polish works and nothing loads from a third party. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800; font-stretch: 75% 100%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
}

:root {
  --font-display: "Bricolage Grotesque", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-sans: "Bricolage Grotesque", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, ui-monospace, monospace;

  --green-950: #0E1F17;
  --green-900: #163327;
  --green-700: #2B5C47;
  --green-300: #9CCDB0;
  --green-200: #C9E6D4;

  --accent: var(--green-700);          /* 7.2:1 on blush-50 */
  --accent-hover: var(--green-900);
  --on-accent: #FFFFFF;
  --band-bg: var(--green-900);
  --band-text: #F4EAE6;
  --band-muted: rgb(244 234 230 / 0.6);
  --band-line: rgb(244 234 230 / 0.14);
  --term-bg: var(--green-950);
  --term-text: #EAF3EE;
  --term-muted: #8FAE9E;
  --mark-inner: var(--blush-600);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: var(--green-300);
    --accent-hover: var(--green-200);
    --on-accent: #10201A;
    --band-bg: #11261D;
    --term-bg: #0B1712;
    --mark-inner: var(--blush-500);
  }
}
:root[data-theme="dark"] {
  --accent: var(--green-300);
  --accent-hover: var(--green-200);
  --on-accent: #10201A;
  --band-bg: #11261D;
  --term-bg: #0B1712;
  --mark-inner: var(--blush-500);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font: 400 var(--text-base)/var(--leading-normal) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, p, ul, ol, dl, dd, figure, blockquote, pre { margin: 0; }
kbd {
  display: inline-block; min-width: 1.9em; padding: 0.1em 0.45em; text-align: center;
  font: 500 0.8125rem/1.5 var(--font-mono); color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-border); border-bottom-width: 2px; border-radius: 6px;
}

.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
@media (min-width: 48rem) { .wrap { width: min(100% - 5rem, 72rem); } }

.skip-link {
  position: absolute; left: var(--space-3); top: -4rem; z-index: 10;
  background: var(--accent); color: var(--on-accent);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-3); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Ear mark (inline SVG) ---------- */
.mark { width: 100%; height: auto; overflow: visible; }
.mark-outer { fill: none; stroke: var(--color-brand); stroke-width: 13; stroke-linecap: round; stroke-linejoin: round; }
.mark-inner { fill: none; stroke: var(--mark-inner); stroke-width: 11; stroke-linecap: round; }
.mark-wave { fill: none; stroke: var(--color-brand); stroke-width: 8; stroke-linecap: round; opacity: 0.7; }
.mark--animated .mark-wave { opacity: 0; animation: wave var(--duration-slow) var(--ease-out) infinite; }
.mark--animated .w2 { animation-delay: 0.35s; }
.mark--animated .w3 { animation-delay: 0.7s; }
@keyframes wave { 0% { opacity: 0; } 25% { opacity: 0.9; } 70% { opacity: 0; } 100% { opacity: 0; } }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: inherit; text-decoration: none; }
.brand .mark { width: 1.45rem; }
.brand-name { font: 700 1.5rem/1 var(--font-display); font-stretch: 85%; letter-spacing: -0.03em; }
.top-links { display: flex; align-items: center; gap: 1.25rem; font: 400 var(--text-sm) var(--font-mono); }
.top-links a { color: var(--color-text-muted); text-decoration: none; }
.top-links a:hover { color: var(--color-text); }

/* GitHub star pill, shaped like GitHub's own button */
.top-links .gh-star {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.8rem; border: 1px solid var(--color-border); border-radius: var(--radius-full);
  color: var(--color-text); transition: border-color var(--duration-fast);
}
.top-links .gh-star:hover { border-color: var(--color-text-muted); }
.gh { width: 1rem; height: 1rem; fill: currentColor; flex: none; }
.star-icon {
  width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round;
  transition: fill var(--duration-fast), stroke var(--duration-fast), transform var(--duration-fast) var(--ease-out);
}
.btn .star-icon { width: 1.15rem; height: 1.15rem; }
.gh-star:hover .star-icon, .btn-star:hover .star-icon { fill: var(--color-brand); stroke: var(--color-brand); transform: rotate(-12deg) scale(1.15); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 3rem;
  padding: 0.75rem 1.35rem; border-radius: var(--radius-full); border: 1px solid transparent;
  font-weight: 600; text-decoration: none;
  transition: background-color var(--duration-fast), border-color var(--duration-fast);
}
.btn svg { width: 1.15rem; height: 1.15rem; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover { border-color: var(--color-text-muted); }
.icon-stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Hero: one sentence, very large ---------- */
.hero { padding-block: clamp(2.5rem, 8vw, 6rem) clamp(3rem, 6vw, 4.5rem); }
.display {
  font: 650 clamp(3.1rem, 10vw, 9.25rem)/0.9 var(--font-display);
  font-stretch: 90%; letter-spacing: -0.025em;
}
.display .accent { display: block; color: var(--accent); }
.hero-row { display: grid; gap: 1.75rem; margin-top: clamp(2rem, 4vw, 3rem); }
@media (min-width: 52rem) {
  .hero-row { grid-template-columns: minmax(0, 27rem) auto; justify-content: space-between; align-items: end; }
}
.lead { font-size: clamp(1.0625rem, 0.5vw + 0.95rem, 1.25rem); line-height: 1.45; color: var(--color-text-muted); }

/* ---------- Band: someone speaks, the ear listens, text appears ----------
   .stage is the band; stage.js toggles is-live / is-speaking on it. */
.band { background: var(--band-bg); color: var(--band-text); }
.stage { padding-block: clamp(3.5rem, 8vw, 6rem) clamp(9rem, 17vw, 13rem); }
.stage-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 56rem) { .stage-grid { grid-template-columns: minmax(0, 21rem) minmax(0, 1fr); gap: 4.5rem; } }

.listener { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.listener .mark { width: clamp(8rem, 16vw, 13rem); flex: none; }
.band .mark-outer { stroke: var(--blush-300); }
.band .mark-inner { stroke: var(--blush-400); }
.band .mark-wave { stroke: var(--blush-300); opacity: 0.15; }
.stage.is-speaking .listener .mark-wave { animation: wave 1.6s var(--ease-out) infinite; }
.stage.is-speaking .listener .w2 { animation-delay: 0.2s; }
.stage.is-speaking .listener .w3 { animation-delay: 0.4s; }

.voice { display: flex; align-items: center; gap: 4px; width: clamp(6rem, 11vw, 9rem); height: clamp(4.5rem, 9vw, 7.5rem); }
.voice i {
  flex: 1; height: 100%; border-radius: 3px; background: var(--band-line);
  transform: scaleY(0.07); transition: transform 300ms var(--ease-out), background-color 300ms;
}
.voice i:nth-child(1) { --a: 0.25; animation-delay: -0.10s; }
.voice i:nth-child(2) { --a: 0.45; animation-delay: -0.55s; }
.voice i:nth-child(3) { --a: 0.70; animation-delay: -0.30s; }
.voice i:nth-child(4) { --a: 0.95; animation-delay: -0.80s; }
.voice i:nth-child(5) { --a: 0.60; animation-delay: -0.20s; }
.voice i:nth-child(6) { --a: 1.00; animation-delay: -0.65s; }
.voice i:nth-child(7) { --a: 0.75; animation-delay: -0.40s; }
.voice i:nth-child(8) { --a: 0.90; animation-delay: -0.05s; }
.voice i:nth-child(9) { --a: 0.50; animation-delay: -0.70s; }
.voice i:nth-child(10) { --a: 0.80; animation-delay: -0.35s; }
.voice i:nth-child(11) { --a: 0.40; animation-delay: -0.60s; }
.voice i:nth-child(12) { --a: 0.20; animation-delay: -0.15s; }
/* Longhands on purpose: the `animation` shorthand would reset the per-bar delays above. */
.stage.is-speaking .voice i {
  background: var(--blush-300);
  animation-name: talk; animation-duration: 0.85s; animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; animation-direction: alternate;
}
.stage.is-speaking[data-who="them"] .voice i { background: var(--green-300); }
@keyframes talk { from { transform: scaleY(0.08); } to { transform: scaleY(var(--a)); } }

.transcript { list-style: none; padding: 0; font: 400 clamp(0.875rem, 0.45vw + 0.75rem, 1.0625rem)/1.6 var(--font-mono); }
.t-line { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 1rem; padding-block: 0.5rem; }
.t-ts { color: var(--band-muted); }
.t-who { font-weight: 700; color: var(--blush-300); }
.t-line[data-who="them"] .t-who { color: var(--green-300); }
.t-body { grid-column: 1 / -1; display: grid; }
.t-body > span { grid-area: 1 / 1; }
.t-ghost { visibility: hidden; }
@media (min-width: 40rem) {
  .t-line { grid-template-columns: 6.2rem 6.8rem minmax(0, 1fr); }
  .t-body { grid-column: auto; }
}
.stage.is-live .t-line { opacity: 0; transition: opacity 250ms; }
.stage.is-live .t-line.is-shown { opacity: 1; }
.stage.is-live.is-fading .t-line { opacity: 0; transition-duration: 500ms; }
.t-line.is-typing .t-text::after {
  content: ""; display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px;
  vertical-align: -0.18em; background: var(--blush-300); animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.stage-note { margin-top: 1.25rem; font: 400 var(--text-xs)/1.6 var(--font-mono); color: var(--band-muted); }

/* ---------- The app, overlapping the band ---------- */
.shot-wrap { position: relative; margin-top: calc(-1 * clamp(7rem, 14vw, 10.5rem)); }
.shot img { width: 100%; border-radius: 14px; box-shadow: 0 30px 80px rgb(14 31 23 / 0.35), 0 0 0 1px rgb(14 31 23 / 0.08); }
.keys {
  display: flex; flex-wrap: wrap; gap: 0.9rem 2.25rem; margin-top: 1.75rem; padding: 0; list-style: none;
  font: 400 var(--text-sm) var(--font-mono); color: var(--color-text-muted);
}
.keys li { display: inline-flex; align-items: center; gap: 0.3rem; }
.keys span { margin-left: 0.35rem; }
.keys strong { color: var(--accent); font-weight: 700; }

/* ---------- Two artefacts: the folder and the agent ---------- */
.pair { display: grid; gap: 3.5rem; padding-block: clamp(4.5rem, 10vw, 7.5rem); }
@media (min-width: 56rem) { .pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; } }
.artifact figcaption { margin-top: 1.25rem; color: var(--color-text-muted); max-width: 26rem; }
.artifact figcaption strong {
  display: block; margin-bottom: 0.35rem; color: var(--color-text);
  font: 650 clamp(1.5rem, 2.2vw, 1.85rem)/1.1 var(--font-display); font-stretch: 88%; letter-spacing: -0.025em;
}
.tree, .term {
  margin: 0; padding: 1.4rem 1.6rem; overflow-x: auto; white-space: pre; border-radius: 14px;
  font: 400 0.875rem/1.85 var(--font-mono);
}
.tree { color: var(--color-text); background: var(--color-surface); border: 1px solid var(--color-border); }
.tree .dim { color: var(--color-text-muted); }
.tree .hl { color: var(--accent); font-weight: 700; }
.term { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--term-text); background: var(--term-bg); }
.term .p { color: var(--blush-300); }
.term .m { color: var(--term-muted); }
.term .ok { color: var(--green-300); }
@media (max-width: 30rem) { .tree, .term { font-size: 0.75rem; padding: 1.1rem; } }

/* ---------- Fine print (FAQ) ---------- */
.fine { padding-block: clamp(3.5rem, 8vw, 5.5rem); border-top: 1px solid var(--color-border); }
.fine h2 { font: 700 clamp(1.75rem, 3vw, 2.25rem)/1.1 var(--font-display); font-stretch: 85%; letter-spacing: -0.03em; }
.fine-grid { display: grid; gap: 2rem 3.5rem; margin-top: 2rem; }
@media (min-width: 48rem) { .fine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fine dt { font-weight: 600; }
.fine dd { margin-top: 0.4rem; color: var(--color-text-muted); font-size: 0.9375rem; }
.fine dd > * + * { margin-top: 0.6rem; }
.fine blockquote { padding-left: 0.9rem; border-left: 2px solid var(--accent); color: var(--color-text); }
.fine a { color: var(--accent); }

/* ---------- Footer, on the band ---------- */
.site-foot { padding-block: 2.5rem 3rem; }
.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.75rem;
  font: 400 var(--text-xs)/1.6 var(--font-mono); color: var(--band-muted);
}
.foot a:hover { color: var(--band-text); }
.foot .brand { margin-right: auto; color: var(--band-text); }
.foot .brand .mark { width: 1.2rem; }
.foot .brand-name { font-size: 1.25rem; }

/* ---------- 404 ---------- */
.notfound { padding-block: clamp(4rem, 12vw, 8rem); text-align: center; }
.notfound .mark { width: 7rem; margin: 0 auto 1.5rem; }
.notfound h1 { font: 700 clamp(2rem, 5vw, 3rem)/1.05 var(--font-display); font-stretch: 85%; letter-spacing: -0.03em; }
.notfound p { margin-top: 0.75rem; color: var(--color-text-muted); }
.notfound hr { margin: 3rem auto; max-width: 12rem; border: 0; border-top: 1px solid var(--color-border); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  .mark--animated .mark-wave { animation: none; opacity: 0.7; }
  .band .mark-wave { opacity: 0.7; }
  .voice i { transform: scaleY(var(--a)); background: var(--blush-300); }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}
