/* variable font from `npm run fonts` (not in git); without it the stack below falls back to the system font */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-ext-wght-normal.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: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/bricolage-grotesque-latin-wght-normal.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;
}

:root {
  --paper: #F4EDE0;
  --ink: #1B1B1B;
  --accent: #E4572E;
  --font: 'Bricolage Grotesque', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0 auto;
  max-width: 30rem;
  padding: 1.25rem 1rem 3rem;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--font);
}

h1, h2, h3 { font-weight: 800; line-height: 1.05; margin: 0; }
p { margin: 0; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
a[href]:hover { text-decoration-thickness: 4px; } /* not colour: accent text is below 4.5:1 on paper */

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; } /* headings focused by script after a screen change */

/* header + the eye */
header { text-align: center; }
h1 {
  font-size: 1.125rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tagline { margin-top: .25rem; font-size: .9375rem; }

.eye {
  --open: 1;
  display: block;
  width: min(13rem, 60vw);
  margin: .75rem auto 1.5rem;
  overflow: visible;
}
.eye .white { fill: #FFFDF8; }
.eye .iris { fill: var(--accent); }
.eye .pupil { fill: var(--ink); }
.eye .glint { fill: #FFFDF8; }
.eye .lid {
  fill: #E2D3BA; /* darker paper so a lowered lid reads as a lid, not an empty eye */
  stroke: var(--ink);
  stroke-width: 5;
  transform: translateY(calc(var(--open) * -40px));
}
.eye .outline, .eye .lashes {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.eye.blink .lid { animation: blink .45s ease-in-out; }
@keyframes blink { 45%, 55% { transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  .eye.blink .lid { animation: none; }
}

/* screens */
main > section, [aria-live] > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }

.step {
  font-weight: 800;
  font-size: .875rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

#text, #vypocet, .source, .sponsor { overflow-wrap: anywhere; } /* free text from the database; dd numbers stay unbreakable */
#text { font-size: clamp(1.625rem, 7vw, 2.125rem); letter-spacing: -.01em; }

form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
label { font-weight: 800; }

.field {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1rem;
  background: #FFFDF8;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
}
.field:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.field input {
  flex: 1;
  min-width: 0;
  min-height: 3.75rem;
  border: 0;
  background: none;
  color: inherit;
  font: 800 1.75rem/1 var(--font);
}
.field input:focus { outline: none; }
#jednotka { font-weight: 800; font-size: 1.25rem; white-space: nowrap; }

.multipliers { display: flex; gap: .5rem; }

button {
  min-height: 2.75rem;
  padding: .5rem 1rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 800 1rem/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.multipliers button { flex: 1; }
.multipliers button:active { background: var(--ink); color: var(--paper); }

.primary {
  min-height: 3.5rem;
  border-radius: 14px;
  background: var(--accent);
  font-size: 1.25rem;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.primary:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.primary:disabled { opacity: .55; cursor: progress; }

.echo { min-height: 1.5em; font-size: 1.125rem; }
.sponsor { font-size: .9375rem; }
.message:not(:empty) { white-space: pre-line; margin-top: 1.25rem; padding: .75rem 1rem; border: 2px solid var(--ink); border-radius: 14px; font-weight: 800; }
.message:empty { display: none; }
#znova { margin-top: 1rem; width: 100%; }

/* reveal */
.pair { display: grid; gap: .75rem; margin: 0; } /* one column: long answers must not squeeze */
.pair div { padding: .75rem; border: 3px solid var(--ink); border-radius: 14px; }
.pair div:last-child { background: var(--ink); color: var(--paper); }
dt { font-size: .875rem; text-transform: uppercase; letter-spacing: .1em; }
dd { margin: .25rem 0 0; font-weight: 800; font-size: 1.25rem; line-height: 1.15; } /* numbers use no-break spaces, so only the unit wraps */

.ratio { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; font-size: 1.0625rem; }
/* big ratios shrink to fit the column: app.js sets --chars, .6em is above the widest average glyph */
#pomer { font-weight: 800; font-size: min(4.5rem, 18vw, calc(min(100vw - 2rem, 28rem) / (var(--chars, 6) * .6))); line-height: 1; letter-spacing: -.03em; }
.direction {
  padding: .25rem .75rem;
  border-radius: 999px;
  background: var(--accent);
  font-weight: 800;
}
.crowd { font-weight: 800; }
h3 { font-size: 1.25rem; margin-bottom: -.75rem; }
.source { font-size: .9375rem; }

/* summary */
#cislo-dna { font-size: 1.5rem; text-align: center; }
.score {
  font-weight: 800;
  font-size: min(6rem, 24vw, calc(min(100vw - 2rem, 28rem) / (var(--chars, 6) * .6)));
  line-height: 1;
  letter-spacing: -.04em;
  text-align: center;
}
.symbols { font-size: 2.5rem; text-align: center; letter-spacing: .1em; }
.streak { text-align: center; font-weight: 800; }

/* archive */
#dnes { display: inline-flex; align-items: center; min-height: 2.75rem; margin-bottom: .5rem; font-weight: 800; }
#archiv { margin-top: 3rem; }
#archiv ul { margin: .75rem 0 0; padding: 0; list-style: none; }
#archiv li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-weight: 800; }
#archiv li a { display: flex; align-items: center; min-height: 2.75rem; } /* 44 px tap target */
/* no ads on the question and reveal screens, whatever happens to the slot's hidden attribute */
body:has(#otazka:not([hidden]), #odhalenie:not([hidden])) #archiv .ad-slot { display: none; }

/* footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 3px dashed var(--ink);
  font-size: .9375rem;
}
footer h2 { font-size: 1rem; margin: 1rem 0 .25rem; }
footer h2:first-child { margin-top: 0; }
