/* Dad's Geography — shared stylesheet
   Brand: cream #f8f1e7, earth greens & browns, DM Sans.
   Mobile-first, with a real desktop layout (the old app's missing piece). */

:root {
  --cream: #f8f1e7;
  --cream2: #fdf9f2;
  --ink: #3d2f1e;
  --brown: #7a5c3a;
  --olive: #6b7a3f;
  --green: #4a7c3f;
  --line: #e6dbc8;
  --star: #e3a72f;
  --ok: #4a7c3f;
  --bad: #c0522f;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green); }

/* ---------- header / footer ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1.5px solid var(--line);
  background: var(--cream2);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 18px; text-decoration: none; color: var(--ink); }
.brand-emoji { margin-right: 4px; }
.top-link { font-weight: 600; font-size: 14px; text-decoration: none; }

.crumbs {
  max-width: 980px; margin: 0 auto; padding: 12px clamp(16px, 4vw, 40px) 0;
  font-size: 13px; color: var(--brown);
}
.crumbs a { color: var(--brown); }
.crumbs .sep { margin: 0 7px; color: var(--line); }

main { max-width: 980px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; }

.foot { border-top: 1.5px solid var(--line); margin-top: 40px; padding: 26px clamp(16px, 4vw, 40px); text-align: center; background: var(--cream2); }
.foot-small { font-size: 12.5px; color: var(--brown); margin-top: 4px; }

/* ---------- homepage hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(180px, 300px) 1fr;
  gap: clamp(20px, 5vw, 56px); align-items: center; padding: clamp(24px, 5vw, 56px) 0;
}
.mascot { border-radius: 18px; }
.hero h1 { display: flex; flex-direction: column; line-height: 1.12; margin-bottom: 14px; }
.hero .l1 { color: var(--green); font-size: clamp(30px, 5vw, 44px); font-weight: 800; }
.hero .l2 { color: var(--olive); font-size: clamp(26px, 4.2vw, 38px); font-weight: 700; }
.hero .l3 { color: var(--brown); font-size: clamp(34px, 5.6vw, 50px); font-weight: 800; }
.hero-sub { color: var(--brown); font-size: clamp(15px, 1.8vw, 17px); max-width: 46ch; margin-bottom: 20px; }
.cta {
  display: inline-block; background: var(--green); color: #fff; text-decoration: none;
  font-weight: 700; padding: 12px 22px; border-radius: 99px; font-size: 16px;
}
.cta:hover { background: #3d6a33; }
.hero-progress { margin-top: 14px; font-size: 14px; color: var(--brown); font-weight: 600; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .mascot { margin: 0 auto; max-width: 220px; }
  .hero-sub { margin: 0 auto 20px; }
}

/* ---------- unit grid (home) ---------- */
.units-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; padding-bottom: 10px; }
.unit-card {
  display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--ink);
  background: var(--cream2); border: 1.5px solid var(--line); border-left: 5px solid var(--uc, var(--green));
  border-radius: var(--radius); padding: 16px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.unit-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(61,47,30,.08); }
.unit-emoji { font-size: 30px; }
.unit-meta h3 { font-size: 15.5px; font-weight: 800; }
.unit-meta p { font-size: 13px; color: var(--brown); margin: 2px 0 10px; }
.unit-progress { display: flex; align-items: center; gap: 10px; }
.unit-progress .bar { flex: 1; height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.unit-progress .fill { height: 100%; width: 0; background: var(--uc, var(--green)); border-radius: 99px; transition: width .4s ease; }
.unit-progress .count { font-size: 12px; font-weight: 700; color: var(--brown); }

/* ---------- unit page ---------- */
.unit-hero { text-align: center; padding: clamp(24px, 5vw, 44px) 0 18px; }
.unit-hero-emoji { font-size: 44px; }
.unit-hero h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 800; margin: 6px 0 4px; }
.unit-hero p { color: var(--brown); }
.lesson-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.lesson-row {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--cream2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.lesson-row:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(61,47,30,.07); }
.lesson-row .le { font-size: 26px; }
.lesson-row .lt { display: flex; flex-direction: column; }
.lesson-row .lt strong { font-size: 15px; }
.lesson-row .lt em { font-size: 12.5px; color: var(--brown); font-style: normal; }
.lesson-row .stars { margin-left: auto; color: var(--star); font-size: 17px; letter-spacing: 2px; white-space: nowrap; }
.unit-nav, .lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; font-weight: 700; font-size: 14px; }
.lesson-nav .up { color: var(--brown); }
.lesson-nav a { max-width: 40%; }

/* ---------- lesson page ---------- */
.lesson-hero { padding: clamp(22px, 4vw, 40px) 0 6px; border-bottom: 1.5px solid var(--line); margin-bottom: 22px; }
.eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--uc, var(--green)); }
.lesson-hero h1 { font-size: clamp(24px, 4.4vw, 36px); font-weight: 800; margin: 6px 0 4px; }
.lesson-sub { color: var(--brown); font-size: 15.5px; padding-bottom: 16px; }

.learn h2, .quiz h2, .watch h2, .signup h2 { font-size: 20px; font-weight: 800; margin: 26px 0 12px; }

/* Cards: single column on phones, 2-up on desktop — the desktop fix */
.learn { display: grid; grid-template-columns: 1fr; gap: 12px; }
.learn h2 { grid-column: 1 / -1; margin-bottom: 0; }
@media (min-width: 760px) { .learn { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--cream2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.card-emoji { font-size: 22px; }
.card h3 { font-size: 15.5px; font-weight: 800; }
.card p { font-size: 14.5px; color: #4d3d28; }

/* ---------- video ---------- */
.video-frame { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; border: 1.5px solid var(--line); background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- quiz ---------- */
.quiz-intro { color: var(--brown); font-size: 14px; margin-bottom: 14px; }
.q-block { background: var(--cream2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.q-block h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.q-opts { display: grid; gap: 8px; }
@media (min-width: 640px) { .q-opts { grid-template-columns: 1fr 1fr; } }
.q-opt {
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink);
}
.q-opt:hover:not(:disabled) { border-color: var(--brown); }
.q-opt:disabled { cursor: default; opacity: .85; }
.q-opt.correct { background: #e6efe0; border-color: var(--ok); font-weight: 700; }
.q-opt.wrong { background: #f6e3dc; border-color: var(--bad); }
.quiz-result {
  background: var(--cream2); border: 2px solid var(--star); border-radius: var(--radius);
  padding: 20px; text-align: center; margin-top: 16px;
}
.quiz-result .big-stars { font-size: 34px; color: var(--star); letter-spacing: 6px; }
.quiz-result p { margin-top: 6px; font-weight: 600; }
.retry {
  margin-top: 12px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--green); color: #fff; border: 0; border-radius: 99px; padding: 10px 20px;
}

/* ---------- email signup ---------- */
.signup {
  margin-top: 30px; background: var(--cream2); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 20px; text-align: center;
}
.signup p { color: var(--brown); font-size: 14px; margin-bottom: 12px; }
.signup-placeholder {
  border: 2px dashed var(--line); border-radius: 10px; padding: 14px;
  color: var(--brown); font-size: 13.5px; font-style: italic;
}

/* ---------- misc ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- family profiles ---------- */
.top-right { display: flex; align-items: center; gap: 14px; }
.fam-chip {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 99px;
  padding: 7px 14px; color: var(--ink); white-space: nowrap; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}
.fam-chip:hover { border-color: var(--brown); }
.fam-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(61,47,30,.45);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.fam-panel {
  background: var(--cream2); border: 1.5px solid var(--line); border-radius: 16px;
  width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; padding: 22px;
}
.fam-panel h3 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.fam-panel p { font-size: 13.5px; color: var(--brown); margin-bottom: 12px; }
.fam-panel label { display: block; font-size: 12.5px; font-weight: 700; color: var(--brown); margin: 10px 0 4px; }
.fam-panel input {
  width: 100%; font: inherit; font-size: 15px; padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--cream); color: var(--ink);
}
.fam-panel input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.fam-primary {
  width: 100%; margin-top: 14px; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
  background: var(--green); color: #fff; border: 0; border-radius: 99px; padding: 12px;
}
.fam-primary:hover { background: #3d6a33; }
.fam-secondary {
  width: 100%; margin-top: 10px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  background: var(--cream); color: var(--ink); border: 1.5px solid var(--line); border-radius: 99px; padding: 11px;
}
.fam-secondary:hover { border-color: var(--brown); }
.fam-link {
  display: block; width: 100%; margin-top: 12px; font: inherit; font-size: 13px; font-weight: 600;
  background: none; border: 0; color: var(--brown); cursor: pointer; text-align: center;
}
.fam-link:hover { color: var(--ink); }
.fam-row { display: flex; gap: 10px; }
.fam-row .fam-secondary, .fam-row .fam-link { flex: 1; }
.fam-divider {
  display: flex; align-items: center; gap: 10px; color: var(--brown); font-size: 12px; margin: 14px 0 4px;
}
.fam-divider::before, .fam-divider::after { content: ""; flex: 1; height: 1.5px; background: var(--line); }
.fam-small { font-size: 12px !important; }
.fam-msg { color: var(--bad); font-size: 12.5px; min-height: 16px; margin-top: 8px; }
.fam-kids { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.fam-kid {
  display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 12px;
  align-items: center; text-align: left; font: inherit; cursor: pointer;
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.fam-kid:hover { border-color: var(--green); }
.fk-avatar { grid-row: 1 / 3; font-size: 30px; }
.fk-name { font-weight: 800; font-size: 15px; color: var(--ink); }
.fk-rank { font-size: 12px; color: var(--brown); font-weight: 600; }
.fam-avs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 4px; }
.fam-av {
  font-size: 22px; padding: 8px 0; cursor: pointer; background: var(--cream);
  border: 1.5px solid var(--line); border-radius: 10px;
}
.fam-av.sel { border-color: var(--green); background: #e6efe0; }
.fam-mrow {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 0;
  border-bottom: 1px dotted var(--line); font-size: 14.5px; font-weight: 600;
}
.fam-del {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  background: none; border: 1.5px solid var(--line); border-radius: 99px; padding: 4px 12px; color: var(--bad);
}
.fam-del:hover { border-color: var(--bad); }

/* ---------- desktop world-map background ---------- */
@media (min-width: 900px) {
  body {
    background-image: url("/assets/worldmap-bg.jpg");
    background-size: cover;
    background-position: center 20%;
    background-attachment: fixed;
    background-repeat: no-repeat;
  }
  /* keep reading surfaces solid so the map never fights the text */
  .top, .foot { background: var(--cream2); }
}

/* ---------- interactive flag map ---------- */
.explore { margin-top: 34px; }
.explore h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.explore-hint { font-size: 13.5px; color: var(--brown); margin-bottom: 14px; }
.worldmap-wrap {
  background: var(--cream2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(8px, 2vw, 20px);
}
.worldmap-wrap svg { width: 100%; height: auto; display: block; }
.worldmap-wrap svg .country {
  fill: #e7dcc8;
  stroke: var(--cream2);
  stroke-width: 0.5;
  transition: filter 160ms ease;
  outline: none;
}
.worldmap-wrap svg .country path { fill: inherit; stroke: inherit; stroke-width: inherit; }
.worldmap-wrap svg .flaggable { cursor: pointer; }
.worldmap-wrap svg .flag-active {
  stroke: var(--green);
  stroke-width: 1.2;
  filter: drop-shadow(0 1px 3px rgba(61,47,30,.25));
}
.map-tooltip {
  position: fixed; z-index: 200; pointer-events: none; display: none;
  align-items: center; gap: 8px;
  background: var(--cream2); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(61,47,30,.18);
  padding: 6px 10px; font-size: 13.5px; font-weight: 700;
}
.map-tooltip img { width: 22px; height: auto; border-radius: 2px; box-shadow: 0 0 0 1px rgba(61,47,30,.15); display: block; }
