/* python.privat: shared base for every page.
   Direction lives in /DESIGN.md (paper, ink, highlighter; ENERGY 2 / RHYTHM 2 / MOTION 1). */

:root {
  /* palette */
  --ink: #16324f;
  --ink-2: #3c5068;
  --ink-3: #566678;
  --paper: #faf8f3;
  --paper-2: #f2efe6;
  --card: #ffffff;
  --line: #e4ded0;
  --line-strong: #cfc7b4;
  --mint: #2fd69e;
  --mint-ink: #0b7a55;
  --mint-soft: #dcf7ec;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --code-bg: #0f1d2e;
  --code-fg: #dbe5ef;

  /* legacy names, kept so older stylesheets pick up the new palette */
  --navy: var(--ink);
  --mint-dark: var(--mint-ink);
  --white: var(--card);
  --bg-alt: var(--paper-2);
  --text: var(--ink);
  --text-soft: var(--ink-3);
  --border: var(--line);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --radius-sm: var(--r-s);
  --radius-md: var(--r-m);

  /* shadow is for things that float above the page only */
  --shadow-sm: 0 1px 2px rgba(22, 50, 79, .06);
  --shadow-md: 0 8px 24px rgba(22, 50, 79, .10);
  --shadow-lg: 0 16px 40px rgba(22, 50, 79, .14);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --focus: 0 0 0 2px var(--card), 0 0 0 4px var(--mint-ink);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; }
code, kbd, pre { font-family: var(--font-mono); }
img, svg, video { max-width: 100%; height: auto; }

a { color: var(--mint-ink); }
:focus-visible { outline: 2px solid var(--mint-ink); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 800px; }
@media (max-width: 480px) { .container { padding: 0 16px; } }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.table-scroll { overflow-x: auto; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--r-s);
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* The identity motif: a highlighter band under one key phrase. */
.hl {
  background: linear-gradient(transparent 58%, rgba(47, 214, 158, .55) 58%, rgba(47, 214, 158, .55) 92%, transparent 92%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ============ NAVBAR ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}
.nav__brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.02em;
  margin-right: auto;
  white-space: nowrap;
}
.nav__brand-accent { color: var(--mint-ink); }

.nav__links { display: none; gap: 24px; align-items: center; }
.nav__links a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding: 4px 2px;
  transition: color .15s ease;
}
.nav__links a:hover { color: var(--ink); }
/* active page: the highlighter motif instead of an underline bar */
.nav__links a.is-active {
  color: var(--ink);
  background: linear-gradient(transparent 62%, rgba(47, 214, 158, .55) 62%);
}
.nav__links a.btn--primary,
.nav__links a.btn--primary:hover { color: #fff; }

.nav__toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: none;
  border-radius: var(--r-s);
  cursor: pointer;
  order: 10; /* always the last item, whatever the markup order */
}
@media (max-width: 767px) { .nav__inner { gap: 12px; } }
.nav__toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 767px) {
  .nav__links.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    padding: 12px 16px 16px;
  }
  .nav__links.is-open a { padding: 12px 8px; font-size: 1.05rem; }
  .nav__links.is-open a.is-active { background: var(--mint-soft); border-radius: var(--r-s); }
  .nav__links.is-open a.btn { margin-top: 8px; text-align: center; }
}
@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }
}

.nav__back {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
}
.nav__back:hover { color: var(--ink); }
.nav__brand.is-active .nav__brand-accent { text-decoration: none; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-s);
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover:not(:disabled) { background: #0e2238; border-color: #0e2238; }
.btn--primary:active:not(:disabled) { background: #0a1a2b; }
.btn--ghost { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn--ghost:active:not(:disabled) { background: var(--paper-2); }
.btn--sm { padding: 6px 12px; font-size: .875rem; }
.btn--lg { padding: 13px 22px; font-size: 1rem; }

/* ============ LANDING: HERO ============ */
.hero { padding: 56px 0 72px; }
.hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.hero__title {
  font-size: clamp(2.1rem, 6vw, 3.5rem);
  line-height: 1.1;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 20px;
  letter-spacing: -0.035em;
  max-width: 15ch;
}
.hero__subtitle {
  font-size: 1.1rem;
  color: var(--ink-2);
  max-width: 34rem;
  margin-bottom: 28px;
  line-height: 1.7;
}
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (min-width: 900px) {
  .hero { padding: 80px 0 96px; }
  .hero__inner { grid-template-columns: 1.15fr 1fr; gap: 56px; }
}

/* A real exercise from Lesson 05, shown as it appears in the course. */
.sample {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  padding: 22px;
  box-shadow: var(--shadow-md); /* the one raised element on the landing: it is the product */
  min-width: 0;
}
.sample__head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.sample__lesson { font-size: .82rem; font-weight: 600; color: var(--mint-ink); }
.sample__title { font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.sample__prompt { color: var(--ink-2); font-size: .95rem; margin-bottom: 14px; }
.sample__prompt code {
  font-size: .85em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; color: var(--ink);
}
.sample__code {
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--r-m);
  padding: 16px 18px;
  font-size: .88rem;
  line-height: 1.65;
  overflow-x: auto;
}
.sample__code mark {
  background: rgba(47, 214, 158, .28);
  color: #fff;
  border-bottom: 2px solid var(--mint);
  padding: 0 2px;
}
.sample__tests { margin-top: 14px; }
.sample__tests-title { font-size: .85rem; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.sample__tests ul { list-style: none; border-top: 1px solid var(--line); }
.sample__tests li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
  font-size: .88rem; color: var(--ink-2);
}
.sample__tests li code { font-size: .85rem; color: var(--ink); }
.sample__hidden { color: var(--ink-3) !important; }

/* ============ LANDING: SECTIONS ============ */
.section { padding: 72px 0; }
.section--alt { background: var(--paper-2); border-block: 1px solid var(--line); }
.section__header { margin-bottom: 40px; }
.section__title {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
}
.section__desc { font-size: 1.05rem; color: var(--ink-2); max-width: 36rem; }

/* text-led section: heading on one side, content on the other */
.split { display: grid; grid-template-columns: 1fr; gap: 32px; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 64px; }
  .split__head { position: sticky; top: 96px; align-self: start; }
}

/* the real per-lesson flow: five numbered cards; the quiz card closes the row */
.flow { list-style: none; counter-reset: flow; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .flow { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .flow { grid-template-columns: repeat(5, 1fr); } }
.flow li {
  counter-increment: flow;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
}
.flow li::before {
  content: counter(flow);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}
.flow li:last-child { background: var(--mint-soft); border-color: #9fe6c9; }
.flow li:last-child::before { background: var(--mint); border-color: var(--mint); }
.flow h3 { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.flow p { color: var(--ink-2); font-size: .94rem; }

/* curriculum: one card per part; longer parts take two rows */
.syllabus { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .syllabus { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) {
  .syllabus { grid-template-columns: repeat(3, 1fr); }
  .syllabus__part--a { grid-column: 1; grid-row: 1 / span 2; }
  .syllabus__part--b { grid-column: 2; grid-row: 1; }
  .syllabus__part--c { grid-column: 3; grid-row: 1 / span 2; }
  .syllabus__part--d { grid-column: 2; grid-row: 2; }
}
.syllabus__part {
  padding: 18px 20px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
}
.syllabus__part h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}
.syllabus__range { display: block; font-size: .8rem; font-weight: 600; color: var(--mint-ink); margin-bottom: 2px; letter-spacing: 0; }
.syllabus__part ol { list-style: none; }
.syllabus__part li {
  position: relative;
  padding: 7px 0 7px 2.3em;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: .95rem;
}
.syllabus__part li:last-child { border-bottom: 0; }
.syllabus__part ol[start="1"] { counter-reset: s 0; }
.syllabus__part ol[start="11"] { counter-reset: s 10; }
.syllabus__part ol[start="16"] { counter-reset: s 15; }
.syllabus__part ol[start="23"] { counter-reset: s 22; }
.syllabus__part li::before {
  counter-increment: s;
  content: counter(s, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--ink-3);
  position: absolute;
  left: 0;
  top: 9px;
}
.syllabus code, .points code { font-size: .88em; color: var(--ink); }

/* why private: four cards */
.points { display: grid; grid-template-columns: 1fr; gap: 12px; }
.points > div { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); }
.points dt { font-weight: 700; font-size: 1.08rem; color: var(--ink); margin-bottom: 6px; }
.points dd { color: var(--ink-2); font-size: .95rem; }
@media (min-width: 640px) { .points { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .points { grid-template-columns: repeat(4, 1fr); } }

/* ============ FAQ (native details), as one card ============ */
.faq { max-width: 800px; margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: 4px 20px; }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__item:last-child { border-bottom: 0; }
.faq__question {
  list-style: none;
  padding: 18px 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq__question::-webkit-details-marker { display: none; }
.faq__question::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-2);
  transition: transform .2s ease;
}
.faq__item[open] .faq__question::after { transform: rotate(45deg); }
.faq__question:hover { color: var(--mint-ink); }
.faq__answer { color: var(--ink-2); line-height: 1.7; padding: 0 32px 18px 4px; }

/* ============ FOOTER ============ */
.footer { padding: 32px 0; border-top: 1px solid var(--line); background: var(--paper); }
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
}
.footer p { color: var(--ink-3); font-size: .9rem; }
.footer__brand { font-weight: 800; color: var(--ink); margin-right: 8px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer__links a { color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 600; }
.footer__links a:hover { color: var(--ink); text-decoration: underline; }
