/* ============================================================
   Hyggelig Quiz — Design System (Stueaften)
   ============================================================
   Drop this file into your project and import it once.
   Everything is namespaced under `--hq-*` and `.hq-*` to avoid
   collisions. Pair with the Google Fonts link at the bottom of
   this header — or self-host Caprasimo + Manrope.

   <link href="https://fonts.googleapis.com/css2?family=Caprasimo
     &family=Manrope:wght@400;500;600;700;800&display=swap"
     rel="stylesheet">
   ============================================================ */

/* ----- Design tokens -------------------------------------- */
:root {
  /* Surfaces */
  --hq-bg:         #E8DBB8;  /* warm oat */
  --hq-bg-soft:    #F0E5C6;
  --hq-paper:      #F7EDD2;  /* toasted paper */
  --hq-ink:        #1B120A;  /* smoky near-black */
  --hq-muted:      #76624A;
  --hq-line:       #D2C094;

  /* Accents */
  --hq-rust:       #B23F1C;  /* burnt paprika */
  --hq-rust-deep:  #7E2A10;
  --hq-forest:     #3A4E2A;  /* deep olive moss */
  --hq-forest-deep:#1F2F14;
  --hq-amber:      #C18524;  /* ochre */
  --hq-amber-deep: #8E5F12;
  --hq-brick:      #A2462A;  /* warm secondary red */
  --hq-cocoa:      #3A2114;
  --hq-burgundy:   #7A1F1A;
  --hq-success:    #4A6B43;
  --hq-success-deep:#33502E;
  --hq-danger:     #8B2E29;

  /* Typography */
  --hq-font-display: 'Caprasimo', 'Georgia', serif;
  --hq-font-body:    'Manrope', system-ui, -apple-system, sans-serif;

  /* Radii */
  --hq-radius-xs:  8px;
  --hq-radius-sm:  12px;
  --hq-radius-md:  14px;
  --hq-radius-lg:  18px;
  --hq-radius-xl:  22px;

  /* Shadows (stackable, paper-like) */
  --hq-shadow-card: 0 1px 0 var(--hq-line), 0 18px 32px -22px rgba(60,40,20,.35);
  --hq-shadow-tile: 0 6px 0 var(--hq-rust-deep), 0 14px 24px -12px rgba(60,40,20,.45);
  --hq-shadow-tile-hover: 0 9px 0 var(--hq-rust-deep), 0 18px 28px -10px rgba(60,40,20,.5);
  --hq-shadow-btn:  0 4px 0 var(--hq-rust-deep);

  /* Spacing & sizing */
  --hq-gap-tile:   12px;

  /* Motion */
  --hq-ease:       cubic-bezier(.2, .8, .2, 1);
  --hq-dur-fast:   .12s;
  --hq-dur-base:   .2s;
}

/* ----- Reset (scoped) ------------------------------------- */
.hq, .hq * { box-sizing: border-box; }
.hq button { font: inherit; cursor: pointer; }
.hq input, .hq textarea, .hq select { font: inherit; color: inherit; }

/* ----- Page shell ----------------------------------------- */
.hq-page {
  min-height: 100%;
  background: var(--hq-bg);
  color: var(--hq-ink);
  font-family: var(--hq-font-body);
  font-weight: 500;
  position: relative;
  overflow: hidden;
}
.hq-page--scroll { overflow: auto; }

/* ----- Type ----------------------------------------------- */
.hq-display     { font-family: var(--hq-font-display); font-weight: 400; line-height: 1; letter-spacing: -.01em; }
.hq-h1          { font-family: var(--hq-font-display); font-size: clamp(40px, 5vw, 60px); line-height: .95; margin: 0; }
.hq-h2          { font-family: var(--hq-font-display); font-size: 28px; line-height: 1; margin: 0; }
.hq-h3          { font-family: var(--hq-font-display); font-size: 22px; line-height: 1; margin: 0; }
.hq-eyebrow     { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--hq-forest); }
.hq-lead        { color: var(--hq-muted); font-size: 15px; line-height: 1.5; margin: 0; }
.hq-meta        { color: var(--hq-muted); font-size: 13px; font-weight: 600; }

/* ----- Pill ----------------------------------------------- */
.hq-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--hq-bg-soft); color: var(--hq-forest);
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; border: 1px solid var(--hq-line);
}
.hq-pill--amber  { background: var(--hq-amber); color: var(--hq-cocoa); border-color: var(--hq-amber-deep); }
.hq-pill--rust   { background: var(--hq-rust);  color: var(--hq-paper); border-color: var(--hq-rust-deep); }

/* ----- Card ----------------------------------------------- */
.hq-card {
  background: var(--hq-paper);
  border-radius: var(--hq-radius-lg);
  border: 1px solid var(--hq-line);
  box-shadow: var(--hq-shadow-card);
  padding: 24px;
}
.hq-card--flush { padding: 0; overflow: hidden; }

/* ----- Buttons -------------------------------------------- */
.hq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--hq-radius-md);
  font-family: var(--hq-font-body); font-weight: 700; font-size: 15px;
  background: var(--hq-paper); color: var(--hq-ink);
  border: 2px solid var(--hq-line); box-shadow: 0 4px 0 var(--hq-line);
  transition: transform var(--hq-dur-fast) var(--hq-ease),
              box-shadow var(--hq-dur-fast) var(--hq-ease),
              filter var(--hq-dur-fast) var(--hq-ease);
  user-select: none;
}
.hq-btn:hover  { filter: brightness(1.03); }
.hq-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--hq-line); }
.hq-btn[disabled] { opacity: .55; cursor: not-allowed; }

.hq-btn--sm { padding: 8px 14px; font-size: 13px; border-radius: var(--hq-radius-sm); }
.hq-btn--lg { padding: 16px 28px; font-size: 17px; border-radius: var(--hq-radius-lg); }

.hq-btn--primary {
  background: var(--hq-rust); color: var(--hq-paper);
  border-color: var(--hq-rust-deep); box-shadow: 0 4px 0 var(--hq-rust-deep);
}
.hq-btn--primary:active { box-shadow: 0 1px 0 var(--hq-rust-deep); }

.hq-btn--forest {
  background: var(--hq-success); color: var(--hq-paper);
  border-color: var(--hq-success-deep); box-shadow: 0 4px 0 var(--hq-success-deep);
}
.hq-btn--forest:active { box-shadow: 0 1px 0 var(--hq-success-deep); }

.hq-btn--danger {
  background: var(--hq-burgundy); color: var(--hq-paper);
  border-color: var(--hq-danger); box-shadow: 0 4px 0 var(--hq-danger);
}
.hq-btn--danger:active { box-shadow: 0 1px 0 var(--hq-danger); }

.hq-btn--amber {
  background: var(--hq-amber); color: var(--hq-cocoa);
  border-color: var(--hq-amber-deep); box-shadow: 0 4px 0 var(--hq-amber-deep);
}
.hq-btn--amber:active { box-shadow: 0 1px 0 var(--hq-amber-deep); }

/* Icon-only square button */
.hq-icon-btn {
  width: 36px; height: 36px; padding: 0;
  background: var(--hq-paper); border: 1.5px solid var(--hq-line);
  border-radius: var(--hq-radius-sm); cursor: pointer; font-size: 18px;
  color: var(--hq-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.hq-icon-btn:hover { background: var(--hq-bg-soft); }

/* ----- Form fields ---------------------------------------- */
.hq-field {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--hq-muted); margin-bottom: 6px;
}
.hq-input, .hq-select, .hq-textarea {
  width: 100%; background: var(--hq-paper); color: var(--hq-ink);
  border: 1.5px solid var(--hq-line); border-radius: var(--hq-radius-sm);
  padding: 10px 14px; font-family: var(--hq-font-body); font-weight: 600;
  font-size: 15px; outline: none;
  transition: border-color var(--hq-dur-fast), box-shadow var(--hq-dur-fast);
}
.hq-input:focus, .hq-select:focus, .hq-textarea:focus {
  border-color: var(--hq-rust); box-shadow: 0 0 0 4px rgba(178, 63, 28, .15);
}
.hq-select { appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--hq-muted) 50%),
                    linear-gradient(135deg, var(--hq-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 32px;
}
.hq-textarea { resize: vertical; min-height: 80px; }
.hq-checkbox { width: 18px; height: 18px; accent-color: var(--hq-rust); }

/* ----- Board: category row -------------------------------- */
.hq-cats {
  display: grid; grid-template-columns: repeat(var(--hq-cols, 5), 1fr);
  gap: var(--hq-gap-tile); margin-bottom: var(--hq-gap-tile);
}
.hq-cat {
  background: var(--hq-ink); color: var(--hq-paper);
  border-radius: var(--hq-radius-md); padding: 14px 12px;
  text-align: center; position: relative;
  box-shadow: 0 8px 16px -10px rgba(0,0,0,.4);
}
.hq-cat__icon { position: absolute; top: 8px; left: 10px; }
.hq-cat__name { font-family: var(--hq-font-display); font-size: 20px; line-height: 1; }
/* Tilt each tile slightly for a card-stack feel */
.hq-cats .hq-cat:nth-child(odd)  { transform: rotate(.4deg); }
.hq-cats .hq-cat:nth-child(even) { transform: rotate(-.4deg); }

/* ----- Board: value tiles --------------------------------- */
.hq-tiles {
  display: grid; grid-template-columns: repeat(var(--hq-cols, 5), 1fr);
  gap: var(--hq-gap-tile);
}
.hq-tile {
  --tile-rot: 0deg;
  background: var(--hq-rust); color: var(--hq-paper);
  border: 2px solid var(--hq-rust-deep);
  border-radius: var(--hq-radius-lg); padding: 22px 10px;
  font-family: var(--hq-font-display); font-size: 38px; line-height: 1;
  cursor: pointer; transform: rotate(var(--tile-rot));
  box-shadow: var(--hq-shadow-tile);
  transition: transform var(--hq-dur-base) var(--hq-ease),
              box-shadow var(--hq-dur-base) var(--hq-ease);
  text-align: center;
}
.hq-tile:hover:not([disabled]) {
  transform: rotate(var(--tile-rot)) translateY(-3px);
  box-shadow: var(--hq-shadow-tile-hover);
}
.hq-tile[disabled] {
  background: var(--hq-bg-soft); color: var(--hq-muted);
  border-color: var(--hq-line); box-shadow: none;
  font-size: 18px; cursor: default;
}
/* Subtle pseudo-randomised tilt by nth-child for an organic stack */
.hq-tile:nth-child(7n+1) { --tile-rot:  .35deg; }
.hq-tile:nth-child(7n+2) { --tile-rot: -.50deg; }
.hq-tile:nth-child(7n+3) { --tile-rot:  .25deg; }
.hq-tile:nth-child(7n+4) { --tile-rot: -.30deg; }
.hq-tile:nth-child(7n+5) { --tile-rot:  .45deg; }
.hq-tile:nth-child(7n+6) { --tile-rot: -.20deg; }
.hq-tile:nth-child(7n+7) { --tile-rot:  .15deg; }

/* ----- Score panel ---------------------------------------- */
.hq-score { display: flex; flex-direction: column; gap: 8px; }
.hq-score__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: var(--hq-radius-md);
  border: 1.5px solid var(--hq-line); background: transparent;
  transition: background var(--hq-dur-base), border-color var(--hq-dur-base);
}
.hq-score__row.is-active {
  background: var(--hq-bg-soft); border-color: var(--hq-forest);
}
.hq-score__name {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px;
}
.hq-score__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--hq-line); }
.hq-score__row.is-active .hq-score__dot { background: var(--hq-forest); }
.hq-score__badge {
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
  color: var(--hq-forest); background: var(--hq-paper);
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--hq-forest);
}
.hq-score__value { font-family: var(--hq-font-display); font-size: 22px; }
.hq-score__value.is-negative { color: var(--hq-burgundy); }

/* ----- Modal ---------------------------------------------- */
.hq-overlay {
  position: absolute; inset: 0; padding: 24px;
  background: rgba(27, 18, 10, .55);
  display: grid; place-items: center; z-index: 10;
  animation: hq-fade-in .2s var(--hq-ease);
}
.hq-overlay[hidden] { display: none; }
@keyframes hq-fade-in { from { opacity: 0 } to { opacity: 1 } }
.hq-modal {
  width: min(820px, 100%);
  background: var(--hq-paper); border: 1px solid var(--hq-line);
  border-radius: var(--hq-radius-lg); box-shadow: var(--hq-shadow-card);
  overflow: hidden; transform: rotate(-.3deg);
  animation: hq-modal-in .25s var(--hq-ease);
}
@keyframes hq-modal-in {
  from { opacity: 0; transform: rotate(-.3deg) translateY(8px); }
  to   { opacity: 1; transform: rotate(-.3deg) translateY(0); }
}
.hq-modal__head {
  padding: 16px 22px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1.5px dashed var(--hq-line);
}
.hq-modal__stage {
  background: var(--hq-ink); color: var(--hq-paper);
  padding: 48px 40px; position: relative; text-align: center;
}
.hq-modal__stage--forest { background: var(--hq-forest); }
.hq-modal__q {
  font-family: var(--hq-font-display); font-size: 38px; line-height: 1.15;
  text-wrap: balance;
}
.hq-modal__a {
  margin-top: 22px; padding: 14px 18px; background: var(--hq-amber);
  color: var(--hq-cocoa); border-radius: var(--hq-radius-sm);
  font-weight: 700; font-size: 17px;
}
.hq-modal__foot {
  padding: 16px 22px; display: flex; justify-content: space-between;
  align-items: center; gap: 14px; flex-wrap: wrap;
}

/* ----- Podium / results ----------------------------------- */
.hq-podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; }
.hq-podium__col { text-align: center; min-width: 160px; }
.hq-podium__score { font-family: var(--hq-font-display); font-size: 38px; color: var(--hq-ink); }
.hq-podium__name  { font-weight: 700; font-size: 18px; margin-bottom: 8px; }
.hq-podium__block {
  border-radius: 18px 18px 4px 4px;
  border: 2px solid var(--hq-ink); box-shadow: 0 4px 0 var(--hq-ink);
  display: grid; place-items: center;
  font-family: var(--hq-font-display); font-size: 46px; color: var(--hq-paper);
}
.hq-podium__col--1 .hq-podium__block { background: var(--hq-amber); color: var(--hq-cocoa); height: 150px; }
.hq-podium__col--2 .hq-podium__block { background: var(--hq-brick); height: 110px; }
.hq-podium__col--3 .hq-podium__block { background: var(--hq-forest); height: 80px; }

/* ----- Decorative squiggle / dots (utility) --------------- */
.hq-deco { position: absolute; pointer-events: none; opacity: .55; }

/* ----- Confetti dots (results) ---------------------------- */
.hq-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hq-confetti span {
  position: absolute; width: 8px; height: 8px; border-radius: 999px; opacity: .55;
  animation: hq-drift 6s ease-in-out infinite alternate;
}
@keyframes hq-drift { from { transform: translateY(0) rotate(0); } to { transform: translateY(-12px) rotate(15deg); } }
