:root {
  --ink: #0e1820;
  --muted: #3a4c56;
  --paper: #eef3f1;
  --panel: #ffffff;
  --teal: #0f6b6d;
  --teal-deep: #08383a;
  --moss: #1a8a7a;
  --line: #c5d5cf;
  --warm: #fff6e8;
  --gold: #c4a35a;
  --win-night: #071018;
  --win-glow: #3dd6c6;
  --win-mist: #9eb8b4;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.2rem;
  scroll-padding-bottom: 5.6rem;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, #cfeceb 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #dfece6 0%, transparent 48%),
    linear-gradient(180deg, #f7faf8 0%, var(--paper) 40%);
  line-height: 1.7;
}

:focus-visible {
  outline: 3px solid var(--teal-deep);
  outline-offset: 3px;
}

.btn:focus-visible,
.fh-dock button:focus-visible,
.fh-swatch:focus-visible {
  outline-color: #e7c98a;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media { animation: none !important; }
  .btn, .lesson-tile, .hall-card { transition: none !important; }
}

body.windows-lab {
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(61, 214, 198, 0.14) 0%, transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(15, 107, 109, 0.18) 0%, transparent 50%),
    linear-gradient(180deg, #f4f8f7 0%, #e8efed 55%, #eef3f1 100%);
}

a { color: var(--teal); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: var(--teal-deep);
  color: #fff;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  z-index: 50;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { left: 0.75rem; }

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.15rem 3.5rem;
}

.wrap.wide {
  max-width: 68rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(238, 243, 241, 0.9);
  border-bottom: 1px solid var(--line);
}

.windows-lab .site-header {
  background: rgba(7, 16, 24, 0.78);
  border-bottom-color: rgba(61, 214, 198, 0.18);
}

.windows-lab .site-header .brand,
.windows-lab .site-header .brand-domain { color: #e8f5f2; }
.windows-lab .site-header .nav a { color: var(--win-mist); }
.windows-lab .site-header .nav a:hover { color: var(--win-glow); }

.header-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.75rem 1.15rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.brand {
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--teal-deep);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: block;
}

.brand-domain {
  color: var(--moss);
  font-weight: 600;
  font-size: 0.9rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.nav a:hover { color: var(--teal); }

.badge {
  display: inline-block;
  background: #e3f4f1;
  color: var(--teal-deep);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 1.4rem 0 0.6rem;
}

.windows-lab .badge {
  background: rgba(61, 214, 198, 0.16);
  color: #0a3d3f;
}

h1, h2, h3 {
  font-family: Fraunces, Georgia, serif;
  color: var(--teal-deep);
  line-height: 1.18;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  margin: 0.35rem 0 0.75rem;
}

h2 {
  font-size: 1.4rem;
  margin: 1.9rem 0 0.55rem;
}

h3 {
  font-size: 1.12rem;
  margin: 1.4rem 0 0.4rem;
}

.lede {
  font-size: 1.2rem;
  color: #24343c;
  max-width: 62ch;
  margin: 0 0 1.25rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.2rem 0 1.8rem;
}

.btn {
  display: inline-block;
  background: var(--teal-deep);
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(8, 56, 58, 0.22);
}

.btn.secondary {
  background: transparent;
  color: var(--teal-deep) !important;
  border: 2px solid var(--teal);
}

.windows-lab .btn {
  background: linear-gradient(135deg, #0a4547, #0f6b6d);
}

.windows-lab .btn.secondary {
  background: rgba(255, 255, 255, 0.65);
  border-color: var(--teal);
}

/* —— Windows hero —— */
.hero {
  position: relative;
  height: clamp(220px, 42vh, 420px);
  min-height: 0;
  display: grid;
  align-items: end;
  color: #f3fbf9;
  overflow: hidden;
  margin-bottom: 1.6rem;
}

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 18% 42%;
  display: block;
  transform: scale(1.02);
  animation: heroDrift 28s ease-in-out infinite alternate;
}

@keyframes heroDrift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.06) translate3d(-1.5%, -1%, 0); }
}

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 16, 24, 0.25) 0%, rgba(7, 16, 24, 0.55) 45%, rgba(7, 16, 24, 0.92) 100%),
    radial-gradient(600px 300px at 80% 20%, rgba(61, 214, 198, 0.22), transparent 60%);
}

.hero-veil-light {
  background:
    linear-gradient(180deg, rgba(7, 16, 24, 0.12) 0%, rgba(7, 16, 24, 0.18) 70%, rgba(7, 16, 24, 0.45) 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 68rem;
  margin: 0 auto;
  padding: 3.5rem 1.15rem 2.75rem;
}

.hero-copy .badge {
  margin-top: 0;
  background: rgba(61, 214, 198, 0.18);
  color: #d7fff8;
}

.hero-copy h1 {
  color: #f7fffd;
  max-width: 14ch;
  text-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.hero-copy .lede {
  color: #c5ddd8;
  max-width: 40ch;
}

.hero-copy .btn.secondary {
  background: transparent;
  color: #e8f5f2 !important;
  border-color: rgba(232, 245, 242, 0.55);
}

.ornament {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

/* —— Chapters & lesson rails —— */
.chapter {
  margin: 2.75rem 0 1.25rem;
}

.chapter-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
}

.chapter-banner img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  display: block;
  box-shadow: 0 18px 40px rgba(8, 56, 58, 0.14);
}

.chapter-banner .copy h2 {
  margin-top: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.chapter-banner .copy p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 38ch;
}

.lesson-rail {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 1rem;
}

.lesson-tile {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(201, 216, 211, 0.9);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
  min-height: 100%;
}

.lesson-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(8, 56, 58, 0.14);
  border-color: rgba(15, 107, 109, 0.35);
}

.lesson-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.lesson-tile .tile-body {
  padding: 0.95rem 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.lesson-tile .level {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--moss);
}

.lesson-tile strong {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.12rem;
  color: var(--teal-deep);
  line-height: 1.25;
}

.lesson-tile span {
  color: var(--muted);
  font-size: 0.92rem;
}

.motif-strip {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 16px;
  margin: 2rem 0 0.5rem;
  display: block;
  opacity: 0.92;
}

.lesson-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
}

.lesson-list li {
  border-top: 1px solid var(--line);
  padding: 0.95rem 0;
}

.lesson-list li:last-child { border-bottom: 1px solid var(--line); }

.lesson-list a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.lesson-list a:hover strong { color: var(--teal); }

.lesson-list strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.15rem;
  color: var(--teal-deep);
  margin-bottom: 0.2rem;
}

.lesson-list span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.track-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moss);
  margin: 2rem 0 0.35rem;
}

.track-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  max-width: 40ch;
}

/* —— Lesson article —— */
.lesson-hero {
  margin: 0 0 1.5rem;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(8, 56, 58, 0.16);
}

.lesson-hero img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.lesson-hero .hero-caption {
  margin: 0;
  padding: 0.75rem 1rem 0.95rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}

.windows-lab .lesson-hero .hero-caption {
  background: rgba(7, 16, 24, 0.92);
  color: #9eb8b4;
  border-top-color: rgba(61, 214, 198, 0.15);
}

.lesson-body {
  font-size: 1.125rem;
  line-height: 1.75;
  max-width: 66ch;
}

.lesson-body p { margin: 0 0 1.15rem; }

.lesson-body ul, .lesson-body ol {
  margin: 0 0 1.1rem;
  padding-left: 1.2rem;
}

.lesson-body li { margin: 0.35rem 0; }

.lesson-body .rule {
  background: var(--warm);
  border-left: 3px solid var(--gold);
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
}

.lesson-body .callout {
  background: #e7f4f1;
  border: 1px solid #b7d8d2;
  border-radius: 14px;
  padding: 0.95rem 1.05rem;
  margin: 1.25rem 0;
}

.lesson-body .callout strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  color: var(--teal-deep);
  margin-bottom: 0.25rem;
}

.figure {
  margin: 1.4rem 0 1.6rem;
}

.figure img {
  width: 100%;
  border-radius: 14px;
  display: block;
  box-shadow: 0 12px 28px rgba(8, 56, 58, 0.12);
}

.figure figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.lesson-body pre,
.lesson-body code {
  font-family: "Cascadia Code", "Consolas", "Segoe UI Mono", monospace;
}

.lesson-body code {
  font-size: 0.92em;
  background: #e4eeea;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.lesson-body pre {
  background: linear-gradient(160deg, #0c171e 0%, #122028 100%);
  color: #e8f2ef;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1rem 0 1.25rem;
  font-size: 0.88rem;
  line-height: 1.45;
  border: 1px solid rgba(61, 214, 198, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.lesson-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.4rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.85rem 0.85rem 0.85rem 3.1rem;
  margin: 0.55rem 0;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.75rem;
  top: 0.85rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--teal-deep);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.disclaimer {
  background: var(--warm);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.windows-lab .site-footer {
  background: #071018;
  border-top-color: rgba(61, 214, 198, 0.15);
  color: #9eb8b4;
}

.windows-lab .site-footer a { color: #c5ddd8; }
.windows-lab .site-footer a:hover { color: var(--win-glow); }

.site-footer .wrap { padding-bottom: 0; max-width: 68rem; }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover { color: var(--teal); }

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stat-row strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
  color: var(--teal-deep);
  line-height: 1.1;
}

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

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr));
  gap: 1rem;
  margin: 0.4rem 0 2rem;
}

.lib-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.lib-card .badge { margin: 0 0 0.45rem; }

.lib-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
}

.lib-card p { margin: 0 0 0.7rem; }

.lib-card details { margin: 0 0 0.8rem; }

.lib-card summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--teal-deep);
}

.lib-card summary:hover { color: var(--teal); }

.lib-card ul {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
}

.lib-card .btn { margin-top: auto; align-self: flex-start; }

.lib-card.queued { background: transparent; }

.reading { max-width: 40rem; }

@media (max-width: 640px) {
  .header-inner { align-items: flex-start; }
  .hero { height: 220px; }
}
