/* Matristräning på webben. Värdena speglar Docs/Design.md och
   App/Matristraning/Design/. Ändras något där ändras det här. */

:root {
  --background: #F1F3F7;
  --card: #FFFFFF;
  --raised: #FFFFFF;
  --ink: #0F141B;
  --ink-soft: #5A6472;
  --hairline: rgba(15, 20, 27, 0.10);
  --accent: #16307A;
  --on-accent: #FFFFFF;
  --correct: #16714A;
  --wrong: #A33622;
  --correct-tint: rgba(22, 113, 74, 0.12);
  --wrong-tint: rgba(163, 54, 34, 0.10);
  --shadow: 0 1px 2px rgba(15, 20, 27, 0.04), 0 8px 24px rgba(15, 20, 27, 0.05);
  --shadow-deep: 0 24px 60px rgba(15, 20, 27, 0.18);
  --grid: rgba(15, 20, 27, 0.035);
  --glass: rgba(255, 255, 255, 0.72);

  /* Startbildens övertoning. Samma i ljust och mörkt. */
  --launch-top: #2E4FB0;
  --launch-mid: #7894D9;
  --launch-bottom: #E6ECF9;

  --space-hair: 4px;
  --space-tight: 8px;
  --space-snug: 12px;
  --space-normal: 16px;
  --space-wide: 24px;
  --space-section: 32px;
  --space-block: 96px;
  --radius-card: 22px;
  --radius-option: 18px;
  --radius-inner: 14px;
  --radius-panel: 32px;
  --target: 44px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0A0D12;
    --card: #161B23;
    --raised: #1C222B;
    --ink: #E9EDF3;
    --ink-soft: #9BA5B4;
    --hairline: rgba(233, 237, 243, 0.10);
    --accent: #9BB0FF;
    --on-accent: #0A0D12;
    --correct: #54CC92;
    --wrong: #FF8E75;
    --correct-tint: rgba(84, 204, 146, 0.14);
    --wrong-tint: rgba(255, 142, 117, 0.12);
    --shadow: none;
    --shadow-deep: 0 24px 60px rgba(0, 0, 0, 0.5);
    --grid: rgba(233, 237, 243, 0.035);
    --glass: rgba(22, 27, 35, 0.72);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--background);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

.page { max-width: 1120px; margin: 0 auto; padding: 0 var(--space-normal) var(--space-section); }
.narrow { max-width: 680px; margin: 0 auto; }

/* ---- Navigering: ett flytande glasfält ------------------------------- */

.nav {
  position: sticky;
  top: var(--space-snug);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--space-normal);
  margin: var(--space-snug) auto 0;
  max-width: 1120px;
  min-height: 60px;
  padding: var(--space-tight) var(--space-tight) var(--space-tight) var(--space-wide);
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  box-shadow: var(--shadow);
}
.nav .wordmark {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav .wordmark:hover { text-decoration: none; }
.nav .wordmark img { width: 28px; height: 28px; border-radius: 8px; }
.nav .links { display: flex; gap: var(--space-wide); margin-left: var(--space-normal); }
.nav .links a { color: var(--ink); font-weight: 500; font-size: 15px; }
.nav .spacer { flex: 1; }
.nav .lang { display: inline-flex; gap: 2px; }
.nav .lang a, .nav .lang span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-soft);
}
.nav .lang a:hover { text-decoration: none; color: var(--ink); }
.nav .lang span { background: var(--hairline); color: var(--ink); }
.nav .cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
  border-radius: 999px; background: var(--ink); color: var(--background);
  font-weight: 600; font-size: 15px;
}
.nav .cta:hover { text-decoration: none; opacity: 0.9; }
@media (max-width: 720px) {
  .nav { padding-left: var(--space-normal); min-height: 56px; }
  .nav .links { display: none; }
  .nav .wordmark span { display: none; }
}

/* ---- Hjälten: startbildens övertoning ------------------------------- */

.hero {
  position: relative;
  margin-top: var(--space-wide);
  padding: 72px var(--space-wide) 0;
  border-radius: var(--radius-panel);
  overflow: hidden;
  text-align: center;
  color: #FFFFFF;
  background: linear-gradient(180deg, var(--launch-top) 0%, var(--launch-mid) 62%, var(--launch-bottom) 100%);
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: var(--space-wide);
}
.hero h1 {
  font-size: clamp(44px, 8vw, 84px);
  letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 14ch;
  margin: 0 auto;
}
.hero h1 .soft { color: rgba(255, 255, 255, 0.62); display: block; }
.hero .lead {
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
  max-width: 34ch;
  margin: var(--space-wide) auto 0;
}
.hero .actions { margin-top: var(--space-section); display: flex; flex-direction: column; align-items: center; gap: var(--space-snug); }
.hero .note { font-size: 13px; color: rgba(255, 255, 255, 0.72); margin: 0; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 28px; border-radius: 999px;
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.button:hover { text-decoration: none; }
.button:active { transform: scale(0.98); }
.button.primary { background: var(--accent); color: var(--on-accent); border: 0; }
.button.primary:hover { opacity: 0.92; }
.button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--hairline); }
.button.secondary:hover { background: var(--card); }
.button.light { background: #FFFFFF; color: #0F141B; border: 0; min-height: 60px; padding: 0 34px; font-size: 18px; box-shadow: 0 12px 30px rgba(15, 20, 27, 0.18); }
.button.light:hover { box-shadow: 0 16px 40px rgba(15, 20, 27, 0.22); transform: translateY(-1px); }
.button.wide { width: 100%; }
.button .arrow { font-weight: 400; }

/* Telefonerna som stiger ur hjältens nederkant. */
.phones {
  display: flex; align-items: flex-start; justify-content: center; gap: 0;
  margin-top: 56px; height: 400px; padding: 0 var(--space-normal);
}
.phones .phone { width: 250px; flex: 0 0 auto; }
.phones .phone.side { width: 210px; margin-top: 64px; }
.phones .phone.left { transform: translateX(28px) rotate(-3deg); z-index: 1; }
.phones .phone.right { transform: translateX(-28px) rotate(3deg); z-index: 1; }
.phones .phone.center { z-index: 2; }
@media (max-width: 720px) {
  .hero { padding-top: 56px; }
  .phones { height: 300px; margin-top: 40px; }
  .phones .phone { width: 200px; }
  .phones .phone.side { width: 160px; margin-top: 50px; }
}
@media (max-width: 460px) {
  .phones .phone.side { display: none; }
  .phones .phone { width: 220px; }
}

/* En telefonram i CSS runt en rå skärmbild. */
.phone {
  position: relative;
  border-radius: 46px;
  padding: 10px;
  background: #0F141B;
  box-shadow: var(--shadow-deep), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.phone img { border-radius: 38px; width: 100%; aspect-ratio: 1206 / 2622; object-fit: cover; }
.phone::after {
  content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 28%; height: 24px; border-radius: 999px; background: #0F141B;
}

/* ---- Sektioner ------------------------------------------------------ */

.block { padding: var(--space-block) 0 0; }
.block-head { text-align: center; max-width: 640px; margin: 0 auto var(--space-section); }
.block-head h2 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -0.03em; }
.block-head p { font-size: clamp(17px, 2vw, 19px); color: var(--ink-soft); margin: var(--space-normal) auto 0; max-width: 46ch; }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 var(--space-snug); }

/* Värdet: tre kort. */
.value { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-normal); }
.value .card { padding: var(--space-wide); display: flex; flex-direction: column; gap: var(--space-normal); }
.value .glyph {
  width: 88px; height: 88px; border-radius: var(--radius-inner);
  background: var(--background); border: 1px solid var(--hairline);
  padding: 8px; color: var(--ink);
}
.value .glyph svg { width: 100%; height: 100%; }
.value h3 { font-size: 22px; letter-spacing: -0.02em; }
.value p { margin: 0; color: var(--ink-soft); }
@media (max-width: 820px) { .value { grid-template-columns: 1fr; } }

/* Kortet: card, hårfin kant, mjuk skugga. Texten inne i det är vänsterställd. */
.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: var(--space-normal);
  text-align: left;
}
.card h2, .card h3 { font-size: 20px; line-height: 1.25; margin: 0 0 var(--space-snug); letter-spacing: -0.01em; }
.card h3 { font-size: 17px; }
.card p { margin: 0 0 var(--space-snug); }
.card p:last-child, .card ul:last-child, .card ol:last-child { margin-bottom: 0; }
.card ul, .card ol { margin: 0 0 var(--space-snug); padding-left: 22px; }
.card li { margin-bottom: var(--space-tight); }
.card li:last-child { margin-bottom: 0; }
.caption { font-size: 13px; color: var(--ink-soft); }

/* Skärmbilder: fyra telefoner, rullar i sidled på mobil. */
.shots {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-wide);
  align-items: start;
}
.shots figure { margin: 0; text-align: center; }
.shots .phone { margin: 0 auto; max-width: 260px; }
.shots figcaption { margin-top: var(--space-normal); font-size: 15px; color: var(--ink-soft); }
.shots figcaption strong { color: var(--ink); display: block; font-weight: 600; }
@media (max-width: 900px) {
  .shots {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--space-normal);
    padding: 0 var(--space-normal) var(--space-normal); margin: 0 calc(-1 * var(--space-normal));
    scrollbar-width: none;
  }
  .shots::-webkit-scrollbar { display: none; }
  .shots figure { flex: 0 0 72%; max-width: 260px; scroll-snap-align: center; }
}

/* Alva Labs: ett mörkt kort. */
.dark-card {
  background: var(--ink); color: var(--background);
  border-radius: var(--radius-panel); padding: clamp(32px, 6vw, 64px);
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-section); align-items: center;
}
.dark-card h2 { font-size: clamp(30px, 4.5vw, 44px); letter-spacing: -0.03em; }
.dark-card p { margin: 0 0 var(--space-normal); opacity: 0.86; }
.dark-card p:last-child { margin: 0; }
.dark-card .caption { opacity: 0.6; }
@media (max-width: 820px) { .dark-card { grid-template-columns: 1fr; } }

/* Hämta appen. */
.cta-panel {
  border-radius: var(--radius-panel); text-align: center; color: #FFFFFF;
  padding: clamp(48px, 8vw, 96px) var(--space-wide);
  background: linear-gradient(180deg, var(--launch-top) 0%, var(--launch-mid) 100%);
}
.cta-panel h2 { font-size: clamp(32px, 5vw, 56px); letter-spacing: -0.03em; }
.cta-panel p { color: rgba(255, 255, 255, 0.86); max-width: 44ch; margin: var(--space-normal) auto var(--space-section); font-size: 18px; }
.cta-panel .note { font-size: 13px; color: rgba(255, 255, 255, 0.72); margin: var(--space-snug) 0 0; }

/* Läs mer: frågor och svar. */
.more details { border-bottom: 1px solid var(--hairline); }
.more details:last-child { border-bottom: 0; }
.more summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-snug); min-height: var(--target); padding: var(--space-normal) 0; font-weight: 600; font-size: 18px;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after {
  content: "+"; font-weight: 400; font-size: 24px; color: var(--ink-soft); transition: transform 0.18s ease; line-height: 1;
}
.more details[open] summary::after { transform: rotate(45deg); }
.more details p, .more details ol { margin: 0 0 var(--space-normal); color: var(--ink); }
.more details ol { padding-left: 22px; }
.more details li { margin-bottom: var(--space-tight); }
.more details > *:last-child { margin-bottom: var(--space-wide); }

/* Rader i ett kort. */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: var(--space-snug); min-height: var(--target); padding: var(--space-snug) 0; border-bottom: 1px solid var(--hairline); margin: 0; }
.rows li:last-child { border-bottom: 0; }
.rows .num { flex: 0 0 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); border: 1px solid var(--hairline); }

/* Undersidor: rubrik och ingress centrerade. */
.page-header { text-align: center; padding: var(--space-section) 0 var(--space-wide); }
.page-header h1 { font-size: 36px; margin: 0 auto var(--space-snug); max-width: 420px; }
.page-header .meta { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* ---- Smakprovet ------------------------------------------------------ */

.sample-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-snug); margin-bottom: var(--space-wide); font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sample-head strong { color: var(--ink); font-weight: 600; }
.matrix { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--hairline); border-radius: 20px; overflow: hidden; max-width: 420px; margin: 0 auto; }
.matrix .cell { position: relative; aspect-ratio: 1; padding: 4px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); transition: background-color 0.32s ease; }
.matrix .cell:nth-child(3n) { border-right: 0; }
.matrix .cell:nth-child(n+7) { border-bottom: 0; }
.matrix .cell.revealed { background: var(--correct-tint); }
.cell svg, .option svg { width: 100%; height: 100%; display: block; color: var(--ink); }
.card .options-label { text-align: center; font-size: 15px; font-weight: 600; color: var(--ink-soft); margin: 40px 0 var(--space-normal); }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-normal); margin: 0 auto; padding: 0; list-style: none; max-width: 420px; }
.option { position: relative; aspect-ratio: 1; padding: 6px; background: var(--card); border: 1.5px solid var(--hairline); border-radius: var(--radius-option); cursor: pointer; transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease; -webkit-tap-highlight-color: transparent; font: inherit; color: inherit; width: 100%; }
.option:hover:not(:disabled) { border-color: var(--ink-soft); }
.option:active:not(:disabled) { transform: scale(0.97); }
.option:disabled { cursor: default; }
.option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.option .letter { position: absolute; top: 8px; left: 10px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.option.correct { border-color: var(--correct); background: var(--correct-tint); }
.option.wrong { border-color: var(--wrong); background: var(--wrong-tint); }
.option.correct .letter { color: var(--correct); }
.option.wrong .letter { color: var(--wrong); }
.option .mark { position: absolute; top: 6px; right: 8px; font-size: 14px; font-weight: 700; }
.option.correct .mark { color: var(--correct); }
.option.wrong .mark { color: var(--wrong); }
.verdict { margin-top: var(--space-section); padding-top: var(--space-wide); border-top: 1px solid var(--hairline); }
.verdict h3 { display: flex; align-items: center; gap: var(--space-tight); margin-bottom: var(--space-tight); }
.verdict h3 .badge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--on-accent); }
.verdict.correct h3 .badge { background: var(--correct); }
.verdict.wrong h3 .badge { background: var(--wrong); }
.verdict ul { padding-left: 20px; margin: 0 0 var(--space-normal); }
.verdict li { margin-bottom: var(--space-hair); }
.verdict .rules { margin: 0 0 var(--space-normal); }
.sample-actions { margin-top: var(--space-normal); }
.sample.card { max-width: 560px; margin: 0 auto; padding: var(--space-section) var(--space-wide); }
.hidden { display: none !important; }

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

.footer { margin-top: var(--space-block); padding-top: var(--space-wide); border-top: 1px solid var(--hairline); font-size: 13px; color: var(--ink-soft); text-align: center; }
.footer p { margin: 0 0 var(--space-tight); }
.footer nav a { margin: 0 var(--space-tight); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
