/* ============================================================
   Finlandia Quiz — styles (mobile-first, vertical kiosk/phone)
   ============================================================ */

/* Brand headline font. Drop the real file at assets/fonts/finlandia-headline.woff2
   (and .woff) and it will be used automatically; until then Fjalla One stands in. */
@font-face {
  font-family: 'Finlandia Headline';
  src: url('../fonts/finlandia-headline.woff2') format('woff2'),
       url('../fonts/finlandia-headline.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The Figma design uses one brand font everywhere (Finlandia Headline Bold).
     Fjalla One stands in until the real file is dropped in assets/fonts/.
     Oswald is the last-resort fallback. */
  --ff-head: 'Finlandia Headline', 'Fjalla One', 'Oswald', system-ui, sans-serif;
  --ff-body: 'Finlandia Headline', 'Fjalla One', 'Oswald', system-ui, sans-serif;
  --blue:        #006FB8;
  --blue-panel:  rgba(0, 112, 185, 0.3);
  --green:       #B7EA7A;
  --green-deep:  #9FD85A;
  --red:         #EF5C5C;
  --orange:      #FF8F61;
  --white:       #FFFFFF;
  --text-blue:   #1189C9;
  --radius:      18px;
  --ease:        cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--ff-body);
  color: var(--white);
  background: #0a2436;
  overflow: hidden;
}

/* App canvas: fills the screen, caps width on large displays */
.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  overflow: hidden;
  background-color: #1a6fb0; /* instant paint while the photo streams in */
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  /* fallback (older browsers) → optimized JPEG (151KB) */
  background-image:
    linear-gradient(180deg, rgba(4,38,68,.12) 0%, rgba(4,38,68,.04) 55%, rgba(4,38,68,.12) 100%),
    url('../img/bg.jpg');
  /* modern browsers → WebP (31KB) */
  background-image:
    linear-gradient(180deg, rgba(4,38,68,.12) 0%, rgba(4,38,68,.04) 55%, rgba(4,38,68,.12) 100%),
    -webkit-image-set(url('../img/bg.webp') type('image/webp'), url('../img/bg.jpg') type('image/jpeg'));
  background-image:
    linear-gradient(180deg, rgba(4,38,68,.12) 0%, rgba(4,38,68,.04) 55%, rgba(4,38,68,.12) 100%),
    image-set(url('../img/bg.webp') type('image/webp'), url('../img/bg.jpg') type('image/jpeg'));
}

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 6vw, 40px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px) scale(.99);
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility 0s linear .45s;
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.screen__inner {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- typography ---------- */
.title {
  font-family: var(--ff-head);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: .92;
  font-size: clamp(46px, 15vw, 76px);
  margin: .15em 0 .25em;
  text-shadow: 0 4px 24px rgba(0,0,0,.35);
}
.title--accent { color: var(--green); }
.title--cyan { color: #2BA6E0; }
.title--sm { font-size: clamp(34px, 10vw, 52px); }
.title--wide { font-size: clamp(28px, 7.6vw, 46px); white-space: nowrap; }

/* start screen: logo+title+lead at top, note+button pinned to the bottom */
#screen-start .screen__inner { height: 100%; justify-content: flex-start; padding: 4vh 0 2vh; }
/* two flexible gaps: logo→title and lead→note. They shrink when space is
   tight so the Start button always stays on screen. */
#screen-start .title { margin-top: auto; }
#screen-start .note  { margin-top: auto; }

/* full-bleed marquee band (Figma win 1:210 / fail 1:263) */
.streak {
  position: relative;
  width: 100vw; /* flex-centered & clipped by .app overflow → exact full-bleed */
  margin: 10px 0 26px;
  overflow: hidden;
  padding: 10px 0;
}
.streak--ok  { background: var(--green); }
.streak--bad { background: var(--red); }
.streak__track { display: flex; width: max-content; animation: marquee 16s linear infinite; }
.streak__grp {
  font-family: var(--ff-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1;
  font-size: clamp(26px, 7.5vw, 44px);
}
.streak--ok  .streak__grp { color: var(--text-blue); }
.streak--bad .streak__grp { color: var(--white); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* static (non-scrolling) single-line band */
.streak--static { overflow: visible; display: flex; align-items: center; justify-content: center; }
.streak__one {
  font-family: var(--ff-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
  font-size: clamp(26px, 7.5vw, 44px);
}
.streak--bad .streak__one { color: var(--white); }

/* fail screen: title on one line, subtitle on three (Figma 1:283 / 1:284) */
#screen-fail .title { white-space: nowrap; font-size: clamp(32px, 10.5vw, 62px); }
#screen-fail .lead  { max-width: 24ch; }

.lead {
  font-size: clamp(17px, 5vw, 25px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.12;
  margin: 0 0 .8em;
  max-width: 32ch;
}
.note {
  font-size: clamp(14px, 3.9vw, 20px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.12;
  color: var(--white);
  margin: 0 0 1.4em;
  max-width: 42ch;
}
.divider { width: min(70%, 240px); height: auto; margin: 4px 0 18px; opacity: .9; }

.hero-img { width: min(72%, 280px); height: auto; margin-bottom: 6px; }
.gift-img { width: min(46%, 180px); height: auto; margin-bottom: 18px;
  filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); animation: pop .5s var(--ease) both; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.55);
  background: var(--blue-panel);
  color: var(--white);
  font-family: var(--ff-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: clamp(18px, 5vw, 24px);
  padding: 18px 28px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  cursor: pointer;
  margin-top: 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transition: transform .15s var(--ease), background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: rgba(0,111,184,.85); }
.btn--ghost { background: rgba(255,255,255,.08); }

/* ---------- ribbon ---------- */
.ribbon {
  display: inline-block;
  font-family: var(--ff-head);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: clamp(15px, 4vw, 20px);
  padding: 10px 22px;
  border-radius: 40px;
  margin-bottom: 20px;
  line-height: 1.15;
  max-width: 30ch;
}
.ribbon--ok  { background: var(--green); color: #14361a; }
.ribbon--bad { background: var(--red); color: #fff; }

/* ============================================================
   QUIZ
   ============================================================ */
#screen-quiz .screen__inner { justify-content: flex-start; padding-top: 2vh; height: 100%; max-width: 470px; }
.quiz { display: flex; flex-direction: column; height: 100%; }
.quiz__panel {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: clamp(20px, 6vw, 38px);
  padding: clamp(16px, 5vw, 26px);
  backdrop-filter: blur(2px);
}
.answers-area { position: relative; width: 100%; flex: 1; display: flex; flex-direction: column; gap: 14px; }

.quiz__top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.progress { display: flex; gap: 12px; }
.dot {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-family: var(--ff-head);
  font-size: 18px;
  color: rgba(255,255,255,.85);
  background: transparent;
  border: 1px solid transparent;
  transition: all .3s var(--ease);
}
.dot.is-current {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.7);
  color: var(--white);
}
.dot.is-done { color: rgba(255,255,255,.5); }

.timer {
  font-family: var(--ff-head);
  font-size: 20px;
  letter-spacing: .04em;
  color: rgba(255,255,255,.9);
  transition: color .3s;
}
.timer.is-low { color: #ff8484; animation: pulse 1s infinite; }

.q-decor { width: min(38%, 140px); margin: 0 0 12px; }

/* blue question card (Figma 1:44) — sized to hold a 2-line question */
.qcard {
  width: 100%;
  flex: 1;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(0, 111, 184, 0.67);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: clamp(20px, 6vw, 38px);
  padding: clamp(16px, 4.5vw, 30px);
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
}
.quiz.show-fb .qcard { display: none; }

.question {
  font-family: var(--ff-head);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: 1.12;
  font-size: clamp(17px, 4.7vw, 24px);
  margin: 0;
  text-shadow: 0 3px 16px rgba(0,0,0,.35);
}
.question .ts1 { color: var(--orange); }

.answers { width: 100%; flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px; }
.answer {
  position: relative;
  width: 100%;
  border: 1px solid rgba(255,255,255,.4);
  background: rgba(255,255,255,.16);
  color: var(--white);
  font-family: var(--ff-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: clamp(16px, 4.4vw, 20px);
  line-height: 1.15;
  padding: 18px 16px;
  border-radius: 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform .15s var(--ease), background .25s, border-color .25s;
}
.answer:active { transform: scale(.98); }
.answers.is-locked .answer { cursor: default; pointer-events: none; }
.answer.is-hidden { display: none; }
.answer.is-correct {
  background: var(--blue);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.4), 0 8px 22px rgba(0,111,184,.5);
}
.answer.is-wrong {
  background: var(--red);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.4), 0 8px 22px rgba(239,92,92,.5);
}
.answer.is-reveal { /* highlights the right answer after a wrong/timeout pick */
  border-color: var(--green-deep);
  box-shadow: 0 0 0 2px var(--green-deep);
}

/* ---------- feedback card (Figma 1:92 / 1:310) ---------- */
/* Card replaces the question; the remaining answers stay dimmed below. */
.feedback { display: none; flex: 1; flex-direction: column; gap: clamp(12px, 3.5vw, 18px); }
.quiz.show-fb .feedback  { display: flex; animation: fb-in .4s var(--ease) both; }
.quiz.show-fb .question  { display: none; }
.quiz.show-fb .answers   { display: none; }

/* smooth question <-> result transitions */
.qcard, .answers { transition: opacity .25s var(--ease), transform .25s var(--ease); }
.quiz.answering .qcard,
.quiz.answering .answers { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.feedback.leaving { opacity: 0; transform: translateY(-12px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.quiz.q-enter .qcard,
.quiz.q-enter .answers { animation: q-in .38s var(--ease) both; }
@keyframes q-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.feedback__card {
  width: 100%;
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: clamp(20px, 6vw, 38px);
  padding: clamp(20px, 6vw, 40px);
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.feedback--ok  .feedback__card { background: #98BE60; }
.feedback--bad .feedback__card { background: #E8675F; }
/* correct answer can use a full background image instead of the green */
.feedback__card.has-img { background-size: cover; background-position: center; }

.feedback__title {
  font-family: var(--ff-head);
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--white);
  font-size: clamp(42px, 13.5vw, 84px);
  line-height: .9;
  margin: 0 0 .25em;
  animation: pop .4s var(--ease) both;
}
.feedback__sub {
  color: var(--white);
  font-family: var(--ff-body);
  font-size: clamp(16px, 4.6vw, 24px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.2;
  margin: 0;
  max-width: 24ch;
}
.feedback .btn { margin: 0 auto; flex: 0 0 auto; }

/* ---------- loading shade ---------- */
.shade {
  position: absolute; inset: 0;
  background: rgba(7,28,43,.6);
  display: grid; place-items: center;
  z-index: 20;
}
.shade[hidden] { display: none; }
.spinner {
  width: 46px; height: 46px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------- keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fb-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { transform: scale(1.06); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01ms !important; }
}

/* short landscape phones */
@media (max-height: 680px) {
  .hero-img { width: min(48%, 180px); }
  .title { font-size: clamp(38px, 12vw, 60px); }
}
