:root {
  --ink: #1b1f2a;
  --muted: #5b6475;
  --line: #e3e6ec;
  --bg: #fbfaf7;
  --accent: #1f4fd1;
  --accent-soft: #eaf0ff;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); }
a { color: var(--accent); }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: rgba(251,250,247,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 20px var(--serif); color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--accent); }
.who { color: var(--muted); font-size: 14px; }
.logout { font-size: 15px; text-decoration: none; }
.toc-toggle { display: none; }

/* Landing */
.hero { max-width: 760px; margin: 0 auto; padding: 96px 24px 56px; text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; color: var(--accent); font-weight: 600; }
.hero h1 { font: 600 clamp(32px, 5vw, 50px)/1.15 var(--serif); margin: 12px 0 20px; }
.lead { font-size: 20px; color: var(--muted); margin: 0 auto 36px; max-width: 600px; }
.buy {
  font: 600 18px var(--sans); color: #fff; background: var(--accent); border: 0;
  border-radius: 10px; padding: 16px 32px; cursor: pointer; transition: transform .1s, box-shadow .2s;
  box-shadow: 0 6px 20px rgba(31,79,209,.25);
}
.buy:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(31,79,209,.32); }
.buy[disabled] { opacity: .7; cursor: wait; transform: none; box-shadow: none; }
.small { font-size: 14px; color: var(--muted); }
.parts {
  max-width: 980px; margin: 0 auto; padding: 24px; display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.parts div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.parts h3 { font: 700 22px var(--serif); margin: 0 0 6px; color: var(--accent); }
.parts p { margin: 0; color: var(--muted); font-size: 15px; }
.cta-bottom { text-align: center; padding: 40px 24px 80px; color: var(--muted); }

.card { max-width: 440px; margin: 80px auto; padding: 36px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.card h1 { font: 600 30px var(--serif); margin: 0 0 8px; }
.card input {
  width: 100%; font: 17px var(--sans); padding: 14px; margin: 12px 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
}
.card .buy { width: 100%; }
.notice { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 14px 18px; border-radius: 8px; }
.notice.error { background: #fff1ef; border-color: #c8412c; }

/* Reader */
.layout { display: grid; grid-template-columns: 290px 1fr; max-width: 1240px; margin: 0 auto; }
.toc {
  position: sticky; top: 61px; height: calc(100vh - 61px); overflow-y: auto;
  padding: 28px 16px 40px 24px; border-right: 1px solid var(--line); font-size: 14px;
}
.toc a { display: block; text-decoration: none; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.toc a:hover { background: var(--accent-soft); color: var(--accent); }
.toc .toc-2 { color: var(--ink); font-weight: 600; margin-top: 14px; }
.toc .toc-3 { padding-left: 18px; }
.guide { max-width: 760px; padding: 40px 48px 120px; min-width: 0; }
.guide h1 { font: 600 42px/1.15 var(--serif); margin: 0 0 32px; }
.guide h2 { font: 600 32px/1.2 var(--serif); margin: 72px 0 16px; padding-top: 24px; border-top: 2px solid var(--ink); }
.guide h3 { font: 600 24px/1.3 var(--serif); margin: 48px 0 12px; }
.guide h4 { font: 600 18px var(--sans); margin: 28px 0 8px; }
.guide hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
.guide li p { margin: 4px 0; }
.guide table { border-collapse: collapse; width: 100%; margin: 20px 0; font-size: 15px; display: block; overflow-x: auto; }
.guide th, .guide td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.guide th { background: #f1f3f7; }
.guide pre { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; font-size: 14px; line-height: 1.4; }
.guide code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.guide figure { margin: 24px 0; }
.guide figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.guide .notice { margin-bottom: 32px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .toc {
    position: fixed; inset: 61px 0 0 0; height: auto; background: var(--bg); z-index: 9;
    transform: translateX(-100%); transition: transform .2s; border: 0;
  }
  .toc-open .toc { transform: none; }
  .toc-toggle {
    display: inline-block; font: 15px var(--sans); background: none;
    border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer;
  }
  .who { display: none; }
  .guide { padding: 24px 20px 100px; }
  .guide h1 { font-size: 32px; }
}
@media print {
  .topbar, .toc { display: none; }
  .layout { display: block; }
  .guide { max-width: none; padding: 0; }
}
.guide > h2:first-of-type { margin-top: 24px; }
.topbar form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; font: 15px var(--sans); color: var(--accent); cursor: pointer; }
.hero .notice { max-width: 480px; margin: 20px auto 0; text-align: left; }
.toc .toc-portal { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .topbar form { display: none; } }
.card label { display: block; font-size: 14px; font-weight: 600; margin-top: 4px; }
.card input { margin: 6px 0 14px; }
.card input:disabled { background: #f1f3f7; color: var(--muted); }
.card .buy { margin-top: 6px; }
/* Formulas */
.guide .math-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px 40px; margin: 20px 0; padding: 14px 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
}
.guide .math-part { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.guide .math-part .katex-display { margin: 6px 0; }
.guide .katex { font-size: 1.12em; }
@media (max-width: 860px) { .guide .katex { font-size: 1em; } .guide .math-row { gap: 2px 24px; padding: 10px 12px; } }

/* Links between the guide and the practice tests (logged-in pages) */
.toplink { font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: none; }
.toplink:hover, .toplink.active { color: var(--accent); }
.hero .trylink { display: inline-block; margin-top: 18px; font-size: 17px; font-weight: 600; text-decoration: none; }
.logout, .toplink { white-space: nowrap; }
@media (max-width: 480px) { .topbar { gap: 12px; padding: 12px 16px; } .toplink.active { display: none; } }
.toc-logout { display: none; }
@media (max-width: 480px) { .reader .topbar .logout { display: none; } .toc .toc-logout { display: block; margin-top: 16px; font-weight: 600; } }

/* Smakprov on the landing page */
.sample { max-width: 1100px; margin: 0 auto; padding: 24px 24px 40px; }
.sample h2 { font: 600 30px/1.2 var(--serif); margin: 0 0 8px; text-align: center; }
.sample > .small { max-width: 620px; margin: 0 auto 22px; text-align: center; }
.samples { display: flex; gap: 16px; overflow-x: auto; align-items: flex-start; padding: 4px 4px 16px; scroll-snap-type: x mandatory; }
.samples figure { flex: 0 0 240px; margin: 0; scroll-snap-align: start; }
.samples img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 16px rgba(27,31,42,.08); background: #fff; }
.samples figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
@media (min-width: 900px) { .samples { overflow: visible; } .samples figure { flex: 1 1 0; min-width: 0; } }
.parts .wide { grid-column: 1 / -1; }

/* Reviews */
.reviews { max-width: 980px; margin: 0 auto; padding: 24px 24px 8px; }
.reviews h2 { font: 600 30px/1.2 var(--serif); margin: 0 0 18px; text-align: center; }
.revlist { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.review { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.review p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--ink); }
.review footer { margin-top: 10px; font-size: 14px; color: var(--muted); }
.trybtn { font: 600 15px var(--sans); color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 7px 14px; text-decoration: none; white-space: nowrap; }
.trybtn:hover { background: var(--accent); color: #fff; }
@media (max-width: 480px) { .trybtn .lg { display: none; } }

/* Homepage: includes line, FAQ, closing CTA, footer */
.hero .includes { font-weight: 600; color: var(--ink); margin: 0 0 22px; }
.faq { max-width: 760px; margin: 0 auto; padding: 40px 24px 8px; }
.faq h2, .closing h2 { font: 600 30px/1.2 var(--serif); margin: 0 0 18px; text-align: center; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 16px 0; list-style-position: inside; }
.faq details p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; }
.closing { max-width: 560px; margin: 40px auto 0; padding: 36px 24px 56px; text-align: center; }
.closing ul { list-style: none; padding: 0; margin: 0 0 24px; display: inline-block; text-align: left; }
.closing li { padding: 4px 0 4px 28px; position: relative; }
.closing li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.sitefoot { border-top: 1px solid var(--line); padding: 28px 24px 40px; display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: space-between; max-width: 1100px; margin: 0 auto; }
.sitefoot nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.sitefoot nav a { text-decoration: none; color: var(--muted); font-size: 15px; }
.sitefoot nav span { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; user-select: all; }
.sitefoot nav a:hover { color: var(--accent); }
.about { max-width: 680px; margin: 48px auto 0; padding: 32px 28px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.about h2 { font: 600 28px/1.2 var(--serif); margin: 0 0 14px; }
.about p { margin: 0 0 12px; line-height: 1.65; }
.fbbtn { display: inline-block; margin-top: 6px; font-weight: 600; text-decoration: none; background: var(--accent-soft); color: var(--accent); padding: 10px 18px; border-radius: 99px; }
.fbbtn:hover { background: var(--accent); color: #fff; }
@media (max-width: 720px) { .about { margin: 40px 16px 0; padding: 24px 20px; } }

/* Terms and privacy pages */
.legal { max-width: 720px; margin: 0 auto; padding: 56px 24px 48px; }
.legal h1 { font: 600 clamp(30px, 5vw, 40px)/1.15 var(--serif); margin: 0 0 6px; }
.legal h2 { font: 600 21px/1.3 var(--sans); margin: 32px 0 8px; }
.legal p, .legal li { line-height: 1.65; }
.legal table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 15px; }
.legal th, .legal td { text-align: left; vertical-align: top; border: 1px solid var(--line); padding: 10px 12px; }
.legal th { background: #f1f3f8; }
@media (max-width: 560px) { .legal table { font-size: 14px; } .legal th, .legal td { padding: 8px; } }
.legal table { table-layout: fixed; } .legal td, .legal th, .sitefoot nav a { overflow-wrap: anywhere; }

/* Abonnemang */
a.buy { display: inline-block; text-decoration: none; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0 18px; text-align: center; }
.plan { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px 20px 22px; display: flex; flex-direction: column; }
.plan h3 { font: 700 20px var(--serif); margin: 0 0 6px; }
.plan-price { font: 600 26px var(--sans); color: var(--accent); margin: 0 0 8px; }
.plan-note { font-size: 15px; color: var(--muted); margin: 0 0 18px; flex: 1; }
.plan .buy { width: 100%; padding: 14px 16px; font-size: 17px; }
.plan.best { border: 2px solid var(--accent); box-shadow: 0 10px 30px rgba(31,79,209,.12); }
.badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; gap: 22px; } }
.closing:has(.plans) { max-width: 980px; }
