*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #0f172a;
  --color-bg-light: #1e293b;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-accent: #C800DE;
  --color-accent-hover: #a000b2;
  --color-scroll-thumb: #475569;
  --max-width: 720px;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Nav */
.site-nav {
  border-bottom: 1px solid var(--color-bg-light);
  padding: 1rem 1.5rem;
}

.site-nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.site-nav .nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.site-nav .nav-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
  color: var(--color-text);
  text-decoration: none;
}

/* Main content */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.site-main h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.site-main h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.site-main h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.site-main p {
  margin-bottom: 1rem;
  color: var(--color-text-muted);
}

.site-main ul,
.site-main ol {
  margin-bottom: 1rem;
  padding-inline-start: 1.5rem;
  color: var(--color-text-muted);
}

.site-main li {
  margin-bottom: 0.35rem;
}

.site-main strong {
  color: var(--color-text);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-bg-light);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Hero (landing page) */
.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.hero svg {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.hero .tagline {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto 2rem;
}

/* About section (landing page) */
.about {
  text-align: start;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-bg-light);
}

/* Responsive */
@media (max-width: 480px) {
  .site-nav .nav-inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }
}

/* Language switcher — an icon button opening a searchable list. A native
   <select> can't hold a search field, and 142 languages need one. */
.lang-switcher {
  position: relative;
  display: inline-flex;
}

.lang-switcher__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
}

.lang-switcher__button:hover,
.lang-switcher__button[aria-expanded="true"] {
  color: var(--color-text);
}

.lang-switcher__button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.lang-switcher__icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  pointer-events: none;
}

/* inset-inline-end keeps the panel anchored to the trailing edge in both
   directions, so it opens inward rather than off-screen under RTL. */
.lang-switcher__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  inset-inline-end: 0;
  z-index: 20;
  width: 15rem;
  max-width: calc(100vw - 2rem);
  padding: 0.5rem;
  border: 1px solid #334155;
  border-radius: 8px;
  background-color: var(--color-bg-light);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.lang-switcher__panel[hidden] {
  display: none;
}

.lang-switcher__search {
  width: 100%;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
}

.lang-switcher__search::placeholder {
  color: var(--color-text-muted);
}

.lang-switcher__search:focus {
  outline: none;
  border-color: var(--color-accent);
}

.lang-switcher__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lang-switcher__option {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Alignment comes from the page's direction, but each endonym still needs its
     own bidi run so a right-to-left name's brackets don't escape into the row. */
  unicode-bidi: isolate;
}

.lang-switcher__option[hidden] {
  display: none;
}

/* .is-active follows the keyboard; :hover follows the pointer. */
.lang-switcher__option:hover,
.lang-switcher__option.is-active {
  color: var(--color-text);
  background-color: rgba(200, 0, 222, 0.18);
}

.lang-switcher__option[aria-selected="true"] {
  color: var(--color-text);
  font-weight: 600;
}

.lang-switcher__empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.5rem 0.6rem;
  margin: 0;
}

.lang-switcher__empty[hidden] {
  display: none;
}

/* Scrollbar. Chrome 121+, Firefox and Safari 18.2+ take the standard
   properties; older WebKit only understands the pseudo-elements. They must not
   both apply — Chrome ignores ::-webkit-scrollbar entirely once scrollbar-width
   is set — so the legacy styling is fenced behind @supports. */
.lang-switcher__list {
  scrollbar-width: thin;
  scrollbar-color: var(--color-scroll-thumb) transparent;
}

@supports not (scrollbar-width: thin) {
  .lang-switcher__list::-webkit-scrollbar {
    width: 10px;
  }

  .lang-switcher__list::-webkit-scrollbar-track {
    background: transparent;
  }

  /* The transparent border plus background-clip insets the thumb, so it reads
     as a slim pill rather than filling the gutter. */
  .lang-switcher__list::-webkit-scrollbar-thumb {
    background-color: var(--color-scroll-thumb);
    background-clip: content-box;
    border: 3px solid transparent;
    border-radius: 999px;
  }

  .lang-switcher__list::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-accent);
  }
}

/* Hides the English source text while a different locale loads. The timeout in
   i18n.js always removes this class, so the page can never stay blank. */
.i18n-loading body {
  visibility: hidden;
}


