/* IAS-kursen — delad stylesheet (teach-format, Tufte-inspirerad) */

:root {
  --paper: #f6f4ef;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #64748b;
  --brand: #0e4d64;
  --brand-dark: #0a3849;
  --brand-soft: #e3eef2;
  --accent: #b45309;
  --line: #dde5e9;
  --ok: #15803d;
  --ok-soft: #ecfdf5;
  --err: #b91c1c;
  --err-soft: #fef2f2;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

/* ---------- Sidhuvud ---------- */

.site-header {
  background: var(--brand);
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

.site-header .bar {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand span {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0.85;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.site-nav { display: flex; flex-wrap: wrap; gap: 0.15rem 1.1rem; }

.site-nav a {
  color: #d9e6ec;
  text-decoration: none;
  font-size: 0.92rem;
}

.site-nav a:hover { color: #fff; text-decoration: underline; }

/* ---------- Huvudinnehåll ---------- */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumbs a { color: var(--brand); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.lesson-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.lesson-count {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #c9dde5;
  border-radius: 999px;
  padding: 0.14rem 0.7rem;
}

article h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  line-height: 1.25;
  margin: 0 0 1rem;
  color: var(--brand-dark);
}

article h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  color: var(--brand-dark);
  margin: 2.2rem 0 0.7rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

article h3 {
  font-size: 1.12rem;
  margin: 1.6rem 0 0.5rem;
  color: var(--ink);
}

article p { margin: 0.8rem 0; }

article a { color: var(--brand); }

article ul, article ol { padding-left: 1.4rem; }
article li { margin: 0.35rem 0; }

article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

article blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: #fbf7f0;
  color: #57534e;
}

article code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: #eef2f4;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

article pre {
  background: #f0f4f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

article pre code { background: none; padding: 0; }

/* ---------- Tabeller ---------- */

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}

article th {
  text-align: left;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid #c9dde5;
  padding: 0.5rem 0.7rem;
}

article td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  vertical-align: top;
}

article tbody tr:nth-child(even) td { background: #fbfcfd; }

/* ---------- Quiz ---------- */

.quiz {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.25rem 1.3rem;
  margin: 1.6rem 0;
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.quiz-score {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.quiz-reset {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 0.2rem 0.8rem;
  cursor: pointer;
}

.quiz-reset:hover { color: var(--ink); border-color: var(--muted); }

.quiz-q { margin: 1.1rem 0 1.4rem; }

.quiz-question {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
}

.quiz-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.quiz-opt:hover { border-color: var(--brand); background: #f6fafb; }

.quiz-q.answered .quiz-opt { cursor: default; }
.quiz-q.answered .quiz-opt:hover { border-color: var(--line); background: #fff; }

.quiz-key {
  display: inline-block;
  min-width: 1.7em;
  font-weight: 700;
  color: var(--brand);
}

.quiz-opt.correct {
  background: var(--ok-soft);
  border-color: var(--ok);
  box-shadow: inset 3px 0 0 var(--ok);
}

.quiz-opt.correct .quiz-key { color: var(--ok); }

.quiz-opt.incorrect {
  background: var(--err-soft);
  border-color: var(--err);
  box-shadow: inset 3px 0 0 var(--err);
}

.quiz-opt.incorrect .quiz-key { color: var(--err); }

.quiz-feedback {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.quiz-feedback.fb-ok { color: var(--ok); }
.quiz-feedback.fb-err { color: var(--err); }

.quiz-expl {
  margin: 0.6rem 0 0;
  font-size: 0.92rem;
  background: #f4f7f8;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: 0.6rem 0.85rem;
}

.quiz-expl p { margin: 0.35rem 0; }
.quiz-expl p:first-child { margin-top: 0; }
.quiz-expl p:last-child { margin-bottom: 0; }

/* ---------- Fasit/details ---------- */

article details {
  background: #fffdf6;
  border: 1px solid #eaddbb;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin: 1.2rem 0;
}

article details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Podd ---------- */

.podd-card {
  background: linear-gradient(135deg, #0a3849 0%, #0e4d64 60%, #14708c 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.6rem 1.7rem 1.7rem;
  margin: 1.4rem 0;
  box-shadow: 0 10px 24px rgba(10, 56, 73, 0.25);
}

.podd-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffd9b0;
  margin: 0 0 0.4rem;
}

.podd-card h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
  border: 0;
  padding: 0;
  color: #fff;
}

.podd-card p { color: #d9e6ec; margin: 0 0 1rem; }

.podd-card audio {
  width: 100%;
  accent-color: #ffb46b;
  margin: 0.4rem 0 0.8rem;
}

.podd-meta {
  font-size: 0.85rem;
  color: #a8c5d1;
  margin: 0 0 1.1rem;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1.15rem;
  cursor: pointer;
}

.btn:hover { background: #93440b; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- Hero & index ---------- */

.hero { padding: 1rem 0 0.5rem; }

.hero .kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.2;
  margin: 0 0 0.8rem;
  color: var(--brand-dark);
}

.hero .lede { font-size: 1.08rem; color: #374151; max-width: 40rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.2rem; }

.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }

.index-section { margin: 2.6rem 0 0; }

.index-section > h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  color: var(--brand-dark);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
  margin: 0 0 1rem;
}

.index-section > .section-sub { color: var(--muted); font-size: 0.95rem; margin: -0.4rem 0 1rem; }

.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }

.lesson-list li a {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--ink);
}

.lesson-list li a:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(14, 77, 100, 0.08); }

.lesson-num {
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
}

.lesson-list .l-title { font-weight: 600; flex: 1 1 auto; }

.lesson-list .l-meta { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.done-dot {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: #fff;
}

.done-dot.is-done { background: var(--ok); border-color: var(--ok); }
.done-dot.is-done::after { content: "\2713"; font-weight: 700; }

.ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.ref-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--ink);
}

.ref-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(14, 77, 100, 0.08); }

.ref-card .r-title { display: block; font-weight: 700; color: var(--brand-dark); }

.ref-card .r-desc { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 0.2rem; }

.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
}

.info-card p:first-child { margin-top: 0; }
.info-card p:last-child { margin-bottom: 0; }

.steps { counter-reset: steg; list-style: none; margin: 0; padding: 0; }

.steps li {
  counter-increment: steg;
  position: relative;
  padding: 0 0 0.9rem 2.6rem;
}

.steps li::before {
  content: counter(steg);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 50%;
}

.quick-guide { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.quick-guide li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}

/* ---------- Klar-knapp, sidnavigering, sidfot ---------- */

.done-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
}

.done-btn:hover { border-color: var(--ok); color: var(--ok); }

.done-btn.is-done {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
}

.pager a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  max-width: 46%;
}

.pager a:hover { text-decoration: underline; }

.pager .next { margin-left: auto; text-align: right; }

.pager .dir { display: block; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--line);
  background: #efece5;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer .bar {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.2rem 1.25rem 1.6rem;
  text-align: center;
}

.site-footer p { margin: 0.3rem 0; }

.site-footer .credit { font-size: 0.78rem; opacity: 0.85; }

.site-footer .credit a { color: inherit; text-decoration: underline; }

.site-footer .credit a:hover { color: var(--brand); }

:focus-visible { outline: 3px solid #14708c; outline-offset: 2px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .ref-grid { grid-template-columns: 1fr; }
  .lesson-list li a { flex-wrap: wrap; }
  .lesson-list .l-meta { margin-left: 3.2rem; }
}

/* ---------- Utskrift ---------- */

@media print {
  .site-header, .site-footer, .breadcrumbs, .pager, .lesson-meta,
  .done-btn, .quiz-reset, .btn, .hero-actions { display: none !important; }

  body { background: #fff; font-size: 11.5pt; }
  main { max-width: none; padding: 0; }

  .quiz { border: 1px solid #999; break-inside: avoid-page; }
  .quiz-expl { display: block !important; }
  article a { color: inherit; text-decoration: none; }
}
