/* Shared by every page: the self-hosted font, material tokens, the site header and the full-screen
   mobile menu. One family, Satoshi, for everything: hierarchy comes from weight and size.
   Official Fontshare woff2, served from this origin only. Licence: ITF Free Font License
   (assets/fonts/LICENSE-Fontshare-FFL.txt), which forbids modifying the file (including subsetting),
   so it is used exactly as downloaded. */

@font-face {
  font-family: "Satoshi";
  src: url("/assets/fonts/satoshi-variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-app: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Headings: same family, heavier and tighter. */
  --font-display: var(--font-ui);
  --display-weight: 800;
  --display-tracking: -0.045em;
  --display-leading: 0.92;

  --header-h: 3.75rem;

  /* Material: one "glass" surface used by the header, cards and pills on dark pages. */
  --glass-bg: rgba(24, 28, 26, 0.62);
  --glass-line: rgba(237, 233, 224, 0.09);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --glass-blur: saturate(140%) blur(16px);
  --lift: 0 24px 48px -24px rgba(0, 0, 0, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
}

/* ---------- Header ---------- */

.site-header {
  --hdr-fg: #ede9e0;
  --hdr-muted: #b9b5ab;
  --hdr-bg: rgba(15, 18, 17, 0.72);
  --hdr-line: var(--glass-line);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--hdr-bg);
  border-bottom: 1px solid var(--hdr-line);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi);
  font-family: var(--font-ui);
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    -webkit-backdrop-filter 0.35s ease,
    backdrop-filter 0.35s ease;
}

.site-header[data-theme="light"] {
  --hdr-fg: #1f2421;
  --hdr-muted: #4a514c;
  --hdr-bg: rgba(244, 241, 234, 0.88);
  --hdr-line: #d9d2c3;
}

/* With JS: transparent at the top of the page, background fades in once scrolled.
   Without JS the header simply stays solid. */
.has-js .site-header:not(.is-stuck) {
  background-color: transparent;
  border-bottom-color: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 48rem) {
  .site-header .bar {
    padding: 0 2rem;
  }
}

.wordmark {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 1.4rem;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--hdr-fg);
  text-decoration: none;
  font-synthesis: none;
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--hdr-muted);
  text-decoration: none;
  padding: 0.5rem 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--hdr-fg);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.menu-toggle {
  display: none;
}

/* Language switcher: always in the header bar, next to the nav on desktop and next to "Menu"
   on phones. The wordmark's auto margin keeps nav + switcher + toggle together on the right. */
.site-header .bar > .wordmark {
  margin-right: auto;
}

.lang {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.lang a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.35rem;
  color: var(--hdr-muted);
  text-decoration: none;
}

.lang a:hover,
.lang a[aria-current="true"] {
  color: var(--hdr-fg);
}

.lang a[aria-current="true"] {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.lang .sep {
  color: var(--hdr-muted);
  opacity: 0.6;
}

@media (min-width: 48rem) {
  .lang {
    padding-left: 1rem;
    border-left: 1px solid var(--hdr-line);
  }
}

@media (max-width: 47.99rem) {
  .site-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 0.25rem;
    font: 500 1rem var(--font-ui);
    color: var(--hdr-fg);
    background: none;
    border: 0;
    text-decoration: none;
    cursor: pointer;
  }

  .menu-toggle .bars {
    display: inline-grid;
    gap: 5px;
  }

  .menu-toggle .bars span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }
}

/* ---------- Full-screen menu ----------
   Opens via :target without JS (href="#menu"), via .is-open with JS. */

.menu {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  padding: 0 1rem 2rem;
  background: #0f1211;
  color: #ede9e0;
  font-family: var(--font-ui);
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.25s ease,
    visibility 0s linear 0.25s;
}

.menu:target,
.menu.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.menu .wordmark {
  --hdr-fg: #ede9e0;
}

.menu-close {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.25rem;
  font: 500 1rem var(--font-ui);
  color: #ede9e0;
  background: none;
  border: 0;
  text-decoration: none;
  cursor: pointer;
}

.menu ul {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.menu li + li {
  margin-top: 0;
}

.menu ul a {
  display: block;
  padding: 0.6rem 0;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 2.75rem;
  line-height: 1.05;
  letter-spacing: var(--display-tracking);
  color: #ede9e0;
  text-decoration: none;
  border-bottom: 1px solid rgba(237, 233, 224, 0.12);
  font-synthesis: none;
}

.menu ul a:hover {
  color: #86c6bb;
}

.menu-foot {
  margin-top: auto;
  font-size: 0.95rem;
  color: #a9a59b;
}

.menu-foot a {
  color: #86c6bb;
}

@media (min-width: 48rem) {
  .menu {
    display: none;
  }
}

.no-scroll {
  overflow: hidden;
}

/* In-page anchors land below the sticky header. */
[id] {
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .menu {
    transition: none !important;
  }
}
