/* ===================================================================
   SEMICOLON — Learn to code from zero
   Single stylesheet for the whole site.

   SECTIONS
     1  Design tokens & themes      10  Footer
     2  Reset & base                11  Back-to-top, toast
     3  Typography & utilities      12  About page
     4  Buttons                     13  Learn page
     5  Header & navigation         14  Blog & post pages
     6  Hero                        15  Contact page
     7  Sections & cards            16  FAQ accordion
     8  Testimonials                17  Responsive
     9  Newsletter                  18  Motion & print
   =================================================================== */

/* ---------- 1. DESIGN TOKENS & THEMES ------------------------------
   Every colour, size and shadow is defined once here. Components below
   only ever reference these variables, never raw hex values. Change a
   token, change the whole site.                                      */
:root {
  /* colour — light theme */
  --bg:            #ffffff;
  --bg-alt:        #f4f7fb;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e3e9f2;
  --border-strong: #cbd5e1;

  --text:          #0f1b2d;
  --text-muted:    #55647c;
  --text-subtle:   #7b8AA0;

  --primary:       #1d4ed8;
  --primary-hover: #1a3fb0;
  --primary-soft:  #eef3ff;
  --primary-ring:  rgba(29, 78, 216, .28);

  --accent:        #d95514;
  --accent-soft:   #fdf0e8;

  --success:       #146c43;
  --success-soft:  #e7f4ed;
  --danger:        #b3261e;
  --danger-soft:   #fdecea;

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* space & shape */
  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --maxw:      1160px;
  --gutter:    clamp(1.1rem, 4vw, 2rem);

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 3px rgba(15, 27, 45, .05);
  --shadow:    0 4px 12px rgba(15, 27, 45, .07), 0 12px 28px rgba(15, 27, 45, .06);
  --shadow-lg: 0 12px 24px rgba(15, 27, 45, .10), 0 28px 56px rgba(15, 27, 45, .10);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --header-h: 66px;
}

/* Dark theme. Two selectors on purpose:
   - the media query follows the operating system setting
   - [data-theme] is set by our toggle button and must win over it   */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0a1120;
    --bg-alt:        #0e1728;
    --surface:       #121d31;
    --surface-2:     #16233a;
    --border:        #223350;
    --border-strong: #2f456a;

    --text:          #e7eef9;
    --text-muted:    #9dadc5;
    --text-subtle:   #7488a5;

    --primary:       #6ba3f8;
    --primary-hover: #8bb8fa;
    --primary-soft:  #14243f;
    --primary-ring:  rgba(107, 163, 248, .32);

    --accent:        #f59158;
    --accent-soft:   #33200f;

    --success:       #5cc08a;
    --success-soft:  #10281c;
    --danger:        #f08c85;
    --danger-soft:   #2e1614;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 4px 12px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, .5), 0 28px 56px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg:            #0a1120;
  --bg-alt:        #0e1728;
  --surface:       #121d31;
  --surface-2:     #16233a;
  --border:        #223350;
  --border-strong: #2f456a;

  --text:          #e7eef9;
  --text-muted:    #9dadc5;
  --text-subtle:   #7488a5;

  --primary:       #6ba3f8;
  --primary-hover: #8bb8fa;
  --primary-soft:  #14243f;
  --primary-ring:  rgba(107, 163, 248, .32);

  --accent:        #f59158;
  --accent-soft:   #33200f;

  --success:       #5cc08a;
  --success-soft:  #10281c;
  --danger:        #f08c85;
  --danger-soft:   #2e1614;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 4px 12px rgba(0, 0, 0, .45), 0 12px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, .5), 0 28px 56px rgba(0, 0, 0, .4);
}

/* ---------- 2. RESET & BASE ---------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s, color .25s;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Visible focus for keyboard users. Removing this breaks the site for
   anyone who doesn't use a mouse. */
:focus-visible {
  outline: 3px solid var(--primary-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--primary); color: #fff; }

/* ---------- 3. TYPOGRAPHY & UTILITIES ------------------------------ */
h1, h2, h3, h4, h5 {
  margin: 0 0 .5em;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.05rem, 5vw, 3.35rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.35rem); }
h3 { font-size: 1.18rem; letter-spacing: -.01em; }
h4 { font-size: 1rem; }

p { margin: 0 0 1.05em; color: var(--text-muted); }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); text-decoration: none; transition: color .18s; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: .1em .38em;
}
pre {
  font-family: var(--mono);
  font-size: .86rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.6;
}
pre code { background: none; border: none; padding: 0; }

.container { width: min(100% - (var(--gutter) * 2), var(--maxw)); margin-inline: auto; }
.section   { padding: clamp(3.2rem, 7vw, 5.5rem) 0; }
.section--alt { background: var(--bg-alt); }

.section-head { max-width: 62ch; margin: 0 auto clamp(2rem, 4vw, 3rem); text-align: center; }
.section-head p { font-size: 1.05rem; }
.section-head--left { margin-inline: 0; text-align: left; }

.eyebrow {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .7rem;
}
.lede { font-size: clamp(1.02rem, 2vw, 1.16rem); color: var(--text-muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -100px; left: 1rem; z-index: 999;
  background: var(--primary); color: #fff;
  padding: .7rem 1.1rem; border-radius: 0 0 8px 8px;
  transition: top .2s;
}
.skip-link:focus { top: 0; color: #fff; text-decoration: none; }

/* fade-and-rise on scroll, enabled by js/main.js */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

.grid { display: grid; gap: 1.35rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(275px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }

/* ---------- 4. BUTTONS --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .78rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease), box-shadow .2s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px var(--primary-ring); }
.btn--primary:hover { background: var(--primary-hover); color: #fff; box-shadow: 0 8px 22px var(--primary-ring); }

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--primary); }

.btn--sm { padding: .55rem 1.05rem; font-size: .87rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn-row--center { justify-content: center; }

/* ---------- 5. HEADER & NAVIGATION --------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; flex: none;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 1.15rem; font-weight: 700;
  line-height: 1;
}

.nav-menu { display: flex; align-items: center; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: .3rem;
  padding: .5rem .85rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .93rem;
  font-weight: 500;
  transition: color .18s, background-color .18s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--primary); background: var(--primary-soft); font-weight: 600; }

/* dropdown */
.has-dropdown { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  min-width: 232px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .4rem;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s var(--ease), visibility .18s;
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown,
.dropdown.is-open { opacity: 1; visibility: visible; transform: none; }
.dropdown a {
  display: block;
  padding: .55rem .75rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: .9rem;
}
.dropdown a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dropdown a small { display: block; color: var(--text-subtle); font-size: .78rem; }

.nav-actions { display: flex; align-items: center; gap: .5rem; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 19px; height: 19px; }

/* the theme toggle swaps which icon is visible */
:root[data-theme="dark"] .icon-sun,
:root:not([data-theme="light"]) .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon,
:root:not([data-theme="light"]) .icon-moon { display: block; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .icon-moon { display: none; }
}

.nav-toggle { display: none; }

/* the header call-to-action steps aside on narrow screens */
.nav-cta { display: inline-flex; }
@media (max-width: 900px) { .nav-cta { display: none; } }

/* ---------- 6. HERO ------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(52ch 40ch at 78% 8%, color-mix(in srgb, var(--primary) 12%, transparent), transparent 68%),
    radial-gradient(44ch 34ch at 8% 92%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 65%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
.hero h1 { margin-bottom: .45em; }
.hero .lede { margin-bottom: 1.8rem; max-width: 52ch; }

.pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .85rem .35rem .45rem;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  color: var(--primary);
  font-size: .81rem; font-weight: 600;
  margin-bottom: 1.4rem;
}
.pill b {
  background: var(--primary); color: #fff;
  border-radius: 999px; padding: .1rem .55rem;
  font-size: .72rem; letter-spacing: .04em;
}

.hero-stats { display: flex; gap: 2.2rem; margin-top: 2.4rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats .n { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; }
.hero-stats .l { font-size: .82rem; color: var(--text-subtle); }

/* fake editor window — pure CSS, no screenshot needed */
.editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.editor-bar {
  display: flex; align-items: center; gap: .45rem;
  padding: .7rem .9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.editor-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.editor-dot:nth-child(1) { background: #ef7a72; }
.editor-dot:nth-child(2) { background: #e5b95c; }
.editor-dot:nth-child(3) { background: #6fc48a; }
.editor-file {
  margin-left: .6rem;
  font-family: var(--mono); font-size: .78rem;
  color: var(--text-subtle);
}
.editor-body { padding: 1.1rem 1.2rem 1.3rem; font-family: var(--mono); font-size: .84rem; line-height: 1.85; }
.editor-line { display: flex; gap: 1rem; white-space: pre; }
.editor-num { color: var(--text-subtle); user-select: none; min-width: 1.2rem; text-align: right; opacity: .7; }
.tok-key { color: var(--accent); }
.tok-fn  { color: var(--primary); }
.tok-str { color: var(--success); }
.tok-com { color: var(--text-subtle); font-style: italic; }

/* blinking cursor */
.caret {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--primary); vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ---------- 7. SECTIONS & CARDS ------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s, border-color .2s;
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card h3 { margin-bottom: .35rem; }
.card p { font-size: .93rem; margin-bottom: 0; }

.feature-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 1.1rem;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-icon--accent { background: var(--accent-soft); color: var(--accent); }

.tag {
  display: inline-block;
  font-size: .72rem; font-weight: 600;
  letter-spacing: .04em;
  padding: .22rem .6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag--primary { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--primary); }
.tag--accent  { background: var(--accent-soft);  border-color: color-mix(in srgb, var(--accent) 28%, transparent);  color: var(--accent); }
.tag--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); color: var(--success); }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }

.link-arrow { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .92rem; }
.link-arrow svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover svg { transform: translateX(3px); }

/* ---------- 8. TESTIMONIALS ----------------------------------------- */
.carousel { position: relative; }
.carousel-track { overflow: hidden; }
.carousel-slides { display: flex; transition: transform .5s var(--ease); }
.carousel-slide { min-width: 100%; padding: .35rem; }

.quote {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.6rem, 4vw, 2.6rem);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.quote blockquote { margin: 0 0 1.5rem; font-size: clamp(1.02rem, 2.1vw, 1.24rem); line-height: 1.6; color: var(--text); }
.quote-person { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700; font-size: .92rem;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.quote-person .who { text-align: left; }
.quote-person .name { font-weight: 650; font-size: .93rem; }
.quote-person .role { font-size: .82rem; color: var(--text-subtle); }
.stars { color: var(--accent); letter-spacing: .1em; font-size: .9rem; margin-bottom: .9rem; }

.carousel-nav { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: 1.4rem; }
.carousel-dots { display: flex; gap: .4rem; }
.carousel-dot {
  width: 8px; height: 8px; padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--border-strong);
  cursor: pointer;
  transition: width .25s var(--ease), background-color .25s;
}
.carousel-dot[aria-selected="true"] { width: 22px; border-radius: 999px; background: var(--primary); }

.sample-note {
  text-align: center;
  font-size: .8rem;
  color: var(--text-subtle);
  margin-top: 1.2rem;
  font-style: italic;
}

/* ---------- 9. NEWSLETTER ------------------------------------------- */
.newsletter {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 62%, var(--accent)));
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  text-align: center;
}
.newsletter h2 { color: #fff; }
.newsletter p { color: rgba(255, 255, 255, .88); max-width: 52ch; margin-inline: auto; }
.newsletter-form {
  display: flex; gap: .6rem; flex-wrap: wrap;
  justify-content: center;
  max-width: 480px; margin: 1.6rem auto 0;
}
.newsletter-form input {
  flex: 1 1 240px;
  padding: .8rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.newsletter-form input::placeholder { color: rgba(255, 255, 255, .72); }
.newsletter-form input:focus { outline: 3px solid rgba(255, 255, 255, .5); outline-offset: 1px; }
.newsletter-form .btn { background: #fff; color: var(--primary); }
.newsletter-form .btn:hover { background: rgba(255, 255, 255, .9); color: var(--primary); }
.newsletter .form-msg { color: #fff; justify-content: center; }
.newsletter small { display: block; margin-top: .9rem; color: rgba(255, 255, 255, .78); font-size: .82rem; }

/* ---------- 10. FOOTER ---------------------------------------------- */
.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: clamp(2.6rem, 5vw, 3.6rem) 0 1.8rem;
  margin-top: clamp(3rem, 6vw, 5rem);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2.4rem;
}
.footer-brand p { font-size: .9rem; max-width: 34ch; margin-top: .9rem; }
.footer-col h4 {
  font-size: .76rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-subtle); margin-bottom: .9rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { color: var(--text-muted); font-size: .91rem; }
.footer-col a:hover { color: var(--primary); }

.social { display: flex; gap: .5rem; margin-top: 1.2rem; }
.social a {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  transition: all .18s;
}
.social a:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.social svg { width: 17px; height: 17px; }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.4rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  font-size: .86rem; color: var(--text-subtle);
}
.footer-bottom ul { display: flex; gap: 1.2rem; list-style: none; margin: 0; padding: 0; }
.footer-bottom a { color: var(--text-subtle); }

/* ---------- CREATOR SIGNATURE -------------------------------------
   The last thing on every page. Built entirely from the existing
   tokens (--primary, --accent, --border) so it can never clash with
   the theme, and so it follows dark mode for free.

   The trailing semicolon is the point of it — the site is called
   Semicolon, and a semicolon is how a developer ends a statement.
   That's what makes this a signature rather than a line of text. */
.creator-signature {
  margin-top: 2rem;
  padding: 2.3rem 1rem .4rem;
  text-align: center;
}

/* A hairline that fades out at both ends, with a rotated square in
   the middle. Far more refined than a full-width <hr>. */
.creator-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  margin-bottom: 1.6rem;
}
.creator-rule {
  height: 1px;
  width: min(30%, 160px);
  background: linear-gradient(90deg, transparent, var(--border-strong));
}
.creator-rule + .creator-rule,
.creator-divider .creator-rule:last-child {
  background: linear-gradient(90deg, var(--border-strong), transparent);
}
.creator-diamond {
  width: 7px; height: 7px;
  flex: none;
  transform: rotate(45deg);
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 11%, transparent),
              0 0 12px color-mix(in srgb, var(--primary) 45%, transparent);
}

.creator-line {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin: 0;
  padding: 0 .5rem;
}

/* Soft glow behind the name. Sits behind the text, ignores pointer
   events, and breathes slowly rather than flashing. */
.creator-line::before {
  content: "";
  position: absolute;
  left: 50%; top: 58%;
  width: min(80vw, 360px);
  height: 120px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center,
              color-mix(in srgb, var(--primary) 24%, transparent), transparent 70%);
  filter: blur(24px);
  opacity: .45;
  pointer-events: none;
  z-index: 0;
  animation: sig-glow 6s ease-in-out infinite;
}
@keyframes sig-glow {
  0%, 100% { opacity: .3;  transform: translate(-50%, -50%) scale(.94); }
  50%      { opacity: .62; transform: translate(-50%, -50%) scale(1.06); }
}

.creator-label {
  position: relative;
  z-index: 1;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--text-subtle);
  text-indent: .3em;          /* letter-spacing adds a trailing gap; recentre */
}

/* A slow shimmer travelling through the name. The gradient is wider
   than the text and its position animates, so the highlight sweeps. */
.creator-name {
  position: relative;
  z-index: 1;
  font-size: clamp(1.28rem, 4.2vw, 1.95rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  text-wrap: balance;
  background: linear-gradient(100deg,
              var(--text) 0%,
              var(--primary) 40%,
              var(--accent) 58%,
              var(--text) 100%);
  background-size: 240% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sig-shimmer 11s linear infinite;
}
@keyframes sig-shimmer { to { background-position: 240% center; } }

/* Anyone who has asked their system for less motion gets a still,
   fully legible version — not a broken one. */
@media (prefers-reduced-motion: reduce) {
  .creator-line::before { animation: none; opacity: .4; }
  .creator-name {
    animation: none;
    background-position: 30% center;
  }
}

/* ---------- 11. BACK-TO-TOP & TOAST ---------------------------------- */
.to-top {
  position: fixed;
  right: 1.3rem; bottom: 1.3rem;
  z-index: 90;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s, transform .25s var(--ease), visibility .25s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--primary); color: var(--primary); }
.to-top svg { width: 19px; height: 19px; }

.toast-stack {
  position: fixed;
  bottom: 1.3rem; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: .5rem;
  width: min(92vw, 400px);
}
.toast {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  font-size: .91rem;
  animation: toast-in .3s var(--ease);
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.toast--success svg { color: var(--success); }
.toast--error svg { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- 12. ABOUT PAGE ------------------------------------------- */
.page-header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: clamp(2.6rem, 6vw, 4.2rem) 0;
  text-align: center;
}
.page-header .lede { max-width: 60ch; margin-inline: auto; }

.breadcrumb { font-size: .84rem; color: var(--text-subtle); margin-bottom: .9rem; }
.breadcrumb a { color: var(--text-subtle); }
.breadcrumb a:hover { color: var(--primary); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 2rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding-bottom: 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute; left: calc(-2rem - 7px); top: .45rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--bg);
}
.timeline .when {
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  color: var(--primary); letter-spacing: .04em;
}
.timeline h3 { margin: .2rem 0 .3rem; font-size: 1.05rem; }
.timeline p { font-size: .93rem; margin-bottom: 0; }

.value-card { display: flex; gap: 1rem; align-items: flex-start; }
.value-card .n {
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  color: var(--primary); background: var(--primary-soft);
  border-radius: 7px; padding: .3rem .55rem; flex: none;
}

/* ---------- 13. LEARN PAGE ------------------------------------------- */
.toolbar {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search-field { position: relative; flex: 1 1 260px; min-width: 0; }
.search-field svg {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-subtle); pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: .68rem 1rem .68rem 2.5rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.search-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

select.control {
  padding: .68rem 2rem .68rem .85rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chip {
  padding: .5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: .87rem; font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.result-count { font-size: .88rem; color: var(--text-subtle); margin-bottom: 1.2rem; }

.track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  text-align: left;
  padding: 0;
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s, border-color .2s;
}
.track-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* the "cover image" is drawn with CSS — no image files anywhere */
.track-cover {
  height: 128px;
  position: relative;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1, #1d4ed8), var(--c2, #7c3aed));
  color: #fff;
  font-family: var(--mono); font-size: 1.55rem; font-weight: 700;
  overflow: hidden;
}
.track-cover::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 22px 22px;
}
.track-cover span { position: relative; z-index: 1; }
.track-body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.track-body h3 { margin: 0; font-size: 1.06rem; }
.track-body p { font-size: .9rem; margin: 0; flex: 1; }
.track-meta {
  display: flex; align-items: center; gap: .9rem;
  font-size: .82rem; color: var(--text-subtle);
  padding-top: .7rem; border-top: 1px solid var(--border);
}
.track-meta span { display: flex; align-items: center; gap: .3rem; }
.track-meta svg { width: 14px; height: 14px; }

.empty {
  display: none;
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}
.empty.is-shown { display: block; }
.empty svg { width: 42px; height: 42px; color: var(--text-subtle); margin: 0 auto .9rem; }

/* modal */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: none;
  place-items: center;
  padding: 1.2rem;
  background: rgba(6, 12, 24, .62);
  backdrop-filter: blur(5px);
}
.modal.is-open { display: grid; }
.modal-panel {
  position: relative;
  width: min(100%, 680px);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in .3s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.modal-close {
  position: absolute; top: .9rem; right: .9rem; z-index: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.modal-body { padding: 1.6rem 1.7rem 1.9rem; }

.spec-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.spec-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .91rem;
}
.spec-list li:last-child { border-bottom: none; }
.spec-list .k { color: var(--text-muted); }
.spec-list .v { font-weight: 600; text-align: right; }

.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.check-list li { display: flex; gap: .6rem; font-size: .92rem; color: var(--text-muted); }
.check-list svg { width: 17px; height: 17px; color: var(--success); flex: none; margin-top: 3px; }

/* ---------- 14. BLOG & POST ------------------------------------------ */
.post-list { display: flex; flex-direction: column; gap: 1.2rem; }

.post-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .28s var(--ease), box-shadow .28s, border-color .2s;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }

/* featured "image", generated from the post's own initials + colour */
.post-thumb {
  position: relative;
  display: grid; place-items: center;
  min-height: 150px;
  background: linear-gradient(135deg, var(--c1, #1d4ed8), var(--c2, #7c3aed));
  color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 1.5rem;
  overflow: hidden;
}
.post-thumb::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 20px 20px;
}
.post-thumb span { position: relative; z-index: 1; }

.post-body { padding: 1.3rem 1.5rem 1.4rem; display: flex; flex-direction: column; gap: .55rem; }
.post-body h3 { margin: 0; font-size: 1.14rem; }
.post-body h3 a { color: var(--text); }
.post-body h3 a:hover { color: var(--primary); text-decoration: none; }
.post-body p { font-size: .92rem; margin: 0; }
.post-meta { display: flex; align-items: center; gap: .8rem; font-size: .82rem; color: var(--text-subtle); flex-wrap: wrap; }
.post-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }

.pagination { display: flex; justify-content: center; align-items: center; gap: .35rem; margin-top: 2.5rem; flex-wrap: wrap; }
.page-btn {
  min-width: 40px; height: 40px;
  padding: 0 .7rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .9rem; font-weight: 500;
  cursor: pointer;
  transition: all .18s;
}
.page-btn:hover:not([disabled]):not([aria-current="true"]) { border-color: var(--primary); color: var(--primary); }
.page-btn[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.page-btn[disabled] { opacity: .4; cursor: not-allowed; }

/* article */
.article { max-width: 72ch; margin-inline: auto; }
.article-hero { margin-bottom: 2rem; }
.article-hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.7rem); }
.article-cover {
  height: clamp(160px, 26vw, 260px);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1, #1d4ed8), var(--c2, #7c3aed));
  color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: clamp(2rem, 6vw, 3.4rem);
  position: relative; overflow: hidden;
}
.article-cover::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 26px 26px;
}
.article-cover span { position: relative; z-index: 1; }

.prose { font-size: 1.03rem; line-height: 1.78; }
.prose h2 { font-size: 1.42rem; margin: 2.2rem 0 .8rem; }
.prose h3 { font-size: 1.12rem; margin: 1.8rem 0 .6rem; }
.prose p  { color: var(--text-muted); }
.prose ul, .prose ol { color: var(--text-muted); padding-left: 1.3rem; display: flex; flex-direction: column; gap: .45rem; margin: 0 0 1.05em; }
.prose blockquote {
  margin: 1.6rem 0;
  padding: .9rem 1.3rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-size: 1rem;
}
.prose blockquote p { color: var(--text); margin: 0; }

.share { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 2.5rem 0; padding: 1.1rem 0; border-block: 1px solid var(--border); }
.share span { font-size: .88rem; font-weight: 600; }

.comments { margin-top: 3rem; }
.comment {
  display: flex; gap: .9rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-of-type { border-bottom: none; }
.comment-body .name { font-weight: 650; font-size: .93rem; }
.comment-body .when { font-size: .8rem; color: var(--text-subtle); margin-left: .5rem; }
.comment-body p { font-size: .93rem; margin: .3rem 0 0; }

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

/* ---------- 15. CONTACT & FORMS -------------------------------------- */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(1.6rem, 4vw, 3rem); align-items: start; }

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .89rem; font-weight: 600; margin-bottom: .35rem; }
.form-group .req { color: var(--danger); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .75rem .95rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
.form-group textarea { resize: vertical; min-height: 140px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-group input[aria-invalid="true"],
.form-group textarea[aria-invalid="true"],
.form-group select[aria-invalid="true"] { border-color: var(--danger); }
.form-group input[aria-invalid="true"]:focus,
.form-group textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }

.field-error {
  display: none;
  align-items: center; gap: .35rem;
  font-size: .83rem; color: var(--danger);
  margin-top: .35rem;
}
.field-error.is-shown { display: flex; }
.field-hint { font-size: .82rem; color: var(--text-subtle); margin-top: .3rem; }

.form-msg {
  display: none;
  align-items: flex-start; gap: .6rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .91rem;
  margin-bottom: 1.2rem;
}
.form-msg.is-shown { display: flex; }
.form-msg--success { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 30%, transparent); }
.form-msg--error   { background: var(--danger-soft);  color: var(--danger);  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.form-msg svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.info-item { display: flex; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.info-item:last-child { border-bottom: none; }
.info-item .feature-icon { width: 40px; height: 40px; margin: 0; border-radius: 10px; }
.info-item .k { font-size: .8rem; color: var(--text-subtle); }
.info-item .v { font-weight: 600; font-size: .95rem; }

.map-embed {
  height: 220px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  display: grid; place-items: center;
  text-align: center;
  padding: 1.2rem;
  color: var(--text-subtle);
  font-size: .88rem;
}

/* ---------- 16. FAQ ACCORDION ---------------------------------------- */
.faq { max-width: 780px; margin-inline: auto; display: flex; flex-direction: column; gap: .7rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-q {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.2rem;
  background: none; border: none;
  text-align: left;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.faq-q:hover { background: var(--surface-2); }
.faq-q svg { width: 18px; height: 18px; flex: none; color: var(--text-subtle); transition: transform .3s var(--ease); }
.faq-q[aria-expanded="true"] svg { transform: rotate(180deg); color: var(--primary); }
/* animating grid-template-rows 0fr → 1fr is the modern "slide open" */
.faq-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s var(--ease); }
.faq-q[aria-expanded="true"] + .faq-a { grid-template-rows: 1fr; }
.faq-a > div { overflow: hidden; }
.faq-a p { padding: 0 1.2rem 1.15rem; font-size: .94rem; margin: 0; }

/* ---------- 17. RESPONSIVE -------------------------------------------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.8rem; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .nav-toggle { display: grid; }
  .nav-menu {
    position: absolute;
    top: var(--header-h); left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .1rem;
    padding: .7rem var(--gutter) 1.1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
  }
  .nav-menu.is-open { display: flex; }
  .nav-link { padding: .75rem .9rem; }
  /* dropdowns become plain nested lists on mobile */
  .dropdown {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: none;
    padding: 0 0 .3rem 1rem;
    min-width: 0;
    display: none;
  }
  .has-dropdown.is-open .dropdown { display: block; }
  .post-card { grid-template-columns: 1fr; }
  .post-thumb { min-height: 118px; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 1.5rem; }
}

@media (max-width: 480px) {
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

/* ---------- 18. MOTION & PRINT ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .to-top, .toast-stack, .newsletter, .toolbar { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .post-card { box-shadow: none; border: 1px solid #ccc; }
  a::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}

/* ===================================================================
   19. LESSONS, PRACTICE AREA AND STUDY HELPER

   All three use the variables from section 1, so they follow dark
   mode automatically without a single duplicated rule.
   =================================================================== */

/* ---- lesson page ---- */
.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 2.5rem;
  align-items: start;
}
.lesson-body { max-width: 44rem; font-size: 1.02rem; line-height: 1.75; }
.lesson-body h3 {
  margin: 2rem 0 .7rem; font-size: 1.14rem; color: var(--text);
  padding-bottom: .35rem; border-bottom: 1px solid var(--border);
}
.lesson-body p  { margin-bottom: 1rem; }
.lesson-body ul, .lesson-body ol { margin: 0 0 1.1rem 1.2rem; }
.lesson-body li { margin-bottom: .45rem; }
.lesson-body pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: .95rem 1.1rem; overflow-x: auto; margin-bottom: 1.1rem;
}
.lesson-body pre code { font-family: var(--mono); font-size: .88rem; line-height: 1.6; }
.lesson-body blockquote {
  margin: 0 0 1.2rem; padding: .9rem 1.1rem;
  background: var(--primary-soft); border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.lesson-body blockquote p:last-child { margin-bottom: 0; }

.lesson-side {
  position: sticky; top: 5.5rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
}
.side-title { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
              color: var(--text-subtle); margin-bottom: .8rem; }
.lesson-list { list-style: none; margin: 0 0 1.1rem; padding: 0; counter-reset: ls; }
.lesson-list li { counter-increment: ls; margin-bottom: .5rem; }
.lesson-list a {
  display: block; font-size: .9rem; line-height: 1.4;
  padding: .45rem .6rem .45rem 1.9rem; position: relative;
  border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
}
.lesson-list a::before {
  content: counter(ls); position: absolute; left: .6rem; top: .45rem;
  font-size: .78rem; color: var(--text-subtle); font-variant-numeric: tabular-nums;
}
.lesson-list a:hover { background: var(--surface); color: var(--text); }
.lesson-list .is-current a {
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.lesson-list .is-current a::before { color: var(--primary); }

.lesson-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem;
  padding-top: 1.5rem; border-top: 1px solid var(--border);
}
.lesson-counter { color: var(--text-subtle); font-size: .9rem;
                  font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { position: static; order: -1; }
}

/* ---- practice area ---- */
.challenge-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.6rem;
}
.play-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start;
}
.play-pane {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
}
.pane-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: .7rem;
}
.pane-title { font-weight: 700; }
.pane-lang {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft);
  padding: .18rem .55rem; border-radius: 999px;
}
.challenge-task { font-size: .93rem; color: var(--text-muted); margin-bottom: .8rem; }

#codeInput {
  width: 100%; min-height: 270px; resize: vertical;
  font-family: var(--mono); font-size: .89rem; line-height: 1.6;
  padding: .9rem; tab-size: 2;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
#codeInput:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.play-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }

.play-output {
  min-height: 270px; margin: 0;
  font-family: var(--mono); font-size: .89rem; line-height: 1.6;
  padding: .9rem; white-space: pre-wrap; word-break: break-word;
  background: #0f1b2d; color: #d7e2f5;
  border-radius: var(--radius-sm); overflow: auto;
}

.hint-box {
  display: none; margin-top: .8rem; padding: .75rem .9rem;
  font-size: .9rem; line-height: 1.55;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.hint-box.show { display: block; }

.check-result { margin-top: .8rem; font-size: .92rem; font-weight: 600; min-height: 1.2rem; }
.check-result.is-pass { color: var(--success); }
.check-result.is-fail { color: var(--danger); }

.play-note {
  margin-top: 2.2rem; padding: 1.4rem 1.6rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 52rem;
}
.play-note h2 { font-size: 1.05rem; margin-bottom: .6rem; }
.play-note p  { font-size: .94rem; color: var(--text-muted); margin-bottom: .7rem; }
.play-note p:last-child { margin-bottom: 0; }

@media (max-width: 860px) { .play-grid { grid-template-columns: 1fr; } }

/* ---- study helper ---- */
.helper-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff; border: 0;
  font-size: 1.5rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 26px var(--primary-ring);
  transition: transform .2s ease;
}
.helper-fab:hover { transform: scale(1.07); }
.helper-fab:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 3px; }

.helper-panel {
  position: fixed; right: 20px; bottom: 84px; z-index: 900;
  width: min(370px, calc(100vw - 40px));
  max-height: min(560px, calc(100vh - 130px));
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(15, 27, 45, .26);
  overflow: hidden;
}
.helper-panel[hidden] { display: none; }

.helper-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .8rem; padding: .85rem 1rem;
  background: var(--primary-soft); border-bottom: 1px solid var(--border);
}
.helper-sub { display: block; font-size: .74rem; color: var(--text-muted); margin-top: .1rem; }
.helper-x {
  background: none; border: 0; font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--text-muted); padding: 0 .2rem;
}
.helper-x:hover { color: var(--text); }

.helper-log { flex: 1; overflow-y: auto; padding: .9rem 1rem; display: grid; gap: .7rem; }
.helper-msg {
  font-size: .89rem; line-height: 1.6;
  padding: .6rem .8rem; border-radius: var(--radius-sm); max-width: 92%;
}
.helper-msg code {
  font-family: var(--mono); font-size: .85em;
  background: rgba(127, 145, 175, .18); padding: .08em .35em; border-radius: 4px;
}
.helper-msg--you {
  justify-self: end; background: var(--primary); color: #fff;
}
.helper-msg--bot { justify-self: start; background: var(--surface-2); border: 1px solid var(--border); }
.helper-link { display: inline-block; margin-top: .2rem; font-weight: 600; }

.helper-chips {
  display: flex; gap: .35rem; flex-wrap: wrap;
  padding: .6rem 1rem; border-top: 1px solid var(--border);
  max-height: 96px; overflow-y: auto;
}
.helper-chip {
  font: inherit; font-size: .78rem; cursor: pointer;
  padding: .28rem .6rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.helper-chip:hover { border-color: var(--primary); color: var(--primary); }

.helper-form {
  display: flex; gap: .4rem; padding: .7rem 1rem;
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.helper-form input {
  flex: 1; min-width: 0; font: inherit; font-size: .88rem;
  padding: .45rem .7rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.helper-form input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

@media print { .helper-fab, .helper-panel { display: none !important; } }

/* ---- practice mode switch, web builder and free build ------------- */
.mode-switch {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .6rem; margin-bottom: 1.6rem;
}
.mode-tab {
  text-align: left; font: inherit; cursor: pointer;
  padding: .8rem 1rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--border-strong);
  color: var(--text-muted);
  transition: border-color .2s ease, transform .2s ease;
}
.mode-tab strong { display: block; color: var(--text); font-size: .98rem; }
.mode-tab span   { display: block; font-size: .8rem; margin-top: .15rem; }
.mode-tab:hover  { transform: translateY(-2px); border-color: var(--border-strong); }
.mode-tab[aria-selected="true"] {
  border-top-color: var(--primary);
  background: var(--primary-soft);
}
.mode-tab[aria-selected="true"] strong { color: var(--primary); }

.template-bar, .pro-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.2rem;
}
.tb-label { font-size: .82rem; color: var(--text-subtle);
            letter-spacing: .08em; text-transform: uppercase; }
.save-state { font-size: .82rem; color: var(--text-subtle); margin-left: auto; }

.file-tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.file-tab {
  font: inherit; font-family: var(--mono); font-size: .78rem; cursor: pointer;
  padding: .3rem .65rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0;
  color: var(--text-subtle);
}
.file-tab.is-on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

#webInput, #proInput {
  width: 100%; min-height: 300px; resize: vertical;
  font-family: var(--mono); font-size: .87rem; line-height: 1.6;
  padding: .9rem; tab-size: 2;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 0 var(--radius-sm) var(--radius-sm) var(--radius-sm);
}
#webInput:focus, #proInput:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

#preview, #proPreview {
  width: 100%; height: 300px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff;
}

.play-output--short { min-height: 96px; max-height: 150px; margin-top: .8rem; }

.auto-run {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .84rem; color: var(--text-muted); cursor: pointer;
}

.pro-note {
  margin-top: 1.2rem; font-size: .9rem; color: var(--text-muted);
  max-width: 52rem; line-height: 1.6;
}

@media (max-width: 860px) {
  #preview, #proPreview { height: 240px; }
}

/* ---- big landscape preview -----------------------------------------

   The preview is now stacked ABOVE the editor and spans the full width
   of the container, because that is the shape a web page actually is.
   Side by side gave it a narrow square, which is the one shape no
   website is.
   -------------------------------------------------------------------- */
.play-stack { display: grid; gap: 1.4rem; }

.preview-pane { padding: 1rem 1.1rem 1.1rem; }

.preview-tools {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.size-switch {
  display: inline-flex; border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden; background: var(--surface-2);
}
.size-btn {
  font: inherit; font-size: .76rem; cursor: pointer;
  padding: .28rem .7rem; border: 0; background: none; color: var(--text-muted);
}
.size-btn + .size-btn { border-left: 1px solid var(--border); }
.size-btn:hover { color: var(--text); }
.size-btn.is-on { background: var(--primary); color: #fff; font-weight: 600; }

/* The frame wrapper is what gets tall. 62vh keeps it landscape on a
   laptop without pushing the editor off the bottom of the screen. */
.preview-frame {
  height: clamp(360px, 62vh, 720px);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
}
.preview-frame.is-narrow {
  display: flex; justify-content: center;
  background: var(--surface-2);
  padding: 0;
}
#preview, #proPreview {
  width: 100%; height: 100%;
  border: 0; border-radius: 0; background: #fff;
  display: block;
}
.preview-frame.is-narrow > iframe {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 40px rgba(15, 27, 45, .12);
}

/* Real fullscreen, and the fallback for when the browser blocks it. */
.preview-pane:fullscreen {
  padding: 1rem; background: var(--bg); display: flex; flex-direction: column;
}
.preview-pane:fullscreen .preview-frame { flex: 1; height: auto; }

.preview-pane.is-faux-fs {
  position: fixed; inset: 0; z-index: 950;
  margin: 0; border-radius: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding: 1rem;
}
.preview-pane.is-faux-fs .preview-frame { flex: 1; height: auto; }

/* Under the preview the editor and console sit side by side, and the
   console no longer needs to be short since it has its own pane. */
.play-stack .play-output { min-height: 300px; }

@media (max-width: 860px) {
  .preview-frame { height: clamp(300px, 52vh, 520px); }
  .play-stack .play-output { min-height: 180px; }
}

/* ---------- ADA (chat tutor) --------------------------------------- */
.ada-log {
  display: flex; flex-direction: column; gap: .7rem;
  max-height: 46vh; overflow-y: auto;
  margin-bottom: 1rem; padding-right: .3rem;
}
.ada-bubble {
  max-width: 82%; padding: .7rem 1rem; border-radius: var(--radius-sm);
  font-size: .93rem; line-height: 1.5; white-space: pre-wrap;
}
.ada-bubble--bot {
  align-self: flex-start;
  background: var(--bg-alt); border: 1px solid var(--border);
}
.ada-bubble--user {
  align-self: flex-end;
  background: var(--primary); color: #fff;
}
.ada-bubble--error {
  align-self: flex-start;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent);
}
.ada-form { display: flex; gap: .6rem; align-items: flex-end; }
.ada-form textarea {
  flex: 1; resize: none; font: inherit;
  padding: .65rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.ada-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
