/* Talibankompassen
 *
 * Utbruten ur prototypens <style>-block. Färger, typografi och former är
 * oförändrade. Det som är nytt rör att alla åtta frågor nu visas samtidigt
 * i ett vanligt formulär, i stället för en i taget via JavaScript.
 *
 * Klasserna .js-* används av assets/js/compass.js i steg 5 och gör ingenting
 * förrän det skriptet finns.
 */

:root {
  --night: #21170f;
  --night-soft: #302116;
  --card: #f3dfb5;
  --card-light: #fff4d8;
  --sand: #d8ad62;
  --sand-light: #eed49a;
  --ochre: #b96d2b;
  --ochre-dark: #7f431d;
  --clay: #914927;
  --ink: #2e1d12;
  --muted: #755c45;
  --line: rgba(83, 48, 24, 0.24);
  --shadow: 0 18px 50px rgba(25, 14, 7, 0.26);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at 14% 5%, rgba(238, 212, 154, 0.34), transparent 29rem),
    radial-gradient(circle at 88% 15%, rgba(185, 109, 43, 0.21), transparent 27rem),
    linear-gradient(180deg, #d2a45d 0%, #e7ca8d 31%, #f1dfb4 68%, #c58a45 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    repeating-radial-gradient(ellipse at 20% 120%, transparent 0 32px, rgba(92, 53, 24, 0.16) 33px 34px, transparent 35px 69px),
    repeating-radial-gradient(ellipse at 75% 118%, transparent 0 45px, rgba(255, 245, 210, 0.2) 46px 48px, transparent 49px 92px);
}

/* --------------------------------------------------------------------------
   Sidhuvud
   -------------------------------------------------------------------------- */

header {
  position: relative;
  overflow: hidden;
  padding: clamp(42px, 8vw, 88px) 20px clamp(55px, 9vw, 105px);
  text-align: center;
  color: #fff5d9;
  background:
    linear-gradient(180deg, rgba(31, 19, 11, 0.1), rgba(31, 19, 11, 0.7)),
    radial-gradient(circle at 50% 12%, #c98a3e 0%, #9b5426 42%, #3c2515 100%);
  border-bottom: 1px solid rgba(255, 238, 190, 0.28);
}

header::after {
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -48px;
  height: 110px;
  background:
    radial-gradient(70% 95px at 15% 100%, #c9914f 0 70%, transparent 71%),
    radial-gradient(70% 105px at 53% 100%, #e4c47f 0 70%, transparent 71%),
    radial-gradient(70% 92px at 88% 100%, #b97438 0 70%, transparent 71%);
  opacity: 0.95;
}

.header-inner {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 239, 192, 0.42);
  border-radius: 999px;
  color: #ffeab4;
  background: rgba(48, 28, 15, 0.32);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

header h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.65rem, 8vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-shadow: 0 5px 22px rgba(26, 12, 5, 0.38);
}

header .lead {
  max-width: 760px;
  margin: 20px auto 0;
  color: #fff0c6;
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  font-weight: 570;
}

/* --------------------------------------------------------------------------
   Ytor
   -------------------------------------------------------------------------- */

main {
  width: min(920px, calc(100% - 28px));
  margin: -30px auto 0;
  padding: 0 0 48px;
  position: relative;
  z-index: 2;
}

.panel {
  padding: clamp(20px, 4.2vw, 42px);
  border: 1px solid rgba(99, 57, 25, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 247, 222, 0.98), rgba(234, 205, 145, 0.97));
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 24px;
}

.intro {
  margin: 0 0 8px;
  color: #4e3523;
  font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   Formuläret
   -------------------------------------------------------------------------- */

.question {
  padding: clamp(22px, 4vw, 34px) 0 6px;
  border-top: 1px solid var(--line);
}

.question:first-of-type {
  border-top: 0;
}

.question-number {
  display: block;
  margin: 0 0 10px;
  color: var(--ochre-dark);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.question h2 {
  max-width: 830px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.28rem, 3vw, 1.9rem);
  line-height: 1.24;
  text-wrap: balance;
}

.question > fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.question legend {
  padding: 0;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 24px;
}

.option {
  position: relative;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option label {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  padding: 13px 14px;
  border: 1px solid rgba(104, 60, 27, 0.26);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 249, 229, 0.72);
  cursor: pointer;
  font-weight: 760;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.option label:hover {
  transform: translateY(-2px);
  border-color: var(--ochre);
  background: #fff7dc;
  box-shadow: 0 9px 22px rgba(84, 45, 18, 0.12);
}

.option input:focus-visible + label {
  outline: 3px solid rgba(185, 109, 43, 0.55);
  outline-offset: 3px;
}

.option input:checked + label {
  color: #fff8e6;
  border-color: var(--ochre-dark);
  background: linear-gradient(135deg, var(--ochre-dark), var(--clay));
  box-shadow: 0 10px 24px rgba(95, 47, 22, 0.26);
}

.question.obesvarad {
  border-left: 4px solid #a3341f;
  padding-left: 14px;
  margin-left: -18px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

button {
  font: inherit;
}

.primary-btn,
.restart-btn {
  min-height: 52px;
  padding: 12px 26px;
  border-radius: 999px;
  cursor: pointer;
  color: #fff8e7;
  border: 1px solid #713718;
  background: linear-gradient(135deg, var(--ochre-dark), var(--clay));
  box-shadow: 0 9px 20px rgba(92, 45, 20, 0.22);
  font-weight: 780;
  transition: transform 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.restart-btn:hover {
  transform: translateY(-1px);
}

.felruta {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(163, 52, 31, 0.5);
  border-left: 4px solid #a3341f;
  border-radius: 12px;
  background: rgba(255, 233, 224, 0.75);
  color: #6d2313;
  font-weight: 600;
}

.felruta a {
  color: #6d2313;
}

/* --------------------------------------------------------------------------
   Resultat
   -------------------------------------------------------------------------- */

.results-heading {
  margin-bottom: 24px;
  text-align: center;
}

.results-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
}

.results-heading p {
  max-width: 690px;
  margin: 9px auto 0;
  color: var(--muted);
}

.result-list {
  display: grid;
  gap: 13px;
}

.party-result {
  overflow: hidden;
  border: 1px solid rgba(103, 58, 26, 0.22);
  border-radius: 17px;
  background: rgba(255, 249, 229, 0.76);
}

.party-summary {
  display: grid;
  width: 100%;
  grid-template-columns: 54px minmax(120px, 1.1fr) minmax(110px, 2fr) 58px 24px;
  gap: 13px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.party-summary::-webkit-details-marker {
  display: none;
}

.party-summary:hover {
  background: rgba(228, 192, 121, 0.18);
}

.party-summary:focus-visible {
  outline: 3px solid rgba(185, 109, 43, 0.55);
  outline-offset: -3px;
}

.party-initial-wrap {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(91, 50, 22, 0.2);
  border-radius: 50%;
  background: #fff7de;
  font-weight: 900;
  color: var(--ochre-dark);
}

.party-initial-wrap.party-blue {
  color: #1769aa;
}

.party-initial-wrap.party-red {
  color: #c32632;
}

.party-initial-wrap.party-green {
  color: #23834a;
}

.party-initial-wrap.party-brown {
  color: #7f431d;
}

.party-name {
  font-weight: 820;
}

.bar-container {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(73, 43, 22, 0.15);
}

.bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ochre-dark), var(--ochre), #d6a14f);
}

.score {
  color: var(--ochre-dark);
  font-size: 1.05rem;
  font-weight: 900;
  text-align: right;
}

.chevron {
  color: var(--ochre-dark);
  font-size: 1.2rem;
  transition: transform 0.22s ease;
}

details[open] .chevron {
  transform: rotate(180deg);
}

.party-details {
  padding: 0 16px 18px;
  border-top: 1px solid rgba(100, 57, 26, 0.18);
}

.details-intro {
  margin: 16px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.source-grid {
  display: grid;
  gap: 10px;
}

.source-row {
  padding: 13px 14px;
  border-left: 4px solid var(--ochre);
  border-radius: 9px;
  background: rgba(255, 253, 240, 0.72);
}

.source-row h4 {
  margin: 0 0 5px;
  font-size: 0.96rem;
}

.source-row p {
  margin: 0;
  color: #5f4937;
  font-size: 0.9rem;
}

.evidence-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff8e7;
  background: var(--ochre-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.source-row a {
  display: inline-block;
  margin-top: 7px;
  color: #7b3919;
  font-weight: 780;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.results-actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.method-note {
  margin-top: 22px;
  padding: 15px 17px;
  border: 1px dashed rgba(100, 57, 25, 0.35);
  border-radius: 13px;
  color: #604b39;
  background: rgba(255, 248, 222, 0.48);
  font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   Metod och källförteckning
   -------------------------------------------------------------------------- */

.metod h2,
.kallor h2 {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
}

.metod p {
  margin: 0 0 14px;
  color: #4e3523;
}

.kallor ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.kallor li {
  color: #5f4937;
  font-size: 0.94rem;
}

.kallor a {
  color: #7b3919;
  font-weight: 700;
  text-underline-offset: 3px;
}

.facit-tabell {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.facit-tabell caption {
  margin-bottom: 10px;
  color: var(--muted);
  text-align: left;
}

.facit-tabell th,
.facit-tabell td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.facit-tabell th:first-child,
.facit-tabell td:first-child {
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}

.tabell-svep {
  overflow-x: auto;
}

/* --------------------------------------------------------------------------
   Sidfot
   -------------------------------------------------------------------------- */

footer {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 12px 36px;
  color: #422919;
  font-size: 0.82rem;
  text-align: center;
}

footer a {
  color: #633414;
  font-weight: 750;
  text-underline-offset: 3px;
}

footer a:hover {
  color: #3f210d;
}

/* --------------------------------------------------------------------------
   Om-sidan
   -------------------------------------------------------------------------- */

.om-text p {
  margin: 0 0 16px;
  color: #4e3523;
  font-size: clamp(1rem, 2.1vw, 1.15rem);
}

.tillbaka {
  display: inline-flex;
  margin-top: 14px;
  padding: 10px 16px;
  border: 1px solid rgba(91, 50, 22, 0.24);
  border-radius: 999px;
  color: #fff4d8;
  background: var(--ochre-dark);
  font-weight: 760;
  text-decoration: none;
}

.tillbaka:hover {
  background: #5f3017;
}

/* --------------------------------------------------------------------------
   Skärmläsare
   -------------------------------------------------------------------------- */

.endast-skarmlasare {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Anpassningar
   -------------------------------------------------------------------------- */

@media (max-width: 700px) {
  .options {
    grid-template-columns: 1fr;
  }

  .party-summary {
    grid-template-columns: 48px 1fr 55px 20px;
  }

  .bar-container {
    grid-column: 2 / 5;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Stegvis läge
   --------------------------------------------------------------------------
   Allt nedan träder i kraft först när assets/js/compass.js har lagt klassen
   js-stegvis på html-elementet. Utan JavaScript ligger alla åtta frågor kvar
   synliga och formuläret skickas in på vanligt vis.
   -------------------------------------------------------------------------- */

[hidden] {
  display: none !important;
}

.progress {
  margin-bottom: 6px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(101, 58, 27, 0.16);
  border-radius: 999px;
  background: rgba(89, 51, 23, 0.13);
}

.progress-bar {
  width: 12.5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ochre-dark), var(--ochre), #d59a46);
  transition: width 0.35s ease;
}

.quiz-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.secondary-btn {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ochre-dark);
  border: 1px solid rgba(112, 61, 27, 0.28);
  background: rgba(255, 248, 225, 0.55);
  font-weight: 780;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.secondary-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.secondary-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.answer-hint {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.js-stegvis .form-actions {
  display: none;
}

.js-stegvis .question {
  min-height: 370px;
  padding-top: clamp(25px, 5vw, 48px);
  border-top: 0;
  animation: fragaIn 0.38s ease both;
}

@keyframes fragaIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .js-stegvis .question {
    min-height: 500px;
  }

  .quiz-actions {
    flex-wrap: wrap;
  }

  .answer-hint {
    order: -1;
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Resultatkategori
   --------------------------------------------------------------------------
   Bilden och texten som visas överst i resultatet. Kategorinamnet står i
   bilden, så det upprepas inte som synlig rubrik – det finns i alt-texten
   och i en rubrik för skärmläsare.
   -------------------------------------------------------------------------- */

.kategori {
  margin-bottom: 26px;
  text-align: center;
}

.kategori-etikett {
  margin: 0 0 12px;
  color: var(--ochre-dark);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Bredden ska komma från layouten, inte från bilden. main och .panel sätter
 * måttet; här fyller bilden bara ut det utrymme den får. Tidigare stod här
 * max-width: 620px, ett påhittat tal som gjorde att bilden bara fyllde tre
 * fjärdedelar av sin förälder på skrivbord.
 *
 * Källbilden är 1200 px bred, alltså alltid bredare än panelen (som mest
 * 834 px). Den skalas därför alltid ned och blir aldrig suddig. */
.kategori-bild {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(91, 50, 22, 0.24);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(84, 45, 18, 0.22);
}

.kategori-text {
  max-width: 640px;
  margin: 22px auto 0;
  color: #4e3523;
  font-size: clamp(1rem, 2.1vw, 1.12rem);
  text-align: left;
}

.lista-hjalp {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Delningsblocket
   --------------------------------------------------------------------------
   Ligger mellan kategoritexten och partilistan. Adressen står i ett läsbart
   fält, så att den går att kopiera för hand även utan JavaScript. Knapparna
   är dolda tills assets/js/dela.js visar dem.
   -------------------------------------------------------------------------- */

.dela {
  margin: 0 auto 26px;
  max-width: 640px;
  padding: 18px 20px;
  border: 1px dashed rgba(100, 57, 25, 0.4);
  border-radius: 14px;
  background: rgba(255, 248, 222, 0.55);
  text-align: center;
}

.dela-etikett {
  margin: 0 0 12px;
  color: var(--ochre-dark);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dela-rad {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
}

.dela-falt {
  flex: 1 1 260px;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(104, 60, 27, 0.32);
  border-radius: 999px;
  background: #fff9e5;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  text-align: center;
}

.dela-falt:focus-visible {
  outline: 3px solid rgba(185, 109, 43, 0.55);
  outline-offset: 2px;
}

.dela-knapp {
  min-height: 46px;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ochre-dark);
  border: 1px solid rgba(112, 61, 27, 0.32);
  background: rgba(255, 248, 225, 0.9);
  font-weight: 780;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease;
}

.dela-knapp:hover {
  transform: translateY(-1px);
  background: #fff7dc;
}

/* Finns systemets egen delningsruta är det den vägen de flesta vill gå. */
.dela-knapp-primar {
  color: #fff8e7;
  border-color: #713718;
  background: linear-gradient(135deg, var(--ochre-dark), var(--clay));
}

.dela-knapp-primar:hover {
  background: linear-gradient(135deg, #6d3917, #7d3f21);
}

.dela-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.86rem;
}
