:root {
  --color-brand-50: 239 243 255;
  --color-brand-100: 219 228 255;
  --color-brand-200: 187 204 255;
  --color-brand-500: 45 83 210;
  --color-brand-600: 31 67 190;
  --color-brand-700: 25 52 151;
  --color-brand-800: 25 45 116;
  --color-brand-900: 24 38 86;
  --paper: #f5f3ee;
  --surface: #fffefa;
  --surface-muted: #ebe9e2;
  --ink: #171b24;
  --muted: #5e6470;
  --faint: #8b8f98;
  --line: #d7d4cc;
  --line-strong: #a6a49e;
  --accent: #1f43be;
  --accent-dark: #183486;
  --accent-soft: #e7ecff;
  --success: #197047;
  --warning: #9a5b08;
  --danger: #a63d31;
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #cbd7ff; color: var(--ink); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
img { max-width: 100%; }

/* Small local utility set used by Django partials and the collapse controller. */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.object-cover { object-fit: cover; }
.size-8 { width: 2rem; height: 2rem; }
.size-10 { width: 2.5rem; height: 2.5rem; }
.size-16 { width: 4rem; height: 4rem; }
.size-20 { width: 5rem; height: 5rem; }
.text-xs { font-size: 0.75rem; }
.text-base { font-size: 1rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; margin: -1px; padding: 0; border: 0; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.transition-all { transition: all 300ms ease; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid transparent; background-clip: padding-box; }

.page-shell {
  width: min(100% - 2rem, 76rem);
  margin-inline: auto;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow-light { color: #b8c8ff; }
.muted-copy { color: var(--muted); }

/* Site shell */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 243, 238, 0.94);
  backdrop-filter: blur(14px);
}

.site-nav {
  display: flex;
  width: min(100% - 2rem, 76rem);
  min-height: 4.75rem;
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand { display: inline-flex; align-items: center; gap: 0.65rem; white-space: nowrap; }
.brand-symbol {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  background: var(--accent);
  color: white;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
}
.brand-name { font-size: 1.12rem; font-weight: 700; letter-spacing: -0.035em; }
.brand-edition {
  margin-left: 0.15rem;
  color: var(--faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-links { display: flex; align-items: center; gap: 1.7rem; }
.nav-links > a:not(.nav-cta), .nav-text-button {
  color: #30343d;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 160ms ease;
}
.nav-links > a:not(.nav-cta):hover, .nav-text-button:hover { color: var(--accent); }
.nav-text-button { border: 0; padding: 0; background: none; cursor: pointer; }
.nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: 2.45rem;
  border: 1px solid var(--ink);
  padding: 0.45rem 0.95rem;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease;
}
.nav-cta:hover { background: var(--ink); color: white; }
.nav-profile { display: inline-flex; align-items: center; gap: 0.65rem; }
.nav-toggle { display: inline-flex; width: 2.6rem; height: 2.6rem; flex-direction: column; align-items: center; justify-content: center; gap: 0.38rem; border: 1px solid var(--line-strong); background: transparent; }
.nav-toggle span { width: 1.1rem; height: 1px; background: var(--ink); }

.avatar { border: 1px solid var(--line-strong); border-radius: 50%; }
.avatar-fallback { background: var(--accent-soft); color: var(--accent-dark); font-family: "IBM Plex Mono", monospace; font-weight: 600; }

.message-stack { position: relative; z-index: 20; width: min(100% - 2rem, 76rem); margin: 1rem auto 0; }
.site-message { display: flex; align-items: center; gap: 0.7rem; border: 1px solid #adc6b8; background: #edf7f0; padding: 0.8rem 1rem; color: #205e3f; font-size: 0.88rem; }

.site-footer { margin-top: 7rem; border-top: 1px solid var(--line-strong); }
.footer-grid { display: grid; width: min(100% - 2rem, 76rem); margin-inline: auto; grid-template-columns: 1fr 1.25fr; gap: 5rem; padding: 4.5rem 0; }
.footer-intro > p { max-width: 24rem; margin: 1.5rem 0 0; color: var(--muted); font-size: 0.92rem; }
.footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.footer-links > div { display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; }
.footer-label { margin: 0 0 0.55rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.footer-links a, .footer-links span { color: var(--muted); font-size: 0.87rem; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { display: flex; width: min(100% - 2rem, 76rem); margin-inline: auto; justify-content: space-between; border-top: 1px solid var(--line); padding: 1.35rem 0 2rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; }

/* Controls */
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.btn-primary, .btn-secondary {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border: 1px solid var(--accent);
  padding: 0.72rem 1.15rem;
  font-size: 0.86rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.btn-secondary { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink); background: var(--ink); color: white; }
.text-link, .arrow-link { color: var(--ink); font-size: 0.86rem; font-weight: 700; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.28rem; transition: color 160ms ease, text-decoration-color 160ms ease; }
.text-link:hover, .arrow-link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.arrow-link { display: inline-flex; align-items: center; gap: 0.5rem; }
.arrow-link span { color: var(--accent); font-family: "IBM Plex Mono", monospace; }

/* Home */
.home-hero { padding: 6.75rem 0 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(19rem, 0.55fr); gap: 6rem; align-items: end; }
.hero-copy h1 {
  max-width: 13ch;
  margin: 1.5rem 0 0;
  font-family: "Lora", Georgia, serif;
  font-size: clamp(3.5rem, 7vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}
.hero-copy h1 em { color: var(--accent); font-weight: 500; }
.hero-aside { border-top: 2px solid var(--ink); padding-top: 1.5rem; }
.hero-aside > p { margin: 0; color: var(--muted); font-size: 1.06rem; line-height: 1.75; }
.hero-aside .button-row { margin-top: 2rem; }
.principle-row { display: grid; margin-top: 6.5rem; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.principle-row > div { display: grid; min-height: 8rem; grid-template-columns: 2.5rem 1fr; align-content: center; border-right: 1px solid var(--line); padding: 1.5rem 1.75rem; }
.principle-row > div:last-child { border-right: 0; }
.principle-row span { grid-row: 1 / span 2; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; }
.principle-row strong { font-size: 0.94rem; }
.principle-row small { margin-top: 0.25rem; color: var(--muted); font-size: 0.78rem; }

.content-section { padding-top: 7rem; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.65fr) auto; gap: 3rem; align-items: end; margin-bottom: 2.5rem; border-top: 1px solid var(--line-strong); padding-top: 1.5rem; }
.section-heading h2, .method-grid h2, .membership-section h2, .learning-brief h2, .course-prerequisites h2, .subsection-heading h2, .activity-section h2, .settings-header h1 {
  margin: 0.65rem 0 0;
  font-family: "Lora", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.12;
}
.section-heading h2 { max-width: 15ch; font-size: clamp(2rem, 3.5vw, 3rem); }
.section-heading > p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.compact-heading { grid-template-columns: minmax(0, 1fr) auto; }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.course-card { display: flex; min-width: 0; height: 100%; flex-direction: column; border: 1px solid var(--line); background: var(--surface); transition: border-color 180ms ease, transform 180ms ease; }
.course-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.course-card-image { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--paper); }
.course-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms ease; }
.course-card:hover .course-card-image img { transform: scale(1.015); }
.course-placeholder { display: flex; width: 100%; height: 100%; align-items: center; justify-content: space-between; border-left: 0.55rem solid var(--accent); padding: 1.5rem; background: var(--paper); color: var(--ink); }
.course-placeholder b { color: var(--accent); font-family: "Lora", serif; font-size: 2.5rem; font-weight: 500; }
.course-placeholder small { font-family: "IBM Plex Mono", monospace; font-size: 0.65rem; text-transform: uppercase; }
.course-card-body { display: flex; flex: 1; flex-direction: column; padding: 1.4rem 1.4rem 1.2rem; }
.course-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.75rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; }
.course-meta span + span::before { content: "·"; margin-right: 0.75rem; }
.course-meta strong { margin-left: auto; color: var(--accent); font-weight: 600; }
.course-card h3 { margin: 1rem 0 0; font-family: "Lora", Georgia, serif; font-size: 1.28rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.28; }
.course-card h3 a:hover { color: var(--accent); }
.course-card-body > p { display: -webkit-box; margin: 0.75rem 0 0; overflow: hidden; color: var(--muted); font-size: 0.84rem; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.course-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: auto; padding-top: 1.5rem; }
.course-card-footer > span { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; }

.method-section { margin-top: 7rem; background: #17213d; color: #f7f7f4; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8rem; padding-top: 6rem; padding-bottom: 6rem; }
.method-grid h2 { max-width: 12ch; font-size: clamp(2.5rem, 4.5vw, 4.3rem); }
.method-copy > p { margin: 0; color: #c6cbd8; font-size: 1.08rem; line-height: 1.8; }
.method-copy ul { margin: 2.5rem 0 0; padding: 0; list-style: none; }
.method-copy li { display: grid; grid-template-columns: 6rem 1fr; border-top: 1px solid rgba(255,255,255,.2); padding: 1rem 0; color: #dbe0eb; font-size: 0.9rem; }
.method-copy li span { color: #9eb5ff; font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }

.journal-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.journal-teaser { display: flex; min-height: 19rem; flex-direction: column; border-right: 1px solid var(--line); padding: 1.6rem 1.6rem 1.2rem 0; }
.journal-teaser + .journal-teaser { padding-left: 1.6rem; }
.journal-teaser:last-child { border-right: 0; }
.journal-teaser time { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; text-transform: uppercase; }
.journal-teaser h3 { margin: 1rem 0 0; font-family: "Lora", serif; font-size: 1.35rem; line-height: 1.3; }
.journal-teaser h3 a:hover { color: var(--accent); }
.journal-teaser p { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.65; }
.journal-teaser .arrow-link { margin-top: auto; padding-top: 1.5rem; }

.membership-section { display: grid; margin-top: 7rem; grid-template-columns: 1fr 0.85fr auto; align-items: end; gap: 4rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line-strong); padding-top: 2.5rem; padding-bottom: 2.5rem; }
.membership-section h2 { font-size: 2.5rem; }
.membership-section > p { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* Page intros and catalog */
.page-intro { padding-top: 6rem; padding-bottom: 4rem; border-bottom: 1px solid var(--line-strong); }
.page-intro-grid { display: grid; margin-top: 1.25rem; grid-template-columns: 1.2fr 0.65fr; gap: 6rem; align-items: end; }
.page-intro h1 { max-width: 12ch; margin: 0; font-family: "Lora", serif; font-size: clamp(3rem, 5.5vw, 5.4rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1; }
.page-intro-grid > p, .page-intro-grid > div > p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.75; }
.catalog-section, .journal-index { padding-top: 2rem; }
.catalog-toolbar, .index-rule { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; text-transform: uppercase; }
.catalog-toolbar p { margin: 0; }
.catalog-toolbar strong { color: var(--ink); }
.empty-state { grid-column: 1 / -1; border: 1px dashed var(--line-strong); padding: 3rem; color: var(--muted); text-align: center; }

/* Course detail */
.course-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(19rem, 0.65fr); gap: 6rem; padding-top: 4.5rem; padding-bottom: 5rem; }
.breadcrumb { display: flex; align-items: center; gap: 0.7rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.67rem; text-transform: uppercase; }
.breadcrumb a:hover { color: var(--accent); }
.course-detail-meta { display: flex; flex-wrap: wrap; gap: 0.65rem 1.1rem; margin-top: 2.2rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 0.67rem; text-transform: uppercase; }
.course-detail-meta > * + *::before { content: "/"; margin-right: 1.1rem; color: var(--line-strong); }
.course-detail-meta strong { color: var(--warning); }
.course-hero h1 { max-width: 14ch; margin: 1.5rem 0 0; font-family: "Lora", serif; font-size: clamp(3rem, 5vw, 5rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1.02; }
.course-subtitle { max-width: 42rem; margin: 1.5rem 0 0; color: #3e444f; font-size: 1.24rem; line-height: 1.65; }
.course-description { max-width: 45rem; margin-top: 1.75rem; color: var(--muted); }
.course-description p { margin: 0.7rem 0; }
.course-hero-copy .button-row { margin-top: 2.25rem; }
.course-facts { align-self: start; border: 1px solid var(--line-strong); background: var(--surface); }
.course-facts > img { display: block; width: 100%; aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); object-fit: cover; }
.course-facts dl { margin: 0; padding: 1.2rem 1.4rem; }
.course-facts dl > div { display: flex; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line); padding: 0.72rem 0; font-size: 0.84rem; }
.course-facts dl > div:last-child { border-bottom: 0; }
.course-facts dt { color: var(--muted); }
.course-facts dd { margin: 0; font-weight: 600; text-align: right; }
.fact-progress { border-top: 1px solid var(--line); padding: 1.2rem 1.4rem 1.4rem; }
.fact-progress > span, .fact-progress > strong { font-size: 0.78rem; }
.fact-progress > strong { float: right; color: var(--accent); }
.fact-progress .progress-track { margin-top: 0.6rem; }
.progress-track { height: 0.28rem; overflow: hidden; background: #dcdad4; }
.progress-fill { height: 100%; background: var(--accent); transition: width 400ms ease; }

.learning-brief { display: grid; grid-template-columns: 0.72fr 1.28fr; gap: 6rem; border-top: 1px solid var(--line-strong); padding-top: 4.5rem; padding-bottom: 4.5rem; }
.learning-brief h2 { max-width: 12ch; font-size: 2.75rem; }
.numbered-list { margin: 0; padding: 0; list-style: none; }
.numbered-list li { display: grid; grid-template-columns: 3rem 1fr; border-top: 1px solid var(--line); padding: 1rem 0; color: #3f4550; }
.numbered-list li:first-child { border-top-color: var(--line-strong); }
.numbered-list li span { color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; }
.course-prerequisites { display: grid; grid-template-columns: 0.45fr 0.55fr 1fr; gap: 3rem; border-top: 1px solid var(--line-strong); padding-top: 2.5rem; padding-bottom: 2.5rem; }
.course-prerequisites h2 { margin-top: 0; font-size: 2rem; }
.course-prerequisites ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.course-prerequisites li + li { margin-top: 0.5rem; }
.course-prerequisites > p:last-child { margin: 0; color: var(--muted); }

.curriculum-section { padding-top: 5rem; padding-bottom: 2rem; scroll-margin-top: 6rem; }
.curriculum-list { border-top: 1px solid var(--line-strong); }
.curriculum-module { border-bottom: 1px solid var(--line); }
.curriculum-toggle { display: grid; width: 100%; grid-template-columns: 3rem minmax(0, 1fr) auto 2rem; align-items: center; gap: 1rem; border: 0; background: transparent; padding: 1.35rem 0; color: var(--ink); text-align: left; cursor: pointer; }
.curriculum-toggle:hover .module-title { color: var(--accent); }
.module-number, .module-count { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.67rem; }
.module-title { font-family: "Lora", serif; font-size: 1.14rem; font-weight: 600; }
.module-plus { color: var(--accent); font-size: 1.4rem; font-weight: 400; transition: transform 180ms ease; }
.hs-accordion.active .module-plus { transform: rotate(45deg); }
.curriculum-content { overflow: hidden; }
.curriculum-content ol { margin: 0 0 1.25rem 4rem; padding: 0; border-left: 1px solid var(--line); list-style: none; }
.curriculum-content li { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: 1rem; align-items: center; border-bottom: 1px solid var(--line); padding: 0.85rem 1rem; color: var(--muted); font-size: 0.84rem; }
.curriculum-content li:last-child { border-bottom: 0; }
.curriculum-content a:hover { color: var(--accent); }
.lesson-index { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; }
.lesson-badges { display: flex; gap: 0.5rem; }
.status-label { display: inline-flex; border: 1px solid var(--line-strong); padding: 0.12rem 0.42rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 0.57rem; text-transform: uppercase; }
.status-label.warning { border-color: #d9b572; color: var(--warning); }
.status-label.complete { border-color: #8fbea5; color: var(--success); }
.empty-row { grid-template-columns: 1fr !important; }

/* Journal */
.journal-intro .search-form { margin-top: 2rem; }
.journal-intro-topline, .article-authoring-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.journal-intro-topline .btn-primary { min-height: 2.65rem; padding: 0.55rem 0.9rem; }
.search-form { display: flex; border-bottom: 1px solid var(--ink); }
.search-form input { min-width: 0; flex: 1; border: 0; background: transparent; padding: 0.75rem 0; color: var(--ink); font-size: 0.9rem; outline: none; }
.search-form button { border: 0; background: transparent; padding: 0.75rem 0 0.75rem 1rem; color: var(--accent); font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3rem 1.5rem; }
.post-card { min-width: 0; border-top: 1px solid var(--line-strong); padding-top: 1rem; }
.post-card-image { display: block; aspect-ratio: 16/10; overflow: hidden; margin-bottom: 1.2rem; background: var(--accent); }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms ease; }
.post-card:hover .post-card-image img { transform: scale(1.015); }
.post-card-image > span { display: grid; height: 100%; place-items: center; color: white; font-family: "Lora", serif; font-size: 5rem; }
.post-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; text-transform: uppercase; }
.post-meta a { color: var(--accent); }
.post-card h2 { margin: 0.85rem 0 0; font-family: "Lora", serif; font-size: 1.45rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.25; }
.post-card h2 a:hover { color: var(--accent); }
.post-card > p { margin: 0.75rem 0 1rem; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }
.post-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.2rem; }
.editor-link { display: inline-flex; align-items: center; border: 1px solid #b8c4e8; background: var(--accent-soft); padding: 0.38rem 0.62rem; color: var(--accent-dark); font-family: "IBM Plex Mono", monospace; font-size: 0.61rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.editor-link:hover { border-color: var(--accent); background: var(--accent); color: white; }

.article-page { padding-top: 4rem; }
.article-header { max-width: 62rem; }
.article-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 3rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; text-transform: uppercase; }
.article-meta a { color: var(--accent); }
.article-header h1 { max-width: 17ch; margin: 1rem 0 0; font-family: "Lora", serif; font-size: clamp(3rem, 5.3vw, 5.3rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1.03; }
.article-cover { margin-top: 3.5rem; }
.article-cover img { display: block; width: 100%; max-height: 42rem; border: 1px solid var(--line); object-fit: cover; }
.article-layout { display: grid; grid-template-columns: minmax(0, 47rem) minmax(15rem, 1fr); gap: 7rem; align-items: start; padding-top: 4rem; }
.article-sidebar { position: sticky; top: 7rem; display: grid; gap: 2.5rem; border-top: 1px solid var(--line-strong); padding-top: 1rem; }
.aside-label { margin: 0 0 1rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.article-sidebar ol { margin: 0; padding: 0; list-style: none; }
.article-sidebar li { border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
.article-sidebar li a { display: block; font-family: "Lora", serif; font-size: 0.88rem; font-weight: 600; line-height: 1.35; }
.article-sidebar li a:hover { color: var(--accent); }
.article-sidebar time { display: block; margin-top: 0.3rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; }
.topic-links { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.topic-links a, .article-tags a { border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 0.76rem; }
.topic-links a:hover, .article-tags a:hover { border-color: var(--accent); color: var(--accent); }
.article-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 4rem; border-top: 1px solid var(--line); padding-top: 1rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; }
.related-section { padding-top: 6rem; }

/* Blog comments */
.comments-section { padding-top: 6rem; }
.comment-list { max-width: 47rem; margin: 0 0 3.5rem; padding: 0; list-style: none; display: grid; gap: 1.75rem; }
.comment { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; }
.comment-avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-family: "IBM Plex Mono", monospace; font-weight: 700; font-size: 0.9rem; }
.comment-content { border-bottom: 1px solid var(--line); padding-bottom: 1.6rem; }
.comment:last-child .comment-content { border-bottom: 0; padding-bottom: 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.85rem; }
.comment-author { font-family: "Lora", serif; font-size: 1rem; font-weight: 700; color: var(--ink); }
.comment-head time { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; }
.comment-body { margin-top: 0.5rem; color: var(--ink); font-size: 0.95rem; line-height: 1.7; }
.comment-body p { margin: 0 0 0.6rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-empty { max-width: 47rem; margin: 0 0 3.5rem; color: var(--muted); font-family: "Lora", serif; font-style: italic; }
.comment-form-panel { max-width: 47rem; border-top: 1px solid var(--line-strong); padding-top: 2rem; }
.comment-note { margin: 0.35rem 0 1.6rem; color: var(--faint); font-size: 0.8rem; }
.comment-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 640px) { .comment-form-row { grid-template-columns: 1fr; } }

/* Rich text */
.article-prose { max-width: 46rem; color: #373d47; font-family: "DM Sans", sans-serif; font-size: 1.02rem; line-height: 1.86; }
.article-prose > * + * { margin-top: 1.15rem; }
.article-prose h2, .article-prose h3, .article-prose h4 { color: var(--ink); font-family: "Lora", Georgia, serif; font-weight: 600; letter-spacing: -0.025em; }
.article-prose h2 { margin-top: 3.3rem; font-size: 2rem; line-height: 1.25; }
.article-prose h3 { margin-top: 2.4rem; font-size: 1.45rem; line-height: 1.3; }
.article-prose h4 { margin-top: 1.8rem; font-size: 1.12rem; }
.article-prose strong { color: var(--ink); }
.article-prose a { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.article-prose ul, .article-prose ol { padding-left: 1.5rem; }
.article-prose li + li { margin-top: 0.45rem; }
.article-prose li::marker { color: var(--accent); }
.article-prose blockquote { margin: 2rem 0; border-left: 3px solid var(--accent); padding: 0.3rem 0 0.3rem 1.4rem; color: var(--muted); font-family: "Lora", serif; font-size: 1.1rem; font-style: italic; }
.article-prose hr { height: 1px; margin: 2.5rem 0; border: 0; background: var(--line); }
.article-prose table { width: 100%; margin: 1.7rem 0; border-collapse: collapse; font-size: 0.9rem; }
.article-prose th, .article-prose td { border: 1px solid var(--line); padding: 0.72rem 0.85rem; text-align: left; }
.article-prose th { background: var(--surface-muted); color: var(--ink); }
.article-prose pre { overflow: auto; margin: 1.6rem 0; border: 1px solid #2c3546; background: #111722; padding: 1.2rem 1.3rem; color: #e9edf5; line-height: 1.65; }
.article-prose code { font-family: "IBM Plex Mono", monospace; font-size: 0.88em; }
.article-prose p code, .article-prose li code, .article-prose td code { border: 1px solid #c9cfdf; background: #e9edf8; padding: 0.1rem 0.35rem; color: #233c8f; }
.article-prose img { height: auto; border: 1px solid var(--line); }
.article-prose figure { margin: 2rem 0; }
.article-prose figcaption, .article-prose .code-caption { margin: 0.55rem 0 0; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; }
.article-prose .code-caption { margin-bottom: -1.1rem; text-transform: uppercase; }
.article-prose blockquote cite { display: block; margin-top: 0.7rem; color: var(--faint); font-family: "DM Sans", sans-serif; font-size: 0.78rem; font-style: normal; }
.article-callout { margin: 2rem 0; border: 1px solid #bdc9eb; border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 1.25rem 1.4rem; }
.article-callout strong { display: block; margin-bottom: 0.35rem; color: var(--accent-dark); font-size: 0.82rem; }
.article-callout p { margin: 0; }

/* Article studio */
.composer-body .site-header, .composer-body .site-footer { display: none; }
.editor-library { padding-top: 5rem; }
.editor-library-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 3rem; padding-bottom: 3rem; }
.editor-library-header h1 { margin: 0.7rem 0 0; font-family: "Lora", serif; font-size: clamp(2.8rem, 5vw, 4.8rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1; }
.editor-library-header div > p:last-child { margin: 1rem 0 0; color: var(--muted); }
.editor-post-list { border-top: 1px solid var(--line-strong); }
.editor-post-row { display: grid; grid-template-columns: minmax(0, 1fr) 8rem 12rem 4rem; gap: 1.5rem; align-items: center; border-bottom: 1px solid var(--line); padding: 1.1rem 0; }
.editor-post-row strong, .editor-post-row small { display: block; }
.editor-post-row small, .editor-post-row time { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.65rem; }
.editor-post-labels { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.63rem; text-transform: uppercase; }

.composer { min-height: 100vh; background: #f2f1ed; }
.composer-toolbar { position: sticky; top: 0; z-index: 40; display: flex; min-height: 4.5rem; align-items: center; justify-content: space-between; gap: 2rem; border-bottom: 1px solid var(--line); background: rgba(255, 254, 250, 0.96); padding: 0.7rem 1.25rem; backdrop-filter: blur(12px); }
.composer-toolbar > div, .composer-toolbar-actions { display: flex; align-items: center; gap: 0.8rem; }
.composer-back { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 1px solid var(--line); color: var(--muted); }
.composer-kicker, .save-state { display: block; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; }
.composer-toolbar strong { display: block; max-width: 25rem; overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.composer-toolbar .btn-primary, .composer-toolbar .btn-secondary { min-height: 2.65rem; padding: 0.55rem 0.9rem; }
.composer-errors { margin: 1rem; border: 1px solid #d6a49e; background: #fff3f1; padding: 0.8rem 1rem; color: var(--danger); font-size: 0.8rem; }
.composer-errors .errorlist { margin: 0.3rem 0 0; }
.composer-workspace { display: grid; grid-template-columns: 13.5rem minmax(28rem, 52rem) minmax(15rem, 18rem); justify-content: center; min-height: calc(100vh - 4.5rem); }
.block-library, .composer-settings { position: sticky; top: 4.5rem; height: calc(100vh - 4.5rem); overflow-y: auto; background: var(--surface); padding: 1.5rem 1.1rem; }
.block-library { border-right: 1px solid var(--line); }
.block-library > button { display: grid; width: 100%; grid-template-columns: 2.2rem 1fr; grid-template-rows: auto auto; align-items: center; border: 1px solid transparent; background: transparent; padding: 0.7rem; color: var(--ink); text-align: left; cursor: pointer; }
.block-library > button:hover { border-color: #c4cce5; background: var(--accent-soft); }
.block-library > button > span { grid-row: 1 / span 2; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; }
.block-library strong { font-size: 0.78rem; }
.block-library small { color: var(--faint); font-size: 0.62rem; }
.composer-canvas { min-width: 0; padding: 3rem 2.4rem 8rem; }
.composer-details { margin-bottom: 2rem; }
.composer-details label { display: block; margin-bottom: 0.35rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; text-transform: uppercase; }
.composer-title-field input { width: 100%; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; padding: 0.45rem 0; color: var(--ink); font-family: "Lora", serif; font-size: clamp(2.2rem, 4vw, 3.7rem); letter-spacing: -0.045em; line-height: 1.1; outline: 0; }
.composer-excerpt-field { margin-top: 1.4rem; }
.composer-excerpt-field textarea { width: 100%; resize: vertical; border: 0; border-left: 2px solid var(--line-strong); background: transparent; padding: 0.4rem 0.8rem; color: var(--muted); font-size: 0.92rem; outline: 0; }
.block-canvas { display: grid; gap: 1rem; }
.content-block { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 8px rgba(23, 27, 36, 0.035); }
.content-block.is-dragging { opacity: 0.45; }
.content-block.drag-over { border-top: 3px solid var(--accent); }
.content-block > header { display: flex; min-height: 2.8rem; align-items: center; border-bottom: 1px solid #e7e4dd; padding: 0.35rem 0.65rem; }
.drag-handle, .block-actions button { border: 0; background: transparent; color: var(--faint); cursor: pointer; }
.drag-handle { font-size: 1.1rem; cursor: grab; }
.block-type { margin-left: 0.4rem; font-size: 0.7rem; font-weight: 700; }
.block-number { margin-left: 0.6rem; color: #aaa9a3; font-family: "IBM Plex Mono", monospace; font-size: 0.56rem; }
.block-actions { display: flex; margin-left: auto; gap: 0.2rem; }
.block-actions button { padding: 0.25rem 0.4rem; font-size: 0.62rem; }
.block-actions button:hover { color: var(--accent); }
.block-actions [data-remove] { font-size: 1rem; }
.block-fields { display: grid; gap: 0.9rem; padding: 1.15rem; }
.block-fields label { display: grid; gap: 0.3rem; color: #424751; font-size: 0.68rem; font-weight: 700; }
.block-fields label span { color: var(--faint); font-weight: 400; }
.block-fields input:not([type="checkbox"]), .block-fields textarea, .block-fields select, .settings-group input:not([type="checkbox"]), .settings-group textarea, .settings-group select { width: 100%; border: 1px solid var(--line); background: white; padding: 0.65rem 0.7rem; color: var(--ink); font-size: 0.78rem; outline: 0; }
.block-fields input:focus, .block-fields textarea:focus, .block-fields select:focus, .settings-group input:focus, .settings-group textarea:focus, .settings-group select:focus { border-color: var(--accent); }
.block-fields textarea { resize: vertical; line-height: 1.6; }
.block-fields .code-input { background: #151b27; color: #e9edf5; font-family: "IBM Plex Mono", monospace; font-size: 0.75rem; tab-size: 2; }
.block-field-row { display: grid; grid-template-columns: 9rem 1fr; gap: 0.8rem; }
.block-field-row > label:only-child { grid-column: 1 / -1; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; justify-content: start; }
.divider-block { display: flex; align-items: center; gap: 1rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; }
.divider-block span { height: 1px; flex: 1; background: var(--line-strong); }
.empty-canvas { display: grid; min-height: 14rem; place-items: center; align-content: center; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; }
.empty-canvas span { color: var(--accent); font-size: 2rem; }
.empty-canvas p { margin: 0.3rem 0 0; font-size: 0.75rem; }
.add-block-inline { width: 100%; margin-top: 1rem; border: 1px dashed var(--line-strong); background: transparent; padding: 0.8rem; color: var(--muted); font-size: 0.76rem; cursor: pointer; }
.add-block-inline span { margin-right: 0.35rem; color: var(--accent); }
.add-block-inline:hover { border-color: var(--accent); color: var(--accent); }
.composer-settings { border-left: 1px solid var(--line); }
.composer-settings details { border-bottom: 1px solid var(--line); }
.composer-settings summary { padding: 1rem 0; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.settings-group { display: grid; gap: 0.85rem; padding: 0 0 1.2rem; }
.settings-group label { margin-bottom: -0.55rem; color: var(--faint); font-size: 0.64rem; font-weight: 700; }
.settings-group select[multiple] { min-height: 7rem; }
.settings-group .errorlist, .composer-details .errorlist { margin: 0; padding: 0; color: var(--danger); font-size: 0.65rem; list-style: none; }
.composer-preview { width: min(100% - 2rem, 68rem); min-height: 40rem; margin: 2rem auto 6rem; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 20px 60px rgba(23, 27, 36, 0.08); }
.preview-device-bar { display: flex; align-items: center; gap: 0.35rem; border-bottom: 1px solid var(--line); background: #ecebe7; padding: 0.75rem; }
.preview-device-bar > span { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #bbb9b2; }
.preview-device-bar small { margin-left: 0.5rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; text-transform: uppercase; }
.preview-article { max-width: 48rem; margin: auto; padding: 5rem 2rem 7rem; }
.preview-article > header { margin-bottom: 3.5rem; }
.preview-article h1 { margin: 0.8rem 0 0; font-family: "Lora", serif; font-size: clamp(3rem, 6vw, 5rem); font-weight: 500; letter-spacing: -0.05em; line-height: 1.02; }
.preview-article header > p:last-child { color: var(--muted); font-size: 1.05rem; }
.preview-empty { color: var(--faint); font-style: italic; }

/* Dashboard */
.dashboard-shell { padding-top: 2rem; }
.dashboard-tabs { display: flex; gap: 1.5rem; overflow-x: auto; border-bottom: 1px solid var(--line-strong); }
.dashboard-tab { flex: 0 0 auto; border-bottom: 2px solid transparent; padding: 0.8rem 0; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.dashboard-tab:hover { color: var(--ink); }
.dashboard-tab.is-active { border-color: var(--accent); color: var(--accent); }
.dashboard-header { display: flex; align-items: end; justify-content: space-between; gap: 3rem; padding: 3.5rem 0 2.5rem; }
.dashboard-person { display: flex; align-items: center; gap: 1.25rem; }
.dashboard-person h1 { margin: 0.45rem 0 0; font-family: "Lora", serif; font-size: clamp(2rem, 3vw, 3rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1.1; }
.dashboard-person div > p:last-child { margin: 0.4rem 0 0; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; }
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.dashboard-stats > div { border-right: 1px solid var(--line); padding: 1.4rem; }
.dashboard-stats > div:first-child { padding-left: 0; }
.dashboard-stats > div:last-child { border-right: 0; }
.dashboard-stats dt { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.63rem; letter-spacing: 0.08em; text-transform: uppercase; }
.dashboard-stats dd { margin: 0.4rem 0 0; font-family: "Lora", serif; font-size: 2.2rem; line-height: 1; }
.dashboard-stats small { color: var(--muted); font-size: 0.7rem; }
.dashboard-content { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 5rem; padding-top: 4rem; }
.subsection-heading h2, .activity-section h2 { font-size: 2rem; }
.enrollment-list { margin-top: 1.5rem; border-top: 1px solid var(--line-strong); }
.enrollment-row { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; border-bottom: 1px solid var(--line); padding: 1rem 0; }
.enrollment-image { display: block; aspect-ratio: 16/9; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.enrollment-image img { width: 100%; height: 100%; object-fit: cover; }
.enrollment-image > span { display: grid; height: 100%; place-items: center; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-weight: 700; }
.enrollment-copy { display: grid; min-width: 0; gap: 1rem; }
.row-overline { margin: 0; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.61rem; text-transform: uppercase; }
.enrollment-row h3 { margin: 0.35rem 0 0; font-family: "Lora", serif; font-size: 1.08rem; line-height: 1.3; }
.enrollment-row h3 a:hover { color: var(--accent); }
.enrollment-progress { display: flex; max-width: 27rem; align-items: center; gap: 0.8rem; }
.enrollment-progress .progress-track { flex: 1; }
.enrollment-progress strong { color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; }
.row-action { color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.row-action:hover { color: var(--accent-dark); }
.dashboard-empty { padding: 3rem 2rem; }
.dashboard-empty h3 { margin: 0; font-family: "Lora", serif; font-size: 1.5rem; }
.dashboard-empty p { margin: 0.5rem 0 1.5rem; }
.activity-section { border-top: 1px solid var(--line-strong); padding-top: 1rem; }
.activity-section ol { margin: 1.5rem 0 0; padding: 0; list-style: none; }
.activity-section li { position: relative; display: grid; grid-template-columns: 1rem 1fr; border-bottom: 1px solid var(--line); padding: 0.9rem 0; }
.activity-section li > span { width: 0.42rem; height: 0.42rem; margin-top: 0.45rem; background: var(--success); }
.activity-section li a { font-size: 0.82rem; font-weight: 600; line-height: 1.4; }
.activity-section li a:hover { color: var(--accent); }
.activity-section li small { grid-column: 2; margin-top: 0.3rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.58rem; }
.recommended-section { padding-top: 6rem; }

/* Settings */
.settings-header { max-width: 48rem; padding: 4rem 0 2.5rem; }
.settings-header h1 { font-size: clamp(2.5rem, 4vw, 4rem); }
.settings-header > p:last-child { max-width: 40rem; margin: 1.2rem 0 0; color: var(--muted); }
.settings-form { border-top: 1px solid var(--line-strong); padding-top: 2rem; }
.settings-form fieldset { margin: 0; border: 0; padding: 0; }
.settings-form legend { margin-bottom: 1rem; font-weight: 700; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 25rem)); gap: 1.25rem; }
.theme-choice { position: relative; display: block; cursor: pointer; }
.theme-choice > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-choice-card { position: relative; display: block; border: 1px solid var(--line); background: var(--surface); padding: 0.8rem; transition: border-color 160ms ease; }
.theme-choice:hover .theme-choice-card { border-color: var(--line-strong); }
.theme-choice > input:checked + .theme-choice-card { border: 2px solid var(--accent); padding: calc(0.8rem - 1px); }
.theme-choice-preview { display: grid; height: 9rem; grid-template-columns: 30% 1fr; overflow: hidden; border: 1px solid #aeb3bd; }
.theme-choice-dark .theme-choice-preview { background: #171a20; }
.theme-choice-dark .theme-choice-sidebar { border-right: 1px solid #343944; background: #101216; }
.theme-choice-light .theme-choice-preview { background: #fffefa; }
.theme-choice-light .theme-choice-sidebar { border-right: 1px solid #d7d4cc; background: #ebe9e2; }
.theme-choice-page { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.4rem 1rem; }
.theme-choice-page i { display: block; height: 0.34rem; background: #c9ccd3; }
.theme-choice-page i:first-child { width: 48%; height: 0.7rem; background: var(--accent); }
.theme-choice-page i:nth-child(2) { width: 90%; }
.theme-choice-page i:nth-child(3) { width: 76%; }
.theme-choice-page i:nth-child(4) { width: 60%; }
.theme-choice-dark .theme-choice-page i { background: #4a505d; }
.theme-choice-dark .theme-choice-page i:first-child { background: #8fa8ff; }
.theme-choice-copy { display: block; padding: 1rem 0.25rem 0.25rem; }
.theme-choice-copy strong { display: block; font-family: "Lora", serif; font-size: 1.08rem; }
.theme-choice-copy small { display: block; max-width: 20rem; margin-top: 0.3rem; color: var(--muted); font-size: 0.76rem; }
.theme-choice-check { position: absolute; right: 1.1rem; bottom: 1.1rem; display: grid; width: 1.35rem; height: 1.35rem; place-items: center; border: 1px solid var(--line-strong); color: transparent; font-size: 0.68rem; }
.theme-choice > input:checked + .theme-choice-card .theme-choice-check { border-color: var(--accent); background: var(--accent); color: white; }
.settings-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.settings-actions > span { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.65rem; }
.form-error { margin-bottom: 1rem; color: var(--danger); font-size: 0.82rem; }

/* Forms, authentication, checkout, status */
.form-page { max-width: 48rem; padding-top: 4rem; }
.form-page-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2rem; }
.form-page-header h1, .auth-intro h1, .checkout-copy h1, .status-page h1 { margin: 0.5rem 0 0; font-family: "Lora", serif; font-weight: 500; letter-spacing: -0.04em; line-height: 1.08; }
.form-page-header h1 { font-size: 3rem; }
.form-page-header div > p:last-child { margin: 0.4rem 0 0; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; }
.form-panel, .auth-form { border-top: 1px solid var(--line-strong); background: var(--surface); padding: 2rem; }
.django-form { display: grid; gap: 1.2rem; }
.django-form p { margin: 0; }
.django-form label { display: block; margin-bottom: 0.4rem; color: #343943; font-size: 0.78rem; font-weight: 700; }
.django-form input[type="text"], .django-form input[type="email"], .django-form input[type="password"], .django-form textarea, .django-form select {
  display: block; width: 100%; border: 1px solid var(--line-strong); border-radius: 0; background: white; padding: 0.72rem 0.8rem; color: var(--ink); font-size: 0.9rem;
}
.django-form input:focus, .django-form textarea:focus, .django-form select:focus { border-color: var(--accent); outline: 1px solid var(--accent); outline-offset: 0; }
.django-form input[type="file"] { display: block; width: 100%; border: 1px dashed var(--line-strong); padding: 0.7rem; color: var(--muted); font-size: 0.8rem; }
.django-form input[type="file"]::file-selector-button { margin-right: 0.8rem; border: 1px solid var(--line-strong); background: var(--surface-muted); padding: 0.42rem 0.7rem; color: var(--ink); cursor: pointer; }
.django-form input[type="checkbox"] { accent-color: var(--accent); }
.django-form .helptext, .django-form ul { display: block; margin: 0.35rem 0 0; color: var(--faint); font-size: 0.7rem; line-height: 1.45; }
.django-form .errorlist { margin: 0 0 0.4rem; padding: 0; color: var(--danger); list-style: none; }
.django-form .button-row { margin-top: 0.6rem; }

.auth-page { display: grid; min-height: 42rem; grid-template-columns: 1fr minmax(22rem, 0.7fr); align-items: center; gap: 8rem; padding-top: 4rem; padding-bottom: 4rem; }
.auth-intro h1 { max-width: 11ch; font-size: clamp(3rem, 5vw, 5.2rem); }
.auth-intro > p:last-child { max-width: 28rem; margin: 1.2rem 0 0; color: var(--muted); font-size: 1rem; }
.auth-form h2 { margin: 0 0 1.5rem; font-family: "Lora", serif; font-size: 1.8rem; font-weight: 500; }
.auth-form > p { margin: 1.4rem 0 0; color: var(--muted); font-size: 0.82rem; text-align: center; }
.auth-form > p a { color: var(--accent); font-weight: 700; }
.auth-form-wide { max-width: 31rem; }

.checkout-page { display: grid; grid-template-columns: minmax(0, 1.2fr) 24rem; gap: 6rem; padding-top: 5rem; }
.checkout-copy h1 { max-width: 15ch; font-size: clamp(2.8rem, 4.5vw, 4.5rem); }
.checkout-copy > p:nth-of-type(2) { max-width: 40rem; color: var(--muted); }
.checkout-copy form { margin-top: 2.2rem; }
.checkout-copy > small { display: block; margin-top: 1rem; color: var(--faint); }
.order-summary { border-top: 2px solid var(--ink); padding-top: 1.3rem; }
.order-summary dl { margin: 1.4rem 0 0; }
.order-summary dl > div { display: flex; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--line); padding: 0.8rem 0; font-size: 0.82rem; }
.order-summary dt { color: var(--muted); }
.order-summary dd { margin: 0; font-weight: 600; text-align: right; }
.order-summary .order-total { margin-top: 0.7rem; border-top-color: var(--line-strong); font-size: 1rem; }
.order-total dd { color: var(--accent); }

.status-page { display: flex; min-height: 34rem; max-width: 48rem; flex-direction: column; align-items: flex-start; justify-content: center; }
.status-mark { display: grid; width: 3.2rem; height: 3.2rem; margin-bottom: 1.6rem; place-items: center; border: 1px solid currentColor; font-family: "IBM Plex Mono", monospace; font-size: 1.3rem; }
.status-mark.success { color: var(--success); }
.status-mark.failed { color: var(--danger); }
.status-page h1 { font-size: clamp(2.8rem, 5vw, 4.8rem); }
.status-page > p:not(.eyebrow) { max-width: 34rem; margin: 1rem 0 2rem; color: var(--muted); }
.error-code { color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 5rem; font-weight: 500; line-height: 1; }
.error-page .eyebrow { margin-top: 1.5rem; }

/* Player */
.staff-preview-banner { display: flex; align-items: center; justify-content: center; gap: 0.65rem; border-bottom: 1px solid #d6b16d; background: #fff4d8; padding: 0.55rem 1rem; color: #75480a; font-size: 0.76rem; }
.staff-preview-banner strong { font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; }
.staff-preview-dot { width: 0.45rem; height: 0.45rem; background: #c17b12; }
.staff-preview-control { display: inline-flex; min-height: 3rem; align-items: center; border: 1px solid #d6b16d; padding: 0.6rem 1rem; color: var(--warning); font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; text-transform: uppercase; }
.player-layout { display: grid; width: min(100%, 100rem); margin-inline: auto; grid-template-columns: 21rem minmax(0, 1fr); border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
.player-sidebar { position: sticky; top: 4.75rem; height: calc(100vh - 4.75rem); overflow-y: auto; align-self: start; border-right: 1px solid var(--line); background: var(--surface-muted); padding: 2rem 1.5rem; }
.player-back { color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.63rem; text-transform: uppercase; }
.player-back:hover { color: var(--accent); }
.player-sidebar > h2 { margin: 1rem 0 0; font-family: "Lora", serif; font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.player-progress { margin-top: 1.8rem; border-top: 1px solid var(--line-strong); padding-top: 1rem; }
.player-progress > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.7rem; }
.player-progress strong { color: var(--accent); font-family: "IBM Plex Mono", monospace; }
.player-progress .progress-track { margin-top: 0.55rem; }
.player-progress p { margin: 0.45rem 0 0; color: var(--faint); font-size: 0.68rem; }
.lesson-navigation { margin-top: 2rem; }
.lesson-group + .lesson-group { margin-top: 1.8rem; }
.lesson-group h3 { margin: 0 0 0.55rem; color: var(--faint); font-family: "IBM Plex Mono", monospace; font-size: 0.61rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.lesson-group ol { margin: 0; padding: 0; list-style: none; }
.lesson-group a { display: flex; gap: 0.65rem; align-items: flex-start; border-left: 2px solid transparent; padding: 0.55rem 0.65rem; color: var(--muted); font-size: 0.77rem; line-height: 1.4; }
.lesson-group a:hover { color: var(--ink); }
.lesson-group a.is-current { border-color: var(--accent); background: var(--surface); color: var(--ink); font-weight: 600; }
.lesson-checkbox { appearance: none; width: 0.85rem; height: 0.85rem; flex: 0 0 auto; margin-top: 0.12rem; border: 1px solid var(--line-strong); background: transparent; }
.lesson-checkbox:checked { border-color: var(--accent); background-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 8.25 6.5 11.25 12.5 4.75' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: center; background-repeat: no-repeat; background-size: 0.8rem; }
.player-article { min-width: 0; background: var(--surface); }
.player-article-header { border-bottom: 1px solid var(--line); padding: 3.5rem clamp(2rem, 6vw, 6rem) 2.5rem; }
.player-article-header p { margin: 0; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 0.67rem; letter-spacing: 0.08em; text-transform: uppercase; }
.player-article-header h1 { max-width: 17ch; margin: 0.75rem 0 0; font-family: "Lora", serif; font-size: clamp(2.5rem, 4vw, 4.2rem); font-weight: 500; letter-spacing: -0.045em; line-height: 1.05; }
.player-article-body { padding: 3rem clamp(2rem, 6vw, 6rem) 4rem; }
.video-frame { max-width: 64rem; aspect-ratio: 16/9; margin-bottom: 3rem; overflow: hidden; border: 1px solid var(--line); background: black; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.download-row { margin-top: 2.5rem; }
.lesson-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin-top: 4rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.lesson-actions > div:last-child { justify-self: end; }
.player-empty { max-width: 46rem; padding-top: 8rem; padding-bottom: 8rem; text-align: left; }
.player-empty h1 { margin: 0.7rem 0 0; font-family: "Lora", serif; font-size: 3.3rem; font-weight: 500; line-height: 1.1; }
.player-empty > p:not(.eyebrow) { margin: 1rem 0 2rem; color: var(--muted); }

body.player-theme-dark {
  --paper: #111318;
  --surface: #181b22;
  --surface-muted: #14161c;
  --ink: #f0f1f3;
  --muted: #b0b4bd;
  --faint: #7e8490;
  --line: #30343e;
  --line-strong: #4b515e;
  --accent: #91a9ff;
  --accent-dark: #b4c4ff;
  --accent-soft: #222a45;
  background: var(--paper);
}
body.player-theme-dark .site-header { background: rgba(17,19,24,.94); }
body.player-theme-dark .nav-links > a:not(.nav-cta), body.player-theme-dark .nav-text-button { color: #d5d7dc; }
body.player-theme-dark .nav-cta { border-color: #d5d7dc; color: #f0f1f3; }
body.player-theme-dark .nav-cta:hover { background: #f0f1f3; color: #111318; }
body.player-theme-dark .nav-toggle span { background: var(--ink); }
body.player-theme-dark .progress-track { background: #313641; }
body.player-theme-dark .article-prose { color: #c6c9d0; }
body.player-theme-dark .article-prose p code, body.player-theme-dark .article-prose li code, body.player-theme-dark .article-prose td code { border-color: #3d4762; background: #222a3d; color: #c7d3ff; }
body.player-theme-dark .btn-secondary { color: var(--ink); }
body.player-theme-dark .btn-secondary:hover { border-color: #f0f1f3; background: #f0f1f3; color: #111318; }
body.player-theme-dark .footer-links a, body.player-theme-dark .footer-links span { color: var(--muted); }

/* Syntax palette */
.sv-code-block { background: #111722 !important; color: #e9edf5 !important; }
.sv-keyword-decl { color: #8bb6ff; font-weight: 600; }
.sv-keyword-type { color: #8ee4bd; font-weight: 600; }
.sv-keyword-control { color: #d6a2ff; font-weight: 600; }
.sv-keyword-process { color: #8bb6ff; font-weight: 600; }
.sv-keyword-oop { color: #bdadff; font-weight: 600; }
.sv-keyword-random { color: #f1ae77; font-weight: 600; }
.sv-keyword-coverage { color: #b9db7b; font-weight: 600; }
.sv-keyword-assertion { color: #f18f9a; font-weight: 600; }
.sv-keyword-uvm, .sv-macro { color: #83d7e7; font-weight: 600; }
.sv-string { color: #e6bd65; }
.sv-number { color: #8ee4bd; }
.sv-comment { color: #778190; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 1023px) {
  .hero-grid, .page-intro-grid, .course-hero, .article-layout, .auth-page { gap: 3.5rem; }
  .hero-grid { grid-template-columns: 1fr 22rem; }
  .course-grid, .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { grid-template-columns: 1fr 1fr; }
  .section-heading > .arrow-link { grid-column: 2; }
  .method-grid { gap: 4rem; }
  .membership-section { grid-template-columns: 1fr 1fr; }
  .membership-section .btn-primary { grid-column: 2; justify-self: start; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 15rem; gap: 3rem; }
  .dashboard-content { grid-template-columns: minmax(0, 1fr) 15rem; gap: 3rem; }
  .enrollment-row { grid-template-columns: 9rem minmax(0, 1fr); }
  .enrollment-row .row-action { grid-column: 2; }
  .player-layout { grid-template-columns: 18rem minmax(0, 1fr); }
  .composer-workspace { grid-template-columns: 11.5rem minmax(25rem, 1fr); }
  .composer-settings { position: static; grid-column: 1 / -1; width: 100%; height: auto; border-top: 1px solid var(--line); border-left: 0; }
}

@media (min-width: 768px) {
  .md\:hidden { display: none !important; }
  .md\:block { display: block !important; }
  .md\:w-auto { width: auto !important; }
}

@media (max-width: 767px) {
  .site-nav { min-height: 4.2rem; flex-wrap: wrap; padding: 0.75rem 0; }
  #site-navbar { border-top: 1px solid var(--line); }
  .nav-links { flex-direction: column; align-items: stretch; gap: 0; padding: 0.6rem 0; }
  .nav-links > a:not(.nav-cta), .nav-text-button, .nav-cta { display: flex; width: 100%; min-height: 2.8rem; align-items: center; border: 0; background: transparent; padding: 0.5rem 0; color: var(--ink); }
  .nav-cta:hover { background: transparent; color: var(--accent); }
  .nav-links form { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 3rem; }
  .footer-bottom { align-items: flex-start; flex-direction: column; gap: 0.3rem; }
  .hero-grid, .page-intro-grid, .course-hero, .learning-brief, .method-grid, .article-layout, .auth-page, .checkout-page { grid-template-columns: 1fr; }
  .home-hero { padding-top: 4.5rem; }
  .hero-grid { gap: 3rem; }
  .hero-copy h1 { font-size: clamp(3.2rem, 15vw, 5rem); }
  .principle-row { grid-template-columns: 1fr; margin-top: 4rem; }
  .principle-row > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .principle-row > div:last-child { border-bottom: 0; }
  .content-section { padding-top: 5rem; }
  .section-heading { grid-template-columns: 1fr; gap: 1rem; }
  .section-heading > .arrow-link { grid-column: auto; }
  .course-grid, .post-grid, .journal-grid { grid-template-columns: 1fr; }
  .journal-teaser { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 1.5rem 0; }
  .journal-teaser + .journal-teaser { padding-left: 0; }
  .journal-teaser .arrow-link { margin-top: 1rem; }
  .method-section { margin-top: 5rem; }
  .method-grid { gap: 3rem; padding-top: 4rem; padding-bottom: 4rem; }
  .membership-section { grid-template-columns: 1fr; gap: 1.5rem; margin-top: 5rem; }
  .membership-section .btn-primary { grid-column: auto; justify-self: start; }
  .page-intro { padding-top: 4rem; padding-bottom: 3rem; }
  .page-intro-grid { gap: 2rem; }
  .catalog-toolbar, .index-rule { align-items: flex-start; flex-direction: column; gap: 0.3rem; }
  .course-hero { gap: 3rem; padding-top: 3rem; }
  .course-facts { order: -1; }
  .learning-brief { gap: 2.5rem; }
  .course-prerequisites { grid-template-columns: 1fr; gap: 1rem; }
  .curriculum-toggle { grid-template-columns: 2.2rem 1fr 1.5rem; }
  .module-count { display: none; }
  .curriculum-content ol { margin-left: 2.2rem; }
  .curriculum-content li { grid-template-columns: 1.8rem minmax(0, 1fr); }
  .lesson-badges { grid-column: 2; }
  .article-page { padding-top: 3rem; }
  .article-header h1 { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .article-sidebar { position: static; border-top: 1px solid var(--line-strong); padding-top: 2rem; }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-stats > div { border-bottom: 1px solid var(--line); }
  .dashboard-stats > div:nth-child(2) { border-right: 0; }
  .dashboard-stats > div:first-child { padding-left: 1.4rem; }
  .dashboard-content { grid-template-columns: 1fr; }
  .enrollment-row { grid-template-columns: 8rem minmax(0, 1fr); }
  .activity-section { margin-top: 1rem; }
  .theme-grid { grid-template-columns: 1fr; }
  .auth-page { min-height: auto; padding-top: 4rem; }
  .auth-intro h1 { font-size: 3.4rem; }
  .player-layout { grid-template-columns: 1fr; border: 0; }
  .player-sidebar { position: static; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .lesson-navigation { max-height: 22rem; overflow-y: auto; }
  .player-article-header, .player-article-body { padding-right: 1.5rem; padding-left: 1.5rem; }
  .lesson-actions { grid-template-columns: 1fr 1fr; }
  .lesson-actions form, .staff-preview-control { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .staff-preview-banner { flex-wrap: wrap; justify-content: flex-start; }
  .editor-library-header { align-items: flex-start; flex-direction: column; }
  .editor-post-row { grid-template-columns: 1fr auto; }
  .editor-post-labels { display: none; }
  .editor-post-row time { grid-column: 1; }
  .composer-toolbar { position: static; align-items: flex-start; flex-direction: column; }
  .composer-toolbar-actions { width: 100%; flex-wrap: wrap; }
  .save-state { width: 100%; }
  .composer-workspace { grid-template-columns: 1fr; }
  .block-library { position: static; display: flex; width: 100%; height: auto; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0.8rem; }
  .block-library .aside-label { display: none; }
  .block-library > button { min-width: 6.5rem; grid-template-columns: 1fr; grid-template-rows: auto auto; text-align: center; }
  .block-library > button > span { grid-row: auto; }
  .block-library small { display: none; }
  .composer-canvas { padding: 2rem 1rem 5rem; }
  .composer-settings { grid-column: auto; }
  .block-field-row { grid-template-columns: 1fr; }
}

@media (max-width: 479px) {
  .footer-links { grid-template-columns: repeat(2, 1fr); }
  .dashboard-person { align-items: flex-start; }
  .dashboard-stats { grid-template-columns: 1fr 1fr; }
  .enrollment-row { grid-template-columns: 1fr; }
  .enrollment-image { max-width: none; }
  .enrollment-row .row-action { grid-column: 1; }
  .settings-actions { align-items: flex-start; flex-direction: column; }
}
