html.dark {
  color-scheme: dark;
  background: #0b1220;
}

html.dark header:has(.nav),
html.dark header:has(nav[aria-label="Main"]),
html.dark body:has(article) header {
  background: #0b1220;
  border-bottom: 1px solid #2a3748;
}

.nav {
  gap: .75rem;
}

.nav-logo,
.nav-links {
  min-width: 0;
}

.nav-links {
  flex-wrap: wrap;
  column-gap: .5rem;
  row-gap: .25rem;
}

.nav-controls {
  display: flex;
  gap: .4rem;
  order: 1;
  flex-shrink: 0;
}

.theme-toggle,
.menu-toggle {
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: .45rem .65rem;
  border: 1px solid currentColor;
  border-radius: .65rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

nav:not(.nav) .theme-toggle {
  color: var(--dark);
}

.menu-toggle {
  display: none;
}

:where(a, button, summary, input, select, textarea):focus-visible {
  outline: 2px solid #42c4c6;
  outline-offset: 3px;
}

html.dark body:has(main:not(#top)) {
  background: #0b1220;
  color: #e9eef8;
}

html.dark nav:not(.nav) {
  color: #e9eef8;
}
html.dark nav:not(.nav) a,
html.dark nav:not(.nav) .theme-toggle {
  color: inherit;
}

html.dark main a:not(.btn):not(aside a) {
  color: #bfeff0;
}

html.dark aside,
html.dark .programme-packages li,
html.dark .nsol-enroll-form :is(input, select) {
  background: #172131;
  color: #e9eef8;
  border-color: #45626f;
}

html.dark aside a {
  color: #111;
}

main {
  overflow-wrap: anywhere;
}

main :is(img, video, audio, iframe) {
  max-width: 100%;
}

@media (max-width: 900px) {
  .nav {
    position: relative;
    flex-wrap: wrap;
  }

  .nav-logo {
    flex: 1;
    line-height: 1.25;
  }

  .nav-links {
    display: flex;
    width: 100%;
    order: 2;
  }

  .menu-ready .menu-toggle:not([hidden]) {
    display: inline-block;
  }

  .menu-ready .nav-links {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    width: auto;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: auto;
    padding: .75rem 1rem;
    background: #126470;
    color: #fff;
    box-shadow: 0 .5rem 1rem #0004;
  }

  html.dark .menu-ready .nav-links {
    background: #172131;
  }

  .menu-ready.menu-open .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .25rem;
  }

  .nav-links a,
  nav:not(.nav) a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }

  .hero-inner > *,
  .section-inner,
  .card {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .nav-logo {
    font-size: .95rem;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero-inner {
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-title {
    font-size: clamp(1.75rem, 7.5vw, 2.4rem);
    line-height: 1.15;
  }

  .hero-buttons {
    margin-top: .75rem;
  }

  .hero-buttons .btn {
    width: 100%;
    text-align: center;
  }

  .hero-emoji {
    font-size: 2.5rem;
  }

  .hero-flag svg {
    width: 2.5rem;
  }

  .hero-illustration {
    font-size: 2.5rem;
  }

  .grid-2,
  .zoom-grid,
  .contact-grid,
  .level-test-grid,
  .level-test-wrap,
  .vocab-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .btn {
    min-height: 44px;
  }

  .nsol-enroll-form :is(input, select) {
    min-height: 44px;
    font-size: 1rem;
  }

  .nsol-duration-table table {
    min-width: 0;
  }

  .nsol-duration-table :is(th, td) {
    padding-inline: .3rem;
  }
}

html.dark .btn-primary {
  background: #42c4c6;
  color: #0b1220;
}

html.dark .btn-primary:disabled {
  opacity: .5;
}

html.dark .result-block,
html.dark .quiz-textarea {
  background: #172131;
  border-color: #45626f;
  color: #e9eef8;
}

html.dark .answers-a,
html.dark .answers-note {
  color: #d7e1f3;
}

body:has(header .nav) main [id] {
  scroll-margin-top: 5.5rem;
}
