/* ============================================================
   INDIVIDUATION — header, controls, and the index menu
   (components/Header.tsx, ThemeToggle.tsx, LanguagePicker.tsx)
   After the Journey site's header: no bar of its own, a scrim that
   fades in once the page moves, round hairline controls, and one
   starlight pill for the primary action.
   ============================================================ */

.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  --header-h: 4.75rem;
}
/* scrim — a gradient, not a bar, so nothing draws a hard edge */
.site-header::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 7rem;
  background: linear-gradient(to bottom, var(--bg), color-mix(in srgb, var(--bg) 75%, transparent), transparent);
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
}
.site-header.scrolled::before { opacity: 1; }
/* The menu is opaque, so the scrim would only draw a band across it. */
.site-header.menu-open::before { opacity: 0; }

.nav {
  position: relative; z-index: 96; /* above the menu curtain (95) */
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: var(--header-h);
  padding: 0 1.25rem;
}
@media (min-width: 768px) { .nav { padding: 0 2.5rem; } }

/* ---- Brand ---- */
.logo {
  display: flex; flex-shrink: 0; align-items: center;
  color: var(--text); text-decoration: none;
}
/* No mark: the name, set in the display serif, is the brand. The roll turns
   it into its own italic on hover. */
.logo-word {
  display: flex;
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 400;
  letter-spacing: -0.015em; line-height: 1;
}
/* The roll's italic copy is scaled up to sit level with a sans label; beside
   its own roman it keeps the same size. Instrument's italic still sets a
   little wider than the roman, so the word is clipped top and bottom only
   (the roll needs that) and may run past its box to the right. */
.logo-word .roll { overflow: visible; clip-path: inset(0 -20% 0 -4%); }
.logo-word .roll-b { font-size: 1em; letter-spacing: inherit; }

/* ---- Right-hand group ---- */
.nav-controls { display: flex; align-items: center; gap: 0.5rem; }
@media (min-width: 768px) { .nav-controls { gap: 0.75rem; } }

/* Inline links — only where every language's labels fit in one line. */
.nav-inline {
  display: none; align-items: center; gap: 1.6rem;
  list-style: none; margin: 0 0.75rem 0 0; padding: 0;
}
@media (min-width: 1280px) { .nav-inline { display: flex; } }
:lang(ka) .nav-inline { gap: 1.25rem; }
@media (max-width: 1499px) { :lang(ka) .nav-inline { display: none; } }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-ui); font-size: 0.875rem; line-height: 1;
  color: var(--muted); text-decoration: none;
  transition: color 0.3s;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--text); }
/* the current page is marked by a small moon-glow, not a colour */
.nav-dot {
  width: 4px; height: 4px; flex: none; border-radius: 9999px; background: var(--moon);
  opacity: 0; transform: scale(0);
  transition: opacity 0.3s, transform 0.3s;
}
.nav-link[aria-current="page"] .nav-dot { opacity: 1; transform: none; }

/* Round hairline control: theme, language, account, menu. */
.ctl {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 2.25rem; min-width: 2.25rem; padding: 0;
  border: 1px solid var(--line); border-radius: 9999px;
  background: transparent; color: var(--muted);
  font-family: var(--font-ui); cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
}
.ctl:hover { border-color: var(--line-hover); color: var(--text); }
.ctl.is-member { color: var(--text); border-color: var(--line-strong); }
.ctl.is-member::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 9999px;
  background: var(--moon); transform: translate(10px, -10px);
}
.acct-wrap { position: relative; display: inline-flex; }

/* ---- Language picker ---- */
.lang-wrap { position: relative; }
.ctl-lang {
  gap: 0.375rem; padding: 0 0.875rem;
  font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.ctl-lang svg { transition: transform 0.2s; }
.ctl-lang svg.flip { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
  min-width: 11rem; padding: 0.375rem 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 1rem;
  background: color-mix(in srgb, var(--bg-2) 95%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px -20px var(--pop-shadow);
  animation: pop-in 0.18s var(--ease-out);
}
.lang-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  width: 100%; padding: 0.625rem 1rem;
  border: 0; background: transparent; text-align: left; cursor: pointer;
  font-family: var(--font-ui); font-size: 0.8rem; letter-spacing: 0.02em;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}
.lang-opt:hover { background: var(--accent-soft); color: var(--text); }
.lang-opt[aria-selected="true"] { color: var(--text); }
.lang-code { font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.5; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---- The primary action, small ---- */
.nav-cta {
  display: none; align-items: center;
  height: 2.25rem; margin-left: 0.25rem; padding: 0 1rem;
  border-radius: 9999px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-ui); font-size: 0.875rem; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: box-shadow 0.5s var(--ease-out);
}
.nav-cta:hover { box-shadow: 0 8px 32px -10px var(--glow); }
@media (min-width: 768px) { .nav-cta { display: inline-flex; } }

/* ---- Menu button: two hairlines that cross ---- */
.menu-btn { flex-direction: column; gap: 5px; color: var(--text); width: 2.25rem; }
.menu-btn span {
  width: 14px; height: 1px; background: currentColor;
  transition: transform 0.3s var(--ease-out);
}
.menu-btn.open span:first-child { transform: translateY(3px) rotate(45deg); }
.menu-btn.open span:last-child { transform: translateY(-3px) rotate(-45deg); }
@media (min-width: 1280px) { .menu-btn { display: none; } }
@media (min-width: 1280px) and (max-width: 1499px) { :lang(ka) .menu-btn { display: flex; } }

/* ---- The index menu: a curtain of night, the links set large ---- */
.menu-panel {
  position: fixed; inset: 0; z-index: 95;
  background: var(--bg);
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden;
  transition: opacity 0.45s var(--ease-out), visibility 0.45s;
}
.menu-panel.open { opacity: 1; visibility: visible; }
.menu-inner {
  min-height: 100%;
  display: flex; flex-direction: column;
  max-width: 72rem; margin: 0 auto;
  padding: 6.5rem 1.25rem 2.5rem;
}
@media (min-width: 768px) { .menu-inner { padding: 7.5rem 2.5rem 3rem; } }
.menu-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
/* rows are dealt in one by one once it opens */
.menu-list li {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.menu-panel.open .menu-list li {
  opacity: 1; transform: none;
  transition-delay: calc(var(--i) * 0.05s + 0.1s);
}
.menu-link {
  position: relative; display: flex; align-items: baseline; gap: 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
/* a wash that rises behind the row */
.menu-link::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--wash);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform 0.5s var(--ease-out);
}
.menu-link:hover::before { transform: scaleY(1); }
.menu-num {
  width: 1.5rem; flex: none;
  font-family: var(--font-ui); font-size: 0.75rem; font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.menu-label {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.02; letter-spacing: -0.02em;
  transition: transform 0.5s var(--ease-out);
}
:lang(ka) .menu-label { font-size: clamp(1.5rem, 3.6vw, 2.4rem); line-height: 1.3; letter-spacing: 0; }
.menu-link:hover .menu-label { transform: translateX(0.75rem); }
.menu-link[aria-current="page"] .menu-label { font-style: italic; }
.menu-link[aria-current="page"] .menu-num { color: var(--moon); }
.menu-foot {
  margin-top: auto; padding-top: 2.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem;
}
.menu-note { margin: 0; font-size: 0.75rem; color: var(--muted); }
@media (max-width: 600px) {
  .menu-foot { flex-direction: column; align-items: stretch; }
  .menu-foot .btn { min-height: 3.5rem; }
}

/* small phones: the name steps down a size so the controls still fit beside it */
@media (max-width: 370px) {
  .logo-word { font-size: 1.35rem; }
}
