/* =====================================================
   FysikkMedMartin.no  –  Globalt designsystem
   Basert på mattemedmartin.no sin stil
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-1:        #0d1b2a;
  --bg-2:        #11263a;
  --surface:     #15314a;
  --surface-2:   #1b3d5c;
  --border:      #234b6d;
  --border-soft: #1c3854;
  --blue:        #6aa9d6;
  --blue-soft:   #4f8db8;
  --teal:        #5fc4b8;
  --green:       #8ad29b;
  --amber:       #f5c971;
  --rose:        #e98ba2;
  --violet:      #a48cd9;
  --text:        #e7eef5;
  --text-muted:  #9bb1c5;
  --text-dim:    #6f8aa1;
  --shadow:      0 8px 24px rgba(0,0,0,.35);
  --radius:      14px;
  --radius-sm:   9px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-1);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
}

/* ─── HEADER ─────────────────────────────────────── */
.site-header {
  background: rgba(17, 38, 58, 0.95);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-title { font-size: 15px; font-weight: 700; color: var(--text); }
.logo-sub   { font-size: 11px; color: var(--text-muted); }

.nav-main {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav-main::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active {
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  color: var(--bg-1);
  font-weight: 600;
  border-color: var(--teal);
  box-shadow: 0 2px 12px rgba(95,196,184,0.25);
}
.nav-num { opacity: 0.65; font-size: 11px; }

.nav-om {
  margin-left: auto;
  padding: 6px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  flex-shrink: 0;
  transition: 0.15s;
}
.nav-om:hover { color: var(--text); }

/* ─── MAIN WRAPPER ───────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 90px;
}

/* ─── HERO (index) ───────────────────────────────── */
.hero {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 30px;
  align-items: center;
}

.hero-img {
  width: 180px;
  height: 180px;
  background: var(--surface-2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  flex-shrink: 0;
}

.hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.hero p  { color: var(--text-muted); font-size: 14.5px; line-height: 1.7; }
.hero p + p { margin-top: 8px; }

/* ─── TOPIC GRID (index) ─────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  transition: 0.2s;
  display: block;
  cursor: pointer;
}
.topic-card:hover {
  background: var(--surface-2);
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.topic-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 13px;
  color: var(--teal);
  margin-bottom: 10px;
  border: 1px solid var(--border-soft);
}
.topic-card h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.topic-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ─── PAGE HERO ──────────────────────────────────── */
.page-hero { margin-bottom: 28px; }
.page-hero h1 { font-size: 26px; font-weight: 700; margin-bottom: 7px; }
.page-hero p  { color: var(--text-muted); font-size: 14.5px; }

/* ─── SECTION CARD ───────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── FORMULA TABLE ──────────────────────────────── */
.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.formula-table thead th {
  background: var(--surface-2);
  color: var(--blue);
  padding: 9px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.formula-table tbody tr { border-bottom: 1px solid var(--border-soft); }
.formula-table tbody tr:last-child { border-bottom: none; }
.formula-table tbody td { padding: 11px 14px; vertical-align: middle; }
.formula-table tbody tr:hover td { background: rgba(95,196,184,0.05); }

.f-math {
  font-size: 15px;
  color: var(--amber);
  font-style: italic;
  font-weight: 600;
}
.f-name  { color: var(--text); font-weight: 500; }
.f-desc  { color: var(--text-muted); font-size: 13px; }
.f-unit  {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
}

/* ─── EXAMPLE BOX ────────────────────────────────── */
.example-box {
  border-left: 3px solid var(--teal);
  background: rgba(95,196,184,0.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin-top: 16px;
}
.example-badge {
  display: inline-block;
  background: var(--teal);
  color: var(--bg-1);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.example-box p {
  font-size: 14px;
  color: var(--text);
  margin-top: 6px;
}

/* ─── TRINN-FOR-TRINN ────────────────────────────── */
.steps { margin-top: 18px; }
.step  { display: flex; gap: 14px; margin-bottom: 14px; align-items: flex-start; }
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--bg-1);
  margin-top: 1px;
}
.step-body p    { font-size: 14px; color: var(--text); line-height: 1.6; }
.step-formula   {
  display: inline-block;
  margin-top: 6px;
  padding: 7px 14px;
  background: rgba(245,201,113,0.1);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--amber);
  font-style: italic;
  font-weight: 600;
}
.step-result    {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  background: rgba(95,196,184,0.12);
  border: 1px solid rgba(95,196,184,0.3);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--teal);
  font-weight: 700;
}

/* ─── FLIP CARDS ─────────────────────────────────── */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}
.flip-card          { height: 145px; perspective: 1000px; cursor: pointer; }
.flip-card-inner    {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  text-align: center;
  border: 1px solid var(--border-soft);
}
.flip-card-front { background: var(--surface-2); }
.flip-card-back  {
  background: linear-gradient(135deg, rgba(95,196,184,0.13), rgba(106,169,214,0.13));
  border-color: var(--teal);
  transform: rotateY(180deg);
}
.flip-title  { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.flip-hint   { font-size: 11px; color: var(--text-dim); }
.flip-def    { font-size: 12.5px; color: var(--text); line-height: 1.5; }
.flip-f      { margin-top: 7px; font-size: 15px; color: var(--amber); font-style: italic; font-weight: 600; }

/* ─── CALCULATOR ─────────────────────────────────── */
.calc-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-top: 18px;
}
.calc-title { font-size: 14.5px; font-weight: 600; color: var(--blue); margin-bottom: 14px; }
.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.calc-field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}
.calc-field input, .calc-field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: 0.15s;
}
.calc-field input:focus, .calc-field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(95,196,184,0.18);
}
.calc-field select option { background: var(--surface); }

.calc-btn {
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  color: var(--bg-1);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.calc-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.calc-result {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(95,196,184,0.1);
  border: 1px solid rgba(95,196,184,0.3);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--teal);
  font-weight: 600;
  display: none;
}
.calc-result.show { display: block; }
.calc-result span { color: var(--text-muted); font-weight: 400; font-size: 13px; display: block; margin-top: 3px; }

/* ─── INFO TIP ───────────────────────────────────── */
.info-tip {
  background: rgba(106,169,214,0.1);
  border: 1px solid rgba(106,169,214,0.25);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13.5px;
  color: var(--blue);
  margin-top: 14px;
  line-height: 1.55;
}

/* ─── QUIZ ───────────────────────────────────────── */
.quiz-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.quiz-tab {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.quiz-tab:hover:not(.active) { color: var(--text); background: var(--surface-2); }
.quiz-tab.active {
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  color: var(--bg-1);
  border-color: var(--teal);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(95,196,184,0.25);
}

.quiz-meta { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

.quiz-question-box {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 12px;
}
.quiz-q-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }

.quiz-option {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
  line-height: 1.5;
}
.quiz-option:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.quiz-option.correct { background: rgba(138,210,155,0.15); border-color: var(--green); color: var(--green); font-weight: 600; }
.quiz-option.wrong   { background: rgba(233,139,162,0.15); border-color: var(--rose);  color: var(--rose);  }
.quiz-option:disabled { cursor: not-allowed; }

.quiz-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: none;
  line-height: 1.55;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb { background: rgba(138,210,155,0.1); border: 1px solid rgba(138,210,155,0.3); color: var(--green); }
.quiz-feedback.wrong-fb   { background: rgba(233,139,162,0.1); border: 1px solid rgba(233,139,162,0.3); color: var(--rose); }

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  gap: 12px;
}
.quiz-nav-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 22px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.quiz-nav-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--border); }
.quiz-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.quiz-score-box {
  text-align: center;
  padding: 36px 24px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.quiz-score-box h3 { font-size: 26px; font-weight: 700; color: var(--teal); margin-bottom: 10px; }
.quiz-score-box p  { color: var(--text-muted); margin-bottom: 18px; font-size: 15px; }
.quiz-emoji        { font-size: 48px; display: block; margin-bottom: 12px; }

.quiz-restart-btn {
  background: linear-gradient(135deg, var(--blue-soft), var(--teal));
  color: var(--bg-1);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 28px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}
.quiz-restart-btn:hover { opacity: 0.9; }

/* ─── FOOTER ─────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-dim);
  font-size: 13px;
  border-top: 1px solid var(--border-soft);
  margin-top: 30px;
}
.site-footer a { color: var(--teal); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ─── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 700px) {
  .hero                 { grid-template-columns: 1fr; text-align: center; padding: 24px 20px; }
  .hero-img             { width: 120px; height: 120px; margin: 0 auto; font-size: 50px; }
  .topic-grid           { grid-template-columns: 1fr 1fr; }
  .flip-grid            { grid-template-columns: 1fr 1fr; }
  .calc-inputs          { grid-template-columns: 1fr; }
  .header-inner         { padding: 10px 14px; gap: 8px; }
  .main                 { padding: 24px 14px 70px; }
  .section-card         { padding: 18px 16px; }
  .quiz-tabs            { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .topic-grid           { grid-template-columns: 1fr; }
  .flip-grid            { grid-template-columns: 1fr; }
  .flip-card            { height: 120px; }
}
