/* ==========================================================================
   Ryskole — central stylesheet
   Bruges af alle sider. Fag-css'er (fx matematik/css/matematik.css) bygger
   ovenpå denne fil og må gerne overskrive variabler, men aldrig fjerne dem.
   ========================================================================== */

:root {
  /* Site-farver */
  --color-bg: #f7f8fc;
  --color-surface: #ffffff;
  --color-text: #1c2130;
  --color-text-muted: #5b6272;
  --color-border: #e3e6ef;
  --color-primary: #4c5eff;
  --color-primary-dark: #3a47d1;
  --color-primary-contrast: #ffffff;

  /* Fag-farver (standardværdi — overskrives af det enkelte fags css) */
  --color-subject: var(--color-primary);
  --color-subject-dark: var(--color-primary-dark);
  --color-subject-light: #eef0ff;

  /* Status */
  --color-success: #1f9d55;
  --color-success-bg: #e9f9ef;
  --color-error: #d1453b;
  --color-error-bg: #fdecea;

  /* Typografi */
  --font-base: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-size-base: 1rem;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(28, 33, 48, 0.08);
  --shadow-md: 0 8px 24px rgba(28, 33, 48, 0.10);
  --max-width: 1080px;
  --sidebar-width: 250px;

  /* Genbrugt SVG-prikmønster til farvede bjælker (bane, footer) */
  --pattern-dots: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Ccircle cx='20' cy='24' r='3' fill='white' fill-opacity='0.35'/%3E%3Ccircle cx='78' cy='64' r='2' fill='white' fill-opacity='0.25'/%3E%3Ccircle cx='118' cy='18' r='2.6' fill='white' fill-opacity='0.3'/%3E%3Ccircle cx='50' cy='108' r='2' fill='white' fill-opacity='0.22'/%3E%3Ccircle cx='108' cy='104' r='3.6' fill='white' fill-opacity='0.28'/%3E%3Ccircle cx='6' cy='90' r='2.2' fill='white' fill-opacity='0.2'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #14161f;
    --color-surface: #1c1f2b;
    --color-text: #eef0f7;
    --color-text-muted: #a5abbd;
    --color-border: #2c3040;
    --color-subject-light: #232840;
    --color-success-bg: #10321f;
    --color-error-bg: #3a1815;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-subject-dark);
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 0.6em;
}

p {
  margin: 0 0 1em;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* -------------------------------------------------------------------- */
/* Venstre sidebar-menu                                                 */
/* -------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1.1rem;
  z-index: 40;
  overflow-y: auto;
  transition: transform 0.28s ease, opacity 0.22s ease;
}

html.sidebar-hidden .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.7rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-logo .logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  border: none;
  background: var(--color-bg);
  color: var(--color-text-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav-link:hover {
  background: var(--color-subject-light);
  color: var(--color-text);
}

.sidebar-nav-link.active {
  background: var(--color-subject);
  color: #fff;
}

.sidebar-nav .nav-icon {
  font-size: 1.15rem;
  width: 1.4rem;
  text-align: center;
}

/* Fag med udfoldelige underemner */
.sidebar-subject-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.sidebar-subject-row .sidebar-nav-link {
  flex: 1;
  min-width: 0;
}

.sidebar-expand-btn {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-expand-btn:hover {
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
}

.sidebar-expand-btn .chevron {
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.sidebar-subject.open .sidebar-expand-btn .chevron {
  transform: rotate(90deg);
}

.sidebar-subtopics {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
  margin-left: 1.3rem;
  border-left: 2px solid var(--color-border);
}

.sidebar-subject.open .sidebar-subtopics {
  grid-template-rows: 1fr;
}

.sidebar-subtopics-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.3rem 0 0.35rem 0.8rem;
}

.sidebar-subtopic-link {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-subtopic-link:hover {
  background: var(--color-subject-light);
  color: var(--color-text);
}

.sidebar-subtopic-link.active {
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
}

.sidebar-subtopic-soon {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  opacity: 0.55;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Flydende knap der viser menuen igen, når den er skjult */
.sidebar-open-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 45;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
}

html.sidebar-hidden .sidebar-open-btn {
  display: flex;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 28, 0.45);
  z-index: 39;
}

.main-wrap {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.28s ease;
}

html.sidebar-hidden .main-wrap {
  margin-left: 0;
}

main {
  flex: 1;
}

@media (max-width: 780px) {
  .main-wrap {
    margin-left: 0;
  }

  .sidebar {
    box-shadow: var(--shadow-md);
  }

  html:not(.sidebar-hidden) .sidebar-backdrop {
    display: block;
  }
}

/* -------------------------------------------------------------------- */
/* Hero / farvet bjælke i fagets temafarve                              */
/* -------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 3.1rem 0 3.5rem;
  background: linear-gradient(120deg, var(--color-subject) 0%, var(--color-subject-dark) 55%, var(--color-subject) 100%);
  color: #fff;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--pattern-dots);
  background-size: 140px 140px;
  opacity: 0.6;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.hero p.lead {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 60ch;
}

.hero--home {
  background: linear-gradient(120deg, #3457ff 0%, #1f9d55 50%, #d97a1f 100%);
}

.eyebrow {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}

/* -------------------------------------------------------------------- */
/* Cards / grids                                                        */
/* -------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

a.card:hover,
a.card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-subject);
}

.card .icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.card h3 {
  margin-bottom: 0.15rem;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.card .tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.card.coming-soon {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Fag-oversigtskort på forsiden */
.subject-card {
  --accent: var(--color-primary);
  border-top: 5px solid var(--accent);
}

.subject-card.subject-matematik { --accent: var(--color-mat, #3457ff); }
.subject-card.subject-biologi   { --accent: var(--color-bio, #1f9d55); }
.subject-card.subject-geografi  { --accent: var(--color-geo, #d97a1f); }

/* -------------------------------------------------------------------- */
/* Buttons                                                               */
/* -------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-subject);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-subject-dark);
}

.btn-secondary {
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -------------------------------------------------------------------- */
/* Lesson content                                                        */
/* -------------------------------------------------------------------- */

.lesson {
  padding: 0 0 4rem;
}

.lesson-header {
  padding: 1.4rem 0 2rem;
}

.lesson-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.lesson-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
}

.lesson-section h2 {
  font-size: 1.4rem;
}

.lesson-section h2 .emoji {
  margin-right: 0.4rem;
}

.info-box {
  background: var(--color-subject-light);
  border-left: 4px solid var(--color-subject);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

.info-box strong {
  color: var(--color-subject-dark);
}

/* -------------------------------------------------------------------- */
/* Quiz                                                                  */
/* -------------------------------------------------------------------- */

.quiz-question {
  margin-bottom: 1.6rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--color-border);
}

.quiz-question:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.quiz-question p.question-text {
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.quiz-options {
  display: grid;
  gap: 0.6rem;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quiz-option:hover {
  border-color: var(--color-subject);
}

.quiz-option input {
  accent-color: var(--color-subject);
}

.quiz-option.correct {
  border-color: var(--color-success);
  background: var(--color-success-bg);
}

.quiz-option.incorrect {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}

.quiz-feedback {
  margin-top: 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: none;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.quiz-feedback.partial {
  background: var(--color-subject-light);
  color: var(--color-subject-dark);
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.save-status {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* -------------------------------------------------------------------- */
/* Footer — farvet med samme mønster som bjælken                        */
/* -------------------------------------------------------------------- */

.site-footer {
  position: relative;
  overflow: hidden;
  padding: 1.8rem 0;
  background: linear-gradient(120deg, var(--color-subject-dark) 0%, var(--color-subject) 100%);
  color: rgba(255, 255, 255, 0.92);
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--pattern-dots);
  background-size: 110px 110px;
  opacity: 0.35;
}

.site-footer .container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.site-footer a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
}

.site-footer a:hover {
  text-decoration-color: #fff;
}

.site-footer--home {
  background: linear-gradient(120deg, #2540c9 0%, #17793f 50%, #a85c14 100%);
}

/* -------------------------------------------------------------------- */
/* Responsive                                                            */
/* -------------------------------------------------------------------- */

@media (max-width: 640px) {
  .hero {
    padding: 2.2rem 0 1.8rem;
  }
}
