:root {
  color-scheme: light;
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #edf2f8;
  --text: #16243a;
  --muted: #53647b;
  --border: #dce4ef;
  --accent: #1459b8;
  --accent-strong: #0d438c;
  --button-text: #ffffff;
  --focus: #d97706;
  --success-bg: #e7f6ed;
  --success-text: #14532d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #101722;
  --surface: #182333;
  --surface-muted: #202e40;
  --text: #edf3fa;
  --muted: #bac8d9;
  --border: #35465c;
  --accent: #91bdff;
  --accent-strong: #b7d2ff;
  --button-text: #101722;
  --focus: #fbbf24;
  --success-bg: #153324;
  --success-text: #b7f0c9;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.container {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  transform: translateY(-160%);
  background: var(--surface);
  color: var(--text);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  flex-direction: column;
  color: var(--text);
  line-height: 1.25;
  text-decoration: none;
}

.brand-name,
.footer-brand {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-tagline {
  color: var(--muted);
  font-size: 0.75rem;
}

.primary-nav,
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.primary-nav a,
.footer-nav a {
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.main-content {
  min-height: 58vh;
  padding-block: 2.5rem 4rem;
}

.hero {
  padding: clamp(2rem, 7vw, 5rem);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  background: linear-gradient(135deg, var(--surface), var(--surface-muted));
}

.hero h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5rem);
  letter-spacing: -0.065em;
  line-height: 1.04;
}

.hero-copy {
  max-width: 43rem;
  margin-block: 1.35rem 1.75rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 2.9rem;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 0.7rem;
  background: var(--accent);
  color: var(--button-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-strong);
  color: var(--button-text);
}

.button-secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.content-section {
  padding-block: clamp(3rem, 7vw, 5rem);
}

.section-heading {
  max-width: 42rem;
  margin-bottom: 1.5rem;
}

.section-heading h2,
.library-note h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.feature-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.1rem;
}

.feature-card p,
.library-note p {
  margin: 0;
  color: var(--muted);
}

.library-note {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem;
  border-left: 4px solid var(--accent);
  background: var(--surface-muted);
}

.library-note > div {
  max-width: 44rem;
}

.library-note p:not(.eyebrow) {
  margin-top: 0.75rem;
}

.text-link {
  flex: 0 0 auto;
  font-weight: 700;
}

.prose {
  max-width: 52rem;
  margin-inline: auto;
}

.prose h1,
.error-page h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.prose h2 {
  margin: 2.25rem 0 0.55rem;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.prose p {
  color: var(--muted);
}

.prose .lead {
  margin-top: 1rem;
  color: var(--text);
  font-size: 1.2rem;
}

.updated-date {
  font-size: 0.9rem;
}

.contact-form {
  display: grid;
  gap: 1.1rem;
  margin-top: 2rem;
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

.form-field label {
  font-weight: 700;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--page);
  color: var(--text);
  font: inherit;
}

.field-error,
.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.field-error {
  color: #b42318;
}

.messages {
  margin-bottom: 1.5rem;
}

.message {
  padding: 0.8rem 1rem;
  border-radius: 0.65rem;
  background: var(--success-bg);
  color: var(--success-text);
}

.error-page {
  max-width: 42rem;
  margin: 3rem auto;
  text-align: center;
}

.error-page p:not(.eyebrow) {
  margin-bottom: 1.5rem;
  color: var(--muted);
}

.ad-slot {
  min-height: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 2rem;
}

.footer-brand {
  color: var(--text);
  text-decoration: none;
}

.footer-inner p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.byline {
  font-size: 0.88rem;
}

.footer-nav {
  align-content: start;
  justify-content: end;
}

.footer-bottom {
  padding-block: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-bottom p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-panel {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.search-panel h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.035em;
}

.search-form {
  display: flex;
  width: min(100%, 38rem);
  align-items: center;
  gap: 0.6rem;
}

.search-form input {
  min-width: 0;
  min-height: 2.9rem;
  flex: 1;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--page);
  color: var(--text);
  font: inherit;
}

.content-list,
.course-list,
.directory-list,
.syllabus,
.roadmap-steps {
  display: grid;
  gap: 1rem;
  padding-left: 1.4rem;
}

.content-list {
  list-style: none;
  padding-left: 0;
}

.content-list li,
.course-list li,
.directory-list li,
.syllabus > li,
.roadmap-steps > li {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface);
}

.content-list li {
  display: grid;
  gap: 0.25rem;
}

.content-list a,
.course-list a,
.directory-list a,
.syllabus a,
.roadmap-steps a {
  font-weight: 700;
}

.content-list span,
.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.course-list h3,
.directory-list h2,
.syllabus h3,
.roadmap-steps h3 {
  margin: 0 0 0.35rem;
  font-size: 1.16rem;
}

.course-list p,
.directory-list p,
.roadmap-steps p {
  margin: 0.4rem 0;
  color: var(--muted);
}

.directory-list {
  padding-left: 0;
  list-style: none;
}

.link-list {
  display: grid;
  gap: 0.4rem;
  padding-left: 1.2rem;
}

.card-copy {
  color: var(--muted);
}

.breadcrumbs {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  padding-left: 0.4rem;
  content: "/";
}

.breadcrumbs [aria-current="page"] {
  color: var(--text);
}

.learning-page > h2,
.lesson-page > h2,
.article-page > h2,
.glossary-term h2,
.roadmap-page > h2,
.directory-page > h2 {
  margin-top: 2rem;
}

.course-details {
  margin-block: 1.5rem;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--surface-muted);
}

.course-details h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.course-details p {
  margin: 0.35rem 0;
}

.rich-content > :first-child {
  margin-top: 0;
}

.rich-content > :last-child {
  margin-bottom: 0;
}

.lesson-text,
.article-text {
  margin-block: 1.5rem;
}

.objectives,
.exercise-card,
.quiz-card {
  margin-block: 1.5rem;
  padding: clamp(1rem, 3vw, 1.4rem);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface);
}

.objectives h2,
.exercise-card h2,
.quiz-card h2,
.faq-section h2 {
  margin: 0 0 0.7rem;
  font-size: 1.35rem;
}

.exercise-card details,
.faq-item {
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface-muted);
}

.exercise-card summary,
.faq-item summary,
.expected-output summary {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.code-example {
  min-width: 0;
  margin: 1.75rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: #f5f2ee;
  color: #20242b;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid #ded8d0;
  background: #ece7e0;
}

.code-toolbar figcaption {
  font-size: 0.86rem;
  font-weight: 700;
}

.copy-button {
  padding: 0.35rem 0.6rem;
  border: 1px solid #c7bfb6;
  border-radius: 0.45rem;
  background: #fff;
  color: #20242b;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.code-example pre,
.expected-output pre {
  max-width: 100%;
  margin: 0;
  overflow-x: auto;
  tab-size: 4;
  white-space: pre;
}

.code-example pre {
  padding: 1rem;
}

.expected-output {
  padding: 0.7rem 0.9rem;
  border-top: 1px solid #ded8d0;
  background: #fff;
  color: #20242b;
}

.expected-output pre {
  padding-top: 0.6rem;
}

.quiz-card fieldset {
  display: grid;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 1rem;
  border: 0;
}

.quiz-card legend {
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.quiz-option {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.quiz-option input {
  accent-color: var(--accent);
}

.quiz-feedback {
  margin-bottom: 0;
  font-weight: 700;
}

.quiz-explanation {
  color: var(--muted);
}

.faq-section {
  margin-top: 2.5rem;
}

.faq-item .rich-content {
  padding-top: 0.65rem;
}

.lesson-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.lesson-pagination a {
  display: grid;
  max-width: 48%;
  font-weight: 700;
  text-decoration: none;
}

.lesson-pagination .next-lesson {
  margin-left: auto;
  text-align: right;
}

.lesson-pagination span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.pronunciation {
  color: var(--muted);
  font-style: italic;
}

.search-page-form {
  display: grid;
  align-items: stretch;
  margin-block: 1.5rem;
}

.search-page-form label {
  font-weight: 700;
}

.search-page-form > div {
  display: flex;
  gap: 0.6rem;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 1.25rem, 72rem);
  }

  .header-inner {
    min-height: auto;
    flex-wrap: wrap;
    padding-block: 0.8rem;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
  }

  .theme-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .main-content {
    padding-block: 1rem 2.5rem;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .library-note,
  .footer-inner,
  .search-panel {
    align-items: start;
    flex-direction: column;
  }

  .search-form {
    width: 100%;
  }

  .footer-nav {
    justify-content: start;
    gap: 0.75rem 1.25rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
