/* Peira — one page, two languages.
   Layout: a calm field notebook. Cool paper, ink, one Aegean blue for what was measured;
   a display serif for headings, a Greek Didot for the word itself, Plex for text and numbers. */
:root {
  --paper: #f3f5f1;
  --paper-2: #e9ede7;
  --ink: #15191c;
  --muted: #5a646b;
  --rule: #d3d9d4;
  --accent: #2448a6;
  --accent-ink: #ffffff;
  --accent-soft: #dfe6f6;
  --base-bar: #a9b3b8;
  --mid-bar: #7f97d6;
  --next: #9a6a14;
  --next-soft: #f3e7cf;
  --grid: rgba(21, 25, 28, 0.055);
  --shadow: rgba(10, 20, 30, 0.08);

  --font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-greek: "GFS Didot", "Cormorant Garamond", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --wrap: 1120px;
  --gutter: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1316;
    --paper-2: #161b1f;
    --ink: #e7eae5;
    --muted: #9aa4a9;
    --rule: #283035;
    --accent: #8ea7ff;
    --accent-ink: #0f1316;
    --accent-soft: #1b2440;
    --base-bar: #4d575d;
    --mid-bar: #5d74bd;
    --next: #e0b25a;
    --next-soft: #2c2412;
    --grid: rgba(231, 234, 229, 0.05);
    --shadow: rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

/* Language: English unless the page is switched to Slovak. */
html:not([data-lang="sk"]) .l-sk { display: none; }
html[data-lang="sk"] .l-en { display: none; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.5rem, 5.2vw, 4.3rem); line-height: 1.04; }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.1; margin-bottom: 1.4rem; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 0 0 .35rem; }
p { margin: 0 0 1rem; }

.greek { font-family: var(--font-greek); }

/* Header */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.top-row { display: flex; align-items: center; gap: 1.5rem; padding-block: .8rem; }
.brand { display: flex; align-items: baseline; gap: .55rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-mark { width: 30px; height: 30px; flex: none; align-self: center; }
.brand-delta { stroke: var(--accent); }
.brand-name { font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; letter-spacing: .01em; }
.brand-greek { font-family: var(--font-greek); color: var(--muted); font-size: 1.05rem; }
.nav { display: flex; gap: 1.3rem; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--accent); }
.lang { display: flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.lang button {
  font: 500 .78rem/1 var(--font-mono);
  letter-spacing: .06em;
  padding: .45rem .7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Hero */
.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero-text > * { min-width: 0; }
.eyebrow { font-size: .95rem; color: var(--muted); margin-bottom: 1.2rem; }
.eyebrow .greek { font-size: 1.35rem; color: var(--ink); margin-right: .15rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 36rem; margin-top: 1.4rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }
.btn {
  display: inline-block;
  padding: .7rem 1.15rem;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: .97rem;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* The curve motion.js draws crosses the whole hero, behind the words too: a soft shadow of
   the paper keeps them clear, and the outlined button gets the paper behind it. */
.hero-text h1 { text-shadow: 0 0 3px var(--paper), 0 0 10px var(--paper), 0 0 24px var(--paper); }
.hero-text .eyebrow, .hero-text .lead {
  text-shadow: 0 0 2px var(--paper), 0 0 5px var(--paper), 0 0 10px var(--paper), 0 0 18px var(--paper);
}
.hero .btn:not(.primary) { background: var(--paper); }

/* The column beside the headline keeps the note on what the curve is. */
.hero-stage { align-self: stretch; min-height: 24rem; min-width: 0; display: flex; align-items: flex-end; justify-content: flex-end; }
.stage-note { margin: 0; max-width: 21rem; font: 400 .8rem/1.55 var(--font-mono); color: var(--muted); text-align: right; }
.stage-note .delta { font: 400 1.35rem/1 var(--font-greek); color: var(--accent); margin-right: .3rem; vertical-align: -.1em; }

.chart { margin: 0; min-width: 0; }
.fig-title { font-size: .9rem; font-weight: 500; margin-bottom: .9rem; }
.bars { width: 100%; height: auto; display: block; }
.bar-label { font: 400 13px var(--font-body); fill: var(--muted); }
.bar-value { font: 500 14px var(--font-mono); fill: var(--ink); }
.bar-value.strong { fill: var(--accent); }
.bar-base { fill: var(--base-bar); }
.bar-mid { fill: var(--mid-bar); }
.bar-best { fill: var(--accent); }

/* Sections */
.section { padding-block: clamp(3.2rem, 7vw, 5.5rem); border-top: 1px solid var(--rule); }
.section.alt { background: var(--paper-2); }
.section-lead { color: var(--muted); max-width: 44rem; margin-top: -.6rem; margin-bottom: 2rem; }

.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.cols3 p { border-top: 2px solid var(--ink); padding-top: .9rem; margin: 0; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.6rem; }
.steps li { counter-increment: step; position: relative; padding-top: 2.1rem; min-width: 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; top: 0; left: 0;
  font: 500 .8rem/1 var(--font-mono);
  color: var(--accent);
  letter-spacing: .08em;
}
.steps li::after {
  content: "";
  position: absolute; top: .4rem; left: 2.2rem; right: -.6rem;
  height: 1px; background: var(--rule);
}
.steps li:last-child::after { right: 0; }
.steps p { color: var(--muted); margin: 0; }
.aside { margin-top: 2.2rem; color: var(--muted); max-width: 46rem; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
/* The headline result spans the row: its chart beside its numbers. */
.card-lead { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.2rem 2.6rem; align-items: center; }
.card-lead > * { min-width: 0; }
.card .lead-note { color: var(--muted); font-size: .92rem; margin: 0; }
.card { border: 1px solid var(--rule); border-radius: 4px; padding: 1.4rem 1.4rem 1.1rem; background: var(--paper); min-width: 0; }
.card .num {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: .6rem;
  font-variant-numeric: tabular-nums;
}
.card .num .arrow { color: var(--accent); font-family: var(--font-body); font-weight: 400; margin-inline: .1rem; }
.card .num .of { font-size: .55em; color: var(--muted); font-weight: 500; }
.card .setup { font: 400 .78rem/1.4 var(--font-mono); color: var(--muted); margin: .8rem 0 0; letter-spacing: .02em; }

.notyet { margin-top: 2.6rem; max-width: 52rem; }
.notyet ul { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .6rem; }
.notyet li { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: baseline; }
.pill {
  font: 500 .72rem/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--next);
  background: var(--next-soft);
  border-radius: 999px;
  padding: .32rem .6rem;
  white-space: nowrap;
}
.notyet .note { color: var(--muted); font-size: .92rem; margin-top: 1rem; }

.two { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(1.5rem, 5vw, 4rem); }
.two > * { min-width: 0; }

.person { border-top: 2px solid var(--ink); padding-top: 1rem; margin-top: 1.6rem; }
.person p { margin: 0 0 .3rem; }
.person-name { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.person-role { color: var(--muted); }
.person-mail { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: .6rem !important; }
.person-mail a { font-family: var(--font-mono); font-size: .95rem; overflow-wrap: anywhere; }
.copy {
  font: 500 .75rem/1 var(--font-mono);
  padding: .4rem .65rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.copy.done { color: var(--accent); border-color: var(--accent); }

.foot { border-top: 1px solid var(--rule); padding-block: 1.6rem calc(1.6rem + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: .88rem; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem; }
.foot p { margin: 0; }
.linklike {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0;
  margin-left: .8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linklike:hover { color: var(--accent); }

/* Consent bar (analytics only after "Accept") */
.consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.consent-box {
  pointer-events: auto;
  max-width: 760px;
  margin: 0 auto;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(10, 20, 30, .18);
  padding: 1rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem 1.2rem;
  align-items: center;
}
.consent-title { font-weight: 600; margin: 0; grid-column: 1; }
.consent-text { color: var(--muted); font-size: .9rem; margin: 0; grid-column: 1; }
.consent-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: .6rem; }
.consent-actions .btn { padding: .55rem .95rem; font-size: .92rem; cursor: pointer; background: transparent; font-family: inherit; }
.consent-actions .btn.primary { background: var(--accent); }
@media (max-width: 640px) {
  .consent-box { grid-template-columns: 1fr; }
  .consent-actions { grid-column: 1; grid-row: auto; justify-content: flex-end; }
}

/* Narrow screens */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-stage { min-height: 20rem; justify-content: flex-start; }
  .stage-note { text-align: left; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .steps li::after { display: none; }
  .cards, .card-lead { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .cols3, .cards, .two { grid-template-columns: 1fr; }
  .cols3 { gap: 1.4rem; }
}
@media (max-width: 460px) {
  body { font-size: 16px; }
  .steps { grid-template-columns: 1fr; }
  .brand-greek { display: none; }
}

/* ===== Motion ===== */
/* The hero: graph paper (an experiment notebook) and the field of trials drawn by motion.js. */
.hero { position: relative; overflow: hidden; isolation: isolate; }
.hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -2;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 35% 45%, #000 35%, transparent 80%);
  mask-image: radial-gradient(ellipse 85% 75% at 35% 45%, #000 35%, transparent 80%);
}
.field {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .9s ease;
}
.field.on { opacity: 1; }

/* The hero arrives in order. */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero-text > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.hero-text > :nth-child(1) { animation-delay: .05s; }
.hero-text > :nth-child(2) { animation-delay: .15s; }
.hero-text > :nth-child(3) { animation-delay: .3s; }
.hero-text > :nth-child(4) { animation-delay: .45s; }
.stage-note { animation: rise .9s cubic-bezier(.2, .7, .2, 1) .6s both; }

/* The headline result's bars grow once its card has come in (full without the script). */
.bars .bar { transform-box: fill-box; transform-origin: 0 50%; }
.card[data-reveal] .bars .bar { transform: scaleX(0); transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.card[data-reveal] .bars .bar-value { opacity: 0; transition: opacity .5s ease; }
.card.in .bars .bar { transform: none; }
.card.in .bars .bar-value { opacity: 1; }
.card.in .bars .row:nth-child(1) .bar { transition-delay: .35s; }
.card.in .bars .row:nth-child(2) .bar { transition-delay: .6s; }
.card.in .bars .row:nth-child(3) .bar { transition-delay: .85s; }
.card.in .bars .row:nth-child(1) .bar-value { transition-delay: 1.1s; }
.card.in .bars .row:nth-child(2) .bar-value { transition-delay: 1.3s; }
.card.in .bars .row:nth-child(3) .bar-value { transition-delay: 1.5s; }

/* Reveal on scroll (motion.js sets data-reveal and --i; without the script all stays visible). */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
}
[data-reveal].in { opacity: 1; transform: none; }

/* The four steps: each one's rule draws itself as the step comes in. */
.steps li[data-reveal]::after { transform: scaleX(0); transform-origin: 0 50%; transition: transform .9s ease calc(var(--i, 0) * 90ms + .25s); }
.steps li.in::after { transform: none; }
.steps li[data-reveal]::before { transition: color .4s ease; }

/* Small things that respond to the hand. */
.top { transition: box-shadow .3s ease; }
.top.scrolled { box-shadow: 0 6px 24px var(--shadow); }
.card { transition: transform .25s ease, border-color .25s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.btn { transition: transform .2s ease, background-color .2s ease, border-color .2s ease; }

@media (prefers-reduced-motion: reduce) {
  .hero-text > *, .stage-note { animation: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .steps li[data-reveal]::after { transform: none !important; transition: none !important; }
  .card:hover { transform: none; }
}
