@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,600&family=Barlow+Semi+Condensed:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* ============================================================
   Private Pilot Ground School shared stylesheet.
   Ported from the Rust course (~/Rust-Tutorial/assets/style.css):
   warm paper, serif prose, generous measure, left lesson rail.
   Accent swapped from Rust orange to aviation blue.
   Every lesson links this file: <link rel="stylesheet" href="../assets/style.css">
   ============================================================ */

:root {
  --paper:      #faf4e8;   /* warm sepia paper */
  --ink:        #1a1a1a;
  --ink-soft:   #555049;
  --rule:       #e6e2d6;
  --sky:        #1d4e89;   /* aviation blue accent */
  --sky-soft:   #e2eaf4;
  --code-bg:    #f6f3ec;
  --ok:         #2f7d32;
  --ok-bg:      #e8f3e9;
  --no:         #b3261e;
  --no-bg:      #fbe9e7;
  --max:        42rem;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans:  -apple-system, "Segoe UI", system-ui, sans-serif;
  --heads: "Barlow Semi Condensed", var(--sans);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  margin: 0;
  padding: 4rem 1.5rem 6rem;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--max); margin: 0 auto; }

/* ---- Top navigation (injected by assets/site-nav.js) ---- */
.site-nav {
  max-width: var(--max);
  margin: -2.4rem auto 2.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 0.4rem 1.1rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
}
.site-nav a { color: var(--ink-soft); border: none; padding: 0.15rem 0; }
.site-nav a:hover { color: var(--sky); }
.site-nav a.active { color: var(--sky); font-weight: 700; }
.site-nav .sn-logo { margin-right: 0.5rem; }
.site-nav .sn-logo img { height: 24px; display: block; }
.sn-links { display: flex; align-items: center; gap: 0.4rem 1.1rem; flex-wrap: wrap; }
.sn-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.25rem 0.6rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
@media (max-width: 47.99rem) {
  .sn-toggle { display: block; }
  .sn-links { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding-top: 0.6rem; }
  .site-nav.open .sn-links { display: flex; }
}
@media print { .site-nav { display: none; } }

/* ---- Site branding ---- */
.site-logo { margin: 0 0 1rem; }
.site-logo img { width: 320px; max-width: 85%; display: block; }
.site-logo-sm { display: inline-block; border: none; margin: 0 0 1.8rem; }
.site-logo-sm img { width: 170px; display: block; }
.ln-logo { display: block; border: none; margin: 0 0 1.1rem; }
.ln-logo img { width: 140px; display: block; }

/* ---- Course chrome ---- */
.eyebrow {
    font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sky);
  font-weight: 600;
  margin: 0 0 0.6rem;
}

h1, h2, h3 {
  font-family: var(--heads);
}

h1 {
  font-size: 2.4rem;
  line-height: 1.1;
  font-weight: 700;
  margin: 0 0 0.4rem;
  letter-spacing: -0.01em;
}

.subtitle {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.12rem;
  margin: 0 0 2.2rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.6rem 0 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 1.8rem 0 0.5rem;
}

p { margin: 0 0 1rem; }

a { color: var(--sky); text-decoration: none; border-bottom: 1px solid var(--sky-soft); }
a:hover { border-bottom-color: var(--sky); }

strong { font-weight: 700; }
em { font-style: italic; }

ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin: 0.3rem 0; }

/* Key terms on first definition: each is a real link to its glossary entry.
   The term stays ink-colored; the dotted underline is the "definition" cue. */
dfn { font-style: normal; font-weight: 700; border-bottom: 2px dotted var(--sky); }
a.dfn-link { color: inherit; border-bottom: none; }
a.dfn-link:hover dfn { border-bottom-style: solid; color: var(--sky); }

/* Source citation line under a section */
.source {
    font-size: 0.78rem;
  color: var(--ink-soft);
  margin: -0.4rem 0 1.2rem;
}
.source::before { content: "§ "; color: var(--sky); }

/* Article byline: same look as .source, no citation mark */
.byline {
    font-size: 0.78rem;
  color: var(--ink-soft);
  margin: -0.4rem 0 1.2rem;
}

/* ---- Code / fixed-pitch (METARs, frequencies, regulations) ---- */
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--sky);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0 0 1.2rem;
}
pre code { background: none; padding: 0; font-size: 1em; }

/* ---- Figures & tables ---- */
figure { margin: 1.8rem 0; }
figure svg { width: 100%; height: auto; display: block; }

/* Photographs (assets/photos/): bordered, rounded; attribution in figcaption */
/* Direct children only: images inside a .crop are framed by the crop's
   own geometry and must not be size-capped. */
figure.photo > img { width: 100%; max-height: 24rem; object-fit: cover; display: block; border-radius: 5px; border: 1px solid var(--rule); }
/* Diagrams must never be cropped: uncap the height. Portrait diagrams
   additionally narrow and center so they don't tower over the prose. */
figure.photo.uncap > img { max-height: none; object-fit: unset; }
figure.photo.narrow { max-width: 30rem; margin-left: auto; margin-right: auto; }
.photo-pair { display: flex; gap: 1rem; margin: 1.8rem 0; }
.photo-pair figure { flex: 1; margin: 0; }
.photo-pair img { width: 100%; display: block; border-radius: 5px; border: 1px solid var(--rule); aspect-ratio: 4 / 3; object-fit: cover; }
figure.photo-small { max-width: 320px; margin-left: auto; margin-right: auto; }
figure.photo-small img { width: 100%; display: block; border-radius: 5px; border: 1px solid var(--rule); }
/* Zoomed framing of a larger photo; per-use zoom values go inline on the img */
.crop { overflow: hidden; border-radius: 5px; border: 1px solid var(--rule); }
.crop img { display: block; }
@media (max-width: 40rem) { .photo-pair { flex-direction: column; } }
figcaption {
    font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 0 0 1.4rem;
}
th {
    font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
  padding: 0.45rem 0.7rem 0.35rem;
}
td {
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.7rem;
  vertical-align: top;
}

/* Glossary deep links: light up the row the reader jumped to */
td[id] { scroll-margin-top: 1.2rem; }
@keyframes target-flash { from { background: #c7dbf2; } }
tr:has(> td:target) {
  background: var(--sky-soft);
  animation: target-flash 1.4s ease-out;
}
tr:has(> td:target) > td { border-bottom-color: var(--sky); }

/* Lesson lists inside course-map cells: built lessons are links,
   planned ones are muted. */
td ul { margin: 0; padding-left: 1.05rem; }
td ul li { margin: 0.15rem 0; }
.planned { color: var(--ink-soft); }

/* ---- Callouts ---- */
.note, .compare, .win, .warn {
  border-radius: 5px;
  padding: 0.9rem 1.1rem;
  margin: 1.4rem 0;
  font-size: 0.95rem;
}
.note    { background: var(--sky-soft); border-left: 3px solid var(--sky); }
.compare { background: #f0f4f8; border-left: 3px solid #3a6ea5; }
.win     { background: var(--ok-bg); border-left: 3px solid var(--ok); }
.warn    { background: #fdf3dc; border-left: 3px solid #b8860b; }
.note .label, .compare .label, .win .label, .warn .label {
  display: block;
    font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.35rem;
  opacity: 0.85;
}

/* ---- Quiz widget (see quiz.js) ---- */
.quiz {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  margin: 1.4rem 0;
  background: #f5edda;
}
.quiz-q { font-weight: 700; margin: 0 0 0.8rem; }
.quiz-opt {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.95rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.55rem 0.8rem;
  margin: 0.4rem 0;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--sky); background: var(--sky-soft); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { background: var(--ok-bg); border-color: var(--ok); }
.quiz-opt.wrong   { background: var(--no-bg); border-color: var(--no); }
.quiz-fb {
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  display: none;
}
.quiz-fb.show { display: block; }
.quiz-fb.ok   { color: var(--ok); }
.quiz-fb.no   { color: var(--no); }

/* ---- Left-margin lesson index (injected by nav.js) ---- */
.lesson-nav {
    font-size: 0.9rem;
}
.ln-head {
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 700;
  color: var(--sky);
  margin: 0 0 0.9rem;
}
.ln-sub {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.3rem 0 0.4rem;
}
.ln-list { list-style: none; padding: 0; margin: 0; }
.ln-list li { margin: 0.15rem 0; }
.ln-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 5px;
  border: none;
  color: var(--ink-soft);
  line-height: 1.25;
}
.ln-list a:hover { background: var(--sky-soft); color: var(--ink); }
.ln-list a.active { background: var(--sky-soft); color: var(--sky); font-weight: 700; }
.ln-num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--code-bg);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}
.ln-list a.active .ln-num { background: var(--sky); color: #fff; }

/* Wide screens: fixed rail in the left margin; shift page content clear of it. */
@media (min-width: 64rem) {
  body.has-nav { padding-left: 17rem; }
  .lesson-nav {
    position: fixed;
    top: 0; left: 0;
    width: 15rem;
    height: 100vh;
    overflow-y: auto;
    padding: 2.5rem 1.1rem;
    background: #faf8f1;
    border-right: 1px solid var(--rule);
  }
}

/* The rail's collapse toggle exists only on narrow screens. */
.ln-toggle { display: none; }

/* Narrow screens: the rail collapses behind a "Course contents" bar. */
@media (max-width: 63.99rem) {
  .lesson-nav {
    max-width: var(--max);
    margin: 0 auto 2rem;
  }
  .ln-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.55rem 0.9rem;
    font-family: var(--heads);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--sky);
    cursor: pointer;
  }
  .ln-body { display: none; padding-top: 1rem; }
  .lesson-nav.open .ln-body { display: block; }
}


/* ---- Cards and buttons (homepage, section hubs) ---- */
.card {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.3rem 1.4rem;
  margin: 1.6rem 0;
  background: #fffdf6;
}
.card h2 { margin-top: 0; border-bottom: none; }
.card .go, .go {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 700;
  background: var(--sky);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.55rem 1rem;
  margin-top: 0.4rem;
}
.go:hover { background: #163d6c; color: #fff; }
.site-foot {
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---- Footer / nav ---- */
.lesson-foot {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.ask {
    background: var(--sky-soft);
  border-radius: 5px;
  padding: 0.9rem 1.1rem;
  font-size: 0.92rem;
  margin: 2rem 0 0;
}
.nav-links { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---- Print ----
   The sidebar must never print. It is position:fixed on wide screens, and a
   fixed element can otherwise repeat on every printed page, so we hide it with
   !important to beat the wide-screen rule at any paper size, scale, or
   orientation, and zero out the space it reserved. */
@media print {
  body { padding: 0; background: #fff; }
  body.has-nav { padding-left: 0 !important; }
  .lesson-nav { display: none !important; }
  .quiz, .ask, .nav-links { display: none; }
  a { color: var(--ink); border: none; }
  pre { box-shadow: none; }
}


/* ---- Type roles: serif prose, Barlow chrome, neutral sans annotations ---- */
.eyebrow, .ln-head, .ln-sub, th,
.note .label, .compare .label, .win .label, .warn .label,
.site-nav, .go, .card .go {
  font-family: var(--heads);
}
.site-nav { font-size: 1rem; }
figcaption, .source, .byline, .ask, .lesson-nav, .quiz-fb {
  font-family: var(--sans);
}
