/* Notion Community Events design system, applied to the quiz.
   Tokens come from the design system artifact: flat accent background, ink text,
   white tiles, NotionHand for headlines, NotionInter for everything else, -3% tracking.
   One accent per event: orange. */

@font-face { font-family: "NotionHand Community"; src: url("fonts/NotionHand-Community.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "NotionInter"; src: url("fonts/NotionInter-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }

:root {
  --ink: #000000;
  --white: #ffffff;
  --accent: #ff9c52;        /* orange */
  --yellow: #ffc95e;        /* selected state, used as a background only */
  --font-display: "NotionHand Community", "Noto Sans", sans-serif;
  --font-sans: "NotionInter", "Noto Sans", system-ui, sans-serif;
  --radius: 14px;           /* radius-photo-lg */
  --radius-tile: 20px;      /* radius-tile */
  --gap-line: 11px;         /* space-line */
  --margin: 20px;
  --sketch: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%2060%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M%2011%2C2.4%20C%2052%2C1.0%2096%2C2.9%20139%2C2.1%20S%20225%2C2.8%20267%2C2.0%20S%20350%2C1.7%20389%2C2.4%20Q%20397%2C2.6%20397.7%2C10%20C%20398.6%2C20%20397.0%2C37%20397.8%2C49%20Q%20397.9%2C57.6%20389%2C57.8%20C%20349%2C59.1%20305%2C56.8%20263%2C57.7%20S%20177%2C57.2%20135%2C58.0%20S%2052%2C57.1%2011%2C57.7%20Q%202.2%2C57.4%202.3%2C49%20C%201.4%2C38%203.0%2C23%202.2%2C11%20Q%202.0%2C3.0%2011%2C2.4%20Z%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222.4%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20vector-effect%3D%22non-scaling-stroke%22%2F%3E%3C%2Fsvg%3E');   /* hand-drawn wobbly outline, used behind answers and the name tag */
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--accent); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--accent); color: var(--ink);
  font: 400 17px/1.45 var(--font-sans); letter-spacing: -0.03em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;          /* tilted stickers may bleed off the edge without causing sideways scroll */
}
img { display: block; max-width: 100%; height: auto; }
::selection { background: var(--yellow); color: var(--ink); }
input { caret-color: var(--ink); }
button, label { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; letter-spacing: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Page shell ---------- */
.page {
  min-height: 100dvh; width: 100%; max-width: 640px; margin: 0 auto; overflow-x: clip;
  display: flex; flex-direction: column;
  padding: max(clamp(24px, 9vh, 96px), env(safe-area-inset-top)) max(var(--margin), env(safe-area-inset-right))
           max(28px, env(safe-area-inset-bottom)) max(var(--margin), env(safe-area-inset-left));
}
.screen { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; padding: 22px 0 8px; }

/* Event sticker: logo + event name on a translucent white label, tilted. */
.brand {
  display: inline-flex; align-items: center; gap: 10px; align-self: center;
  padding: 6px 12px 6px 8px; background: rgba(255,255,255,.3); border-radius: 8px; transform: rotate(-2deg);
  font: 400 21px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: -0.03em; white-space: nowrap;
}
.brand img { width: 30px; height: 30px; object-fit: contain; }

/* ---------- Type ---------- */
.display, h1, h2 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  letter-spacing: -0.03em; line-height: 1.08; margin: 0; text-wrap: balance;
}
h1 { font-size: clamp(44px, 14vw, 72px); line-height: 1.02; }
h2 { font-size: clamp(32px, 9.4vw, 46px); }
h1:focus, h2:focus { outline: none; }
p { margin: 0; }
.lede { font-size: 19px; max-width: 30ch; }
.eyebrow { font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 400; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 10px 26px;
  background: var(--white); border: 0; border-radius: var(--radius); cursor: pointer;
  font: 400 25px/1 var(--font-display); text-transform: uppercase; letter-spacing: -0.03em; white-space: nowrap;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover:not(:disabled) { background: var(--yellow); transform: rotate(-1deg); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-text {
  min-height: 48px; padding: 8px 6px; background: none; border: 0; border-radius: 8px; cursor: pointer;
  font: 400 17px/1 var(--font-sans); text-decoration: underline; text-underline-offset: 4px;
}
.btn-text:hover { background: rgba(0,0,0,.08); }

/* ---------- Intro ---------- */
.intro { gap: 18px; align-items: center; text-align: center; }
.intro .lede { margin-inline: auto; }
.intro-actions { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-top: 4px; }
.intro-art { order: -1; width: clamp(120px, 36vw, 180px); transform: rotate(10deg); }

/* ---------- Name ---------- */
#name-title { text-align: center; }
.name-form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.field-label { font-size: 17px; }
.field {
  width: 100%; min-height: 60px; padding: 12px 18px; background: var(--white); color: var(--ink);
  border: 0; border-radius: var(--radius); font: 400 22px/1.2 var(--font-sans); letter-spacing: -0.03em;
}
.field::placeholder { color: rgba(0,0,0,.62); }
.hint { font-size: 15px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }

/* ---------- Quiz ---------- */
.progress { display: flex; gap: 6px; align-items: center; justify-content: center; min-height: 28px; margin: 22px 0 0; padding: 0; list-style: none; }
.progress li { width: 18px; height: 24px; position: relative; }
.progress li::after { content: ""; position: absolute; left: 4px; top: 8px; width: 9px; height: 9px; border: 2px solid var(--ink); border-radius: 50%; }
.progress li.done::after { background: var(--ink); }
.progress li.current::after { left: 2px; top: 6px; width: 13px; height: 13px; background: var(--ink); border-radius: 3px; transform: rotate(45deg); }
.question { margin: 0 0 22px; text-align: center; }
.options { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.option {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px;
  background: var(--white); border-radius: var(--radius); cursor: pointer; line-height: 1.3; font-size: 18px;
  transition: transform .12s ease, background-color .12s ease;
}
/* Hand-drawn, slightly wobbly outline around each answer (same drawing as the first version of the quiz). */
.option { position: relative; isolation: isolate; }
.option::after, .name-tag::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; background-repeat: no-repeat; background-size: 100% 100%;
  background-image: var(--sketch);
}
.option:hover { transform: rotate(-.6deg); }
.option:has(input:checked) { background: var(--yellow); transform: rotate(-.6deg); }
.option:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.option input {
  appearance: none; -webkit-appearance: none; flex: none; width: 24px; height: 24px; margin: 0;
  border: 2px solid var(--ink); border-radius: 50%; background: transparent; display: grid; place-content: center;
}
.option input::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .12s ease; }
.option input:checked::before { transform: scale(1); }
.option input:focus-visible { outline: none; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* ---------- Reveal and result ---------- */
.center { align-items: center; text-align: center; gap: 18px; }
.spark { width: 84px; height: 84px; object-fit: contain; }
.spark.wiggle { animation: wiggle 1.6s ease-in-out both; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0) scale(1); } 16% { transform: rotate(-17deg) scale(1.08); }
  34% { transform: rotate(19deg) scale(1.14); } 52% { transform: rotate(-13deg) scale(1.08); }
  70% { transform: rotate(13deg) scale(1.12); } 86% { transform: rotate(-6deg) scale(1.03); }
}
.reveal-copy { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 460px; }
/* Result: a sticker slapped onto the page, a name tag stuck on its corner, then the vibe in big hand lettering. */
#result { gap: 0; }
.sticker { position: relative; padding: 20px 14px 8px; }   /* still hit area: the picture moves, this does not, so hover never flickers at the edge */
.result-art {
  display: block; width: min(58vw, 250px); height: min(28dvh, 250px); object-fit: contain; transform: rotate(6deg);
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);   /* fallback for browsers without linear() */
  transition: transform .6s linear(0, .402 7.4%, .711 15.3%, .929 23.7%, 1.008 28.2%, 1.067 33%, 1.099 36.9%, 1.12 41%, 1.13 45.4%, 1.121 50%, 1.103 54.6%, 1.073 59.7%, 1.037 65.4%, 1.012 70.6%, 1.002 75%, .999 82%, 1);
}
.name-tag {
  position: absolute; z-index: 2; left: -4px; top: 6px; max-width: 82%; isolation: isolate;
  padding: 8px 16px; background: var(--white); border-radius: 10px; transform: rotate(-6deg);
  font: 400 20px/1.15 var(--font-sans); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}
#result-title { margin: 12px 0 0; font-size: clamp(46px, 15vw, 84px); line-height: .98; max-width: 11ch; }
.result-copy { max-width: 27ch; margin: 14px 0 0; font-size: 19px; line-height: 1.4; }
#restart { margin-top: 26px; }
.save-status { min-height: 28px; margin-top: 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Hover: the sticker swings up and over, then settles (a spring, so it overshoots a little). The tag swings the other way. */
@media (hover: hover) and (pointer: fine) {
  .sticker:hover .result-art { transform: rotate(-5deg) scale(1.1) translateY(-4px); }
  .sticker:hover .name-tag { transform: rotate(-11deg) translate(-3px, -4px); }
  .sticker:active .result-art { transform: rotate(-5deg) scale(1.03); transition-duration: .15s; }
}
/* Arrival: slap the sticker down, stick the tag on, then let the words follow. Runs once per result. */
.arrive .result-art { animation: slap .55s cubic-bezier(.16, 1, .3, 1) backwards; }
.arrive .name-tag { animation: tag-in .5s cubic-bezier(.16, 1, .3, 1) .25s backwards; }
.arrive .reveal-in { animation: arrive .5s cubic-bezier(.16, 1, .3, 1) calc(var(--d, 0) * 1ms) backwards; }
@keyframes slap { from { opacity: 0; transform: rotate(-16deg) scale(1.6); } 45% { opacity: 1; } }
@keyframes tag-in { from { opacity: 0; transform: translateY(-18px) rotate(-18deg) scale(.7); } }
@keyframes arrive { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* Tap or click: a one-shot wiggle for touch screens, where there is no hover. */
.result-art.wiggle { animation: sticker-wiggle .8s ease-in-out; }
@keyframes sticker-wiggle {
  0%, 100% { transform: rotate(6deg) scale(1); }
  25% { transform: rotate(-7deg) scale(1.1); }
  50% { transform: rotate(12deg) scale(1.06); }
  75% { transform: rotate(2deg) scale(1.03); }
}

@media (min-width: 720px) {
  body { font-size: 18px; }
  .screen { padding: 28px 0 20px; }
  .option { font-size: 19px; }
}
@media (max-height: 700px) {   /* small phones: keep the whole result, including the save line, on one screen */
  .page { padding-top: max(20px, env(safe-area-inset-top)); }
  .screen { padding-top: 12px; }
  .result-art { height: min(22dvh, 250px); }
  .result-copy { font-size: 17px; }
  #restart { margin-top: 18px; }
  .save-status { margin-top: 8px; }
}
@media (max-width: 340px) {
  .brand { font-size: 18px; } .btn { font-size: 22px; padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Keep a calm acknowledgement of hover: a small grow, no swinging. */
  .sticker:hover .result-art { transform: rotate(6deg) scale(1.05); transition: transform .2s ease !important; }
  .sticker:hover .name-tag { transform: rotate(-6deg); }
}
