/* Matheomatik — wallgrn.com/matheomatik
   Färgerna kommer från appen: bakgrundens blå toning och varje räknesätts egen färg.
   Inga externa typsnitt eller skript – sidan skickar ingenting någonstans. */

:root {
  --sky-1: #36d1e8;
  --sky-2: #2f7cf6;
  --sky-3: #6a4cf0;
  --night: #121a46;
  --ink: #1b2340;
  --ink-soft: #4c5677;
  --paper: #ffffff;
  --cloud: #f3f7ff;
  --add-1: #34d399; --add-2: #059669;
  --sub-1: #fb923c; --sub-2: #ef4444;
  --mul-1: #38bdf8; --mul-2: #0891b2;
  --div-1: #818cf8; --div-2: #9333ea;
  --fra-1: #fde047; --fra-2: #f97316;
  --star: #ffc93c;
  --radius: 28px;
  --shadow: 0 18px 50px rgba(20, 30, 90, 0.18);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cloud);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--sky-2); }
h1, h2, h3 { line-height: 1.1; margin: 0 0 .4em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 6.2vw, 4.8rem); font-weight: 900; }
h2 { font-size: clamp(2rem, 4.2vw, 3.2rem); font-weight: 900; }
h3 { font-size: 1.3rem; font-weight: 800; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Sidhuvud ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(30, 50, 120, 0.08);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 1.25rem; }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 4px 12px rgba(40, 60, 160, .25); }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 700; }
.site-nav a:hover { color: var(--sky-2); }
.lang-switch { display: flex; gap: 4px; background: rgba(30, 50, 120, .08); border-radius: 999px; padding: 3px; }
.lang-switch a { padding: 4px 11px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-weight: 800; font-size: .85rem; }
.lang-switch a[aria-current="true"] { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--sky-1) 0%, var(--sky-2) 48%, var(--sky-3) 100%);
  padding: clamp(48px, 8vw, 96px) 0 clamp(90px, 10vw, 140px);
}
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; z-index: 2; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35);
  padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .95rem; margin-bottom: 18px;
}
.hero h1 .pop { display: inline-block; background: linear-gradient(90deg, #fff6a5, #ffd36e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1.15rem, 2vw, 1.4rem); max-width: 34em; opacity: .95; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font: inherit; font-weight: 900; font-size: 1.08rem; text-decoration: none; cursor: pointer;
  padding: 15px 24px; border-radius: 18px; border: 0;
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s;
}
.btn:hover { transform: translateY(-3px) scale(1.02); }
.btn:active { transform: scale(.97); }
.btn-primary { background: #fff; color: var(--sky-3); box-shadow: 0 10px 24px rgba(20, 20, 90, .25); }
.btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; border: 2px solid rgba(255, 255, 255, .55); }
.btn-store { background: #111; color: #fff; }
.btn-store small { display: block; font-size: .7rem; font-weight: 700; opacity: .8; line-height: 1; }
.btn-store span { line-height: 1.1; text-align: left; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; padding: 0; list-style: none; }
.badges li { background: rgba(255, 255, 255, .18); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: .9rem; }

/* Matheo i hero: tryck på honom så byter han kläder och säger något nytt */
.stage { position: relative; display: grid; place-items: center; min-height: 520px; }
.stage::before {
  content: ""; position: absolute; width: 78%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 68%);
  animation: pulse 4s ease-in-out infinite;
}
.matheo-button { position: relative; border: 0; background: none; padding: 0; cursor: pointer; width: min(360px, 78vw); }
.matheo-button img { width: 100%; filter: drop-shadow(0 22px 30px rgba(10, 20, 80, .35)); animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.matheo-button.hop img { animation: hop .55s cubic-bezier(.3, 1.6, .5, 1); }
.bubble {
  position: absolute; top: 4%; left: -6%; max-width: 250px;
  background: #fff; color: var(--ink); font-weight: 800; font-size: 1.05rem;
  padding: 14px 18px; border-radius: 22px; box-shadow: var(--shadow);
  transform-origin: 90% 100%;
  animation: bubble-in .45s cubic-bezier(.3, 1.6, .5, 1);
}
.bubble::after { content: ""; position: absolute; right: 26px; bottom: -12px; border: 12px solid transparent; border-top-color: #fff; border-bottom: 0; }
.tap-hint { position: absolute; bottom: 2%; font-weight: 800; font-size: .9rem; background: rgba(0, 0, 0, .2); padding: 6px 14px; border-radius: 999px; }

/* Flygande siffror och räknetecken, som i appens intro */
.floaters { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.floaters span {
  position: absolute; font-weight: 900; color: #fff; opacity: .26;
  text-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  animation: float var(--d, 14s) ease-in-out infinite; animation-delay: var(--delay, 0s);
}
.wave { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 3; line-height: 0; }
.wave svg { width: 100%; height: clamp(50px, 7vw, 100px); }

/* ---------- Avsnitt ---------- */
section { padding: clamp(64px, 9vw, 110px) 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.section-head p { font-size: 1.18rem; color: var(--ink-soft); }
.kicker { display: inline-block; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; color: var(--sky-3); margin-bottom: 10px; }

/* Räknesätten som i appens meny */
.ops { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.op {
  color: #fff; border-radius: 22px; padding: 18px 16px 16px; min-height: 132px;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 12px 26px rgba(30, 40, 100, .16);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.op:hover { transform: translateY(-6px) rotate(-1.5deg); }
.op b { font-size: 1.15rem; }
.op small { opacity: .9; font-weight: 700; }
.op i { font-style: normal; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .28); font-size: 1.5rem; font-weight: 900; }
.op-add { background: linear-gradient(135deg, var(--add-1), var(--add-2)); }
.op-sub { background: linear-gradient(135deg, var(--sub-1), var(--sub-2)); }
.op-mul { background: linear-gradient(135deg, var(--mul-1), var(--mul-2)); }
.op-div { background: linear-gradient(135deg, var(--div-1), var(--div-2)); }
.op-fra { background: linear-gradient(135deg, var(--fra-1), var(--fra-2)); }
.op-dec { background: linear-gradient(135deg, #22d3ee, #2563eb); }
.op-pct { background: linear-gradient(135deg, #f472b6, #e11d48); }
.op-clk { background: linear-gradient(135deg, #f59e0b, #b45309); }
.op-mon { background: linear-gradient(135deg, #22a35a, #c98d0c); }
.op-neg { background: linear-gradient(135deg, #a78bfa, #4f46e5); }

/* Prova själv */
.try {
  background: linear-gradient(160deg, #fff, #eef4ff);
}
.try-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center;
  background: #fff; border-radius: 36px; box-shadow: var(--shadow); padding: clamp(22px, 4vw, 44px);
}
.question {
  text-align: center; background: linear-gradient(135deg, #e0f2ff, #ede7ff);
  border-radius: 26px; padding: 26px 18px;
}
.question .math { font-size: clamp(3rem, 8vw, 4.6rem); font-weight: 900; letter-spacing: .02em; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.answers button {
  font: inherit; font-size: 1.7rem; font-weight: 900; color: #fff; border: 0; cursor: pointer;
  border-radius: 18px; padding: 16px 0;
  background: linear-gradient(135deg, var(--mul-1), var(--mul-2));
  box-shadow: 0 8px 18px rgba(8, 145, 178, .3);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), opacity .2s, filter .2s;
}
.answers button:hover { transform: translateY(-3px); }
.answers button.is-right { background: linear-gradient(135deg, var(--add-1), var(--add-2)); }
.answers button.is-wrong { background: linear-gradient(135deg, var(--sub-1), var(--sub-2)); }
.answers button:disabled { cursor: default; }
.answers button.is-dim { opacity: .35; filter: grayscale(.5); }
.explain { min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.explain .idle { color: var(--ink-soft); font-weight: 700; font-size: 1.1rem; }
.explain .idle img { width: 150px; margin: 0 auto 8px; }
.verdict { font-size: 1.8rem; font-weight: 900; display: flex; gap: 12px; align-items: center; justify-content: center; }
.verdict s { color: #ef4444; text-decoration-thickness: 3px; }
.verdict .ok { color: #16a34a; }
.dots { display: grid; gap: 5px; justify-content: center; }
.dots i { width: 22px; height: 22px; border-radius: 50%; background: var(--mul-1); transform: scale(0); animation: pop .4s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.dots i.second { background: var(--sub-1); }
.chips { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.chips span { font-weight: 900; font-size: 1.35rem; background: #e6f6ff; padding: 6px 16px; border-radius: 14px; opacity: 0; transform: translateY(8px); animation: rise .4s ease forwards; }
.again { font: inherit; font-weight: 800; background: none; border: 2px solid #d6def5; border-radius: 999px; padding: 8px 18px; cursor: pointer; color: var(--ink); }

/* Funktioner */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: #fff; border-radius: var(--radius); padding: 26px; box-shadow: 0 10px 30px rgba(30, 50, 120, .08);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s;
}
.feature:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.feature .emoji { font-size: 2.4rem; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--tint, #eef4ff); margin-bottom: 12px; }
.feature p { color: var(--ink-soft); margin: 0; }

/* Skärmbilder */
.gallery { background: var(--night); color: #fff; position: relative; overflow: hidden; }
.gallery .section-head p { color: rgba(255, 255, 255, .78); }
.gallery .kicker { color: #9fb6ff; }
.shots {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(560px, 84vw); gap: 22px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 20px 30px;
  scrollbar-width: thin;
}
.shots figure { margin: 0; scroll-snap-align: center; }
.shots img {
  border-radius: 26px; border: 8px solid #20295c; background: #20295c;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .45); aspect-ratio: 4 / 3; object-fit: cover;
}
.shots figcaption { text-align: center; font-weight: 800; margin-top: 12px; color: rgba(255, 255, 255, .9); }

/* Garderoben */
.wardrobe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; align-items: end; }
.wardrobe figure { margin: 0; text-align: center; }
.wardrobe img { margin: 0 auto; max-height: 300px; filter: drop-shadow(0 14px 18px rgba(30, 40, 100, .2)); transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.wardrobe figure:hover img { transform: translateY(-10px) rotate(-3deg); }
.wardrobe figcaption { font-weight: 800; color: var(--ink-soft); margin-top: 8px; }

/* Föräldrar och lärare */
.grownups { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.checks li { display: flex; gap: 14px; align-items: flex-start; background: #fff; border-radius: 20px; padding: 16px 18px; box-shadow: 0 8px 22px rgba(30, 50, 120, .07); }
.checks li b { display: block; }
.checks li span { color: var(--ink-soft); }
.checks .tick { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--add-1), var(--add-2)); color: #fff; font-weight: 900; }
.promise {
  background: linear-gradient(135deg, #ffe9a8, #ffc8a2); border-radius: 36px; padding: 34px; text-align: center; box-shadow: var(--shadow);
}
.promise img { width: 170px; margin: -80px auto 6px; }
.promise ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; font-weight: 900; font-size: 1.15rem; }

/* Frågor och svar */
.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: #fff; border-radius: 20px; padding: 18px 22px; box-shadow: 0 8px 22px rgba(30, 50, 120, .07); }
.faq summary { cursor: pointer; font-weight: 900; font-size: 1.12rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.5rem; line-height: 1; color: var(--sky-2); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 12px 0 0; color: var(--ink-soft); }

/* Avslutning */
.finale { text-align: center; background: linear-gradient(135deg, var(--sky-1), var(--sky-2) 50%, var(--sky-3)); color: #fff; position: relative; overflow: hidden; }
.finale img.skate { width: min(420px, 80vw); margin: 0 auto 10px; animation: roll 6s ease-in-out infinite; }
.finale .cta-row { justify-content: center; }

/* Sidfot */
.site-footer { background: #0c1233; color: rgba(255, 255, 255, .8); padding: 44px 0; font-size: .95rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
.site-footer a { color: #fff; text-decoration: none; font-weight: 700; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 18px; }

/* Juridiska sidor och support */
.doc { background: #fff; border-radius: 32px; box-shadow: var(--shadow); padding: clamp(24px, 5vw, 56px); margin: 40px auto 70px; max-width: 860px; }
.doc h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.doc h2 { font-size: 1.45rem; margin-top: 1.6em; }
.doc .updated { color: var(--ink-soft); font-weight: 700; }
.doc li { margin-bottom: .4em; }
.doc-hero { background: linear-gradient(135deg, var(--sky-1), var(--sky-2) 50%, var(--sky-3)); height: 120px; }

/* Snart: nya områden under rutorna på startsidan */
.ops-soon { text-align: center; margin: 22px auto 0; font-weight: 700; color: var(--ink-soft); max-width: 760px; }
.ops-soon .soon { margin-right: 6px; }

/* Sidan för skolan */
.doc-wide { max-width: 1040px; }
.doc .kicker { color: var(--sky-2); }
.doc .lead { font-size: 1.18rem; color: var(--ink-soft); }
.school-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0 8px; }
.school-facts div { background: var(--cloud); border-radius: 20px; padding: 16px 18px; }
.school-facts b { display: block; font-size: 1.35rem; color: var(--sky-3); }
.school-facts span { color: var(--ink-soft); font-weight: 700; font-size: .95rem; }
.table-scroll { overflow-x: auto; border-radius: 20px; box-shadow: 0 8px 22px rgba(30, 50, 120, .08); }
.lgr-table { width: 100%; border-collapse: collapse; min-width: 640px; background: #fff; }
.lgr-table th, .lgr-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid #e6ecf8; }
.lgr-table thead th { background: linear-gradient(135deg, var(--sky-2), var(--sky-3)); color: #fff; font-size: .95rem; }
.lgr-table tbody th { font-weight: 900; white-space: nowrap; }
.lgr-table td:nth-child(3) { font-weight: 900; white-space: nowrap; }
.lgr-table tbody tr:nth-child(even) { background: var(--cloud); }
.soon { display: inline-block; background: var(--star); color: #4a3400; font-size: .72rem; font-weight: 900; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.doc .note { color: var(--ink-soft); font-size: .95rem; }
.tips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tip { background: var(--cloud); border-radius: 22px; padding: 18px 20px; }
.tip b { font-size: 1.1rem; }
.tip p { margin: 6px 0 0; color: var(--ink-soft); }
@media (max-width: 760px) {
  .school-facts { grid-template-columns: repeat(2, 1fr); }
  .tips { grid-template-columns: 1fr; }
}

/* Inscrollning */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .9, .3, 1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* Konfetti när man svarar rätt i Prova själv */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(18px, -28px) rotate(12deg); }
  66% { transform: translate(-14px, 16px) rotate(-10deg); }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(-1.5deg); } }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-34px) rotate(-5deg) scale(1.03); } 100% { transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .6; } }
@keyframes bubble-in { from { transform: scale(.5) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { to { transform: scale(1); } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes roll { 0%, 100% { transform: translateX(-30px) rotate(-2deg); } 50% { transform: translateX(30px) rotate(2deg); } }

@media (max-width: 980px) {
  .hero .wrap, .try-card, .grownups { grid-template-columns: 1fr; }
  .stage { min-height: 440px; }
  .ops { grid-template-columns: repeat(2, 1fr); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .wardrobe { grid-template-columns: repeat(3, 1fr); }
  .promise { margin-top: 60px; }
}
@media (max-width: 640px) {
  .site-nav { display: none; }
  .lang-switch { margin-left: auto; }
  .features { grid-template-columns: 1fr; }
  .wardrobe { grid-template-columns: repeat(2, 1fr); }
  .bubble { left: 0; max-width: 200px; font-size: .95rem; }
  .explain { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .dots i, .chips span { transform: none; opacity: 1; }
}
