/* =====================================================================
   layout.css — page structure: the ocean zones, the canvas layer, the
   top navigation + mobile menu, the depth gauge and the footer.
   ✏️ Safe to edit: spacing and sizes. Colors come from tokens.css.
   ===================================================================== */

/* ---------- Background canvas (behind content, above section colors) ---------- */
.ocean-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-canvas);
  pointer-events: none;
}

main:focus {
  outline: none;
}

/* ---------- Zones (each section is a slice of water) ----------
   --zone-from / --zone-to are set per section by main.js from its depth. */
.zone {
  position: relative;
  padding-block: var(--space-8);
  background: linear-gradient(to bottom, var(--zone-from, var(--zone-0)), var(--zone-to, var(--zone-0)));
  color: var(--c-text);
  scroll-margin-top: 0;
}

@media (min-width: 768px) {
  .zone {
    padding-block: var(--space-9);
  }
}

/* Content sits above the canvas; the section's own background sits below it. */
.zone > *,
.site-footer > * {
  position: relative;
  z-index: var(--z-content);
}

/* Headings aren't hidden under the fixed nav when jumping to a section */
.zone h2,
.zone [id] {
  scroll-margin-top: calc(var(--nav-height) + var(--space-3));
}

/* The band where light fades out between the sunlit and dark zones */
.thermocline {
  position: relative;
  height: clamp(7rem, 16vw, 12rem);
  display: flex;
  justify-content: center;
  padding-top: var(--space-4);
  background: linear-gradient(to bottom, var(--zone-light-end), var(--zone-to));
}

.thermocline__label {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: fit-content;
  color: var(--ink);
  font-size: 0.76rem;
}

.thermocline__label::before,
.thermocline__label::after {
  content: "";
  width: clamp(1.5rem, 8vw, 5rem);
  border-top: 1px dashed currentColor;
  opacity: 0.6;
}

/* ---------- Top navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-nav);
}

.nav {
  color: var(--c-text);
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out);
}

.nav.is-scrolled {
  background: var(--c-bar);
  border-bottom-color: var(--c-border);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: min(100% - 2 * var(--space-3), 90rem);
  height: var(--nav-height);
  margin-inline: auto;
}

.nav__brand {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--c-text);
  text-decoration: none;
}

.nav__cell {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1.5px solid currentColor;
  border-radius: 58% 42% 55% 45% / 48% 58% 42% 52%;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: membrane 14s ease-in-out infinite;
}

.nav__links {
  display: none;
  margin-left: auto;
}

.nav__links ul {
  display: flex;
  gap: 2px;
  list-style: none;
  padding: 0;
}

.nav__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.7rem;
  border-radius: var(--radius-pill);
  color: var(--c-text);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav__link:hover,
.nav__link.is-active {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

.nav__link-depth {
  display: none;
}

.nav__actions {
  display: none;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* (".nav" prefix so these win over the generic .btn styles) */
.nav .nav__burger {
  margin-left: auto;
}

.btn.nav__print {
  display: none;
}

.cv-mode .btn.nav__print {
  display: inline-flex;
}

@media (min-width: 640px) {
  .nav__actions {
    display: flex;
  }
  .nav .nav__burger {
    margin-left: 0;
  }
}

@media (min-width: 1280px) {
  .nav__links {
    display: block;
  }
  .nav__actions {
    margin-left: var(--space-2);
  }
  .nav .nav__burger {
    display: none;
  }
}

/* Language switch (hidden unless features.languageSwitch is true) */
.lang-switch {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  padding: 2px;
}

.lang-switch__btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-pill);
  color: var(--c-muted);
}

.lang-switch__btn[aria-pressed="true"] {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

/* ---------- Mobile menu (full-screen, opens with a ripple) ---------- */
.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  color: var(--foam);
  overflow: hidden;
}

.menu__ripple {
  position: absolute;
  left: var(--ripple-x, 90%);
  top: var(--ripple-y, 2rem);
  width: 300vmax;
  height: 300vmax;
  margin: -150vmax 0 0 -150vmax;
  border-radius: 50%;
  background: var(--zone-6);
  transform: scale(0);
  transition: transform 500ms var(--ease-out);
}

.menu.is-open .menu__ripple {
  transform: scale(1);
}

.menu__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  height: 100%;
  overflow-y: auto;
  padding: calc(var(--nav-height) + var(--space-3)) var(--gutter) var(--space-6);
  opacity: 0;
  transition: opacity 300ms var(--ease-out) 120ms;
}

.menu.is-open .menu__panel {
  opacity: 1;
}

.menu__close {
  position: absolute;
  top: calc((var(--nav-height) - 44px) / 2);
  right: var(--space-3);
}

.menu__list {
  list-style: none;
  padding: 0;
}

.menu__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--glass-border);
  color: var(--foam);
  font-family: var(--font-display);
  font-size: var(--step-2);
  text-decoration: none;
}

.menu__link-depth {
  color: var(--foam-muted);
}

.menu__link.is-active,
.menu__link:hover {
  color: var(--glow);
}

.menu__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.menu-open {
  overflow: hidden;
}

/* ---------- Depth gauge (≥1024px) + depth pill (smaller screens) ---------- */
.gauge {
  display: none;
}

@media (min-width: 1024px) {
  .gauge {
    --gauge-height: min(44vh, 26rem);
    position: fixed;
    top: 50%;
    right: var(--space-3);
    z-index: var(--z-float);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    color: var(--c-text);
    transform: translateY(-50%);
  }
}

.gauge__track {
  position: relative;
  width: 28px;
  height: var(--gauge-height);
}

.gauge__track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: currentColor;
  opacity: 0.35;
}

.gauge__indicator {
  position: absolute;
  top: 0;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 0 4px var(--c-accent-soft), 0 0 14px var(--c-accent);
  transition: transform 160ms linear;
}

.gauge__ticks {
  list-style: none;
  padding: 0;
}

.gauge__tick-item {
  position: absolute;
  left: 0;
  width: 28px;
  transform: translateY(-50%);
}

.gauge__tick {
  position: relative;
  display: block;
  width: 28px;
  height: 24px;
}

.gauge__tick::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  border-top: 1.5px solid currentColor;
  opacity: 0.5;
}

.gauge__tick.is-passed::before {
  opacity: 1;
}

.gauge__tick-label {
  position: absolute;
  top: 50%;
  right: calc(100% + 6px);
  padding: 3px 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  background: var(--c-bar);
  color: var(--c-text);
  font-size: 0.74rem;
  white-space: nowrap;
  opacity: 0;
  transform: translate(6px, -50%);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

.gauge__tick:hover .gauge__tick-label,
.gauge__tick:focus-visible .gauge__tick-label {
  opacity: 1;
  transform: translate(0, -50%);
}

.gauge__readout {
  padding: 10px 4px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  background: var(--c-bar);
  font-size: 0.72rem;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-variant-numeric: tabular-nums;
}

.depth-pill {
  position: fixed;
  bottom: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-float);
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-pill);
  background: var(--c-bar);
  color: var(--c-text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.depth-pill:empty {
  display: none;
}

@media (min-width: 1024px) {
  .depth-pill {
    display: none;
  }
}

/* ---------- Floating "Back to surface" button ---------- */
.surface-btn {
  position: fixed;
  right: var(--space-3);
  bottom: var(--space-3);
  z-index: var(--z-float);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--zone-5);
  color: var(--glow);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out);
}

.surface-btn .icon {
  width: 22px;
  height: 22px;
}

.surface-btn.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.surface-btn:hover {
  transform: translateY(-3px);
}

@media (min-width: 1024px) {
  .surface-btn {
    right: calc(var(--space-3) + 48px);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  padding: var(--space-6) 0 var(--space-8);
  border-top: 1px solid var(--glass-border);
  background: var(--zone-7);
  color: var(--foam);
}

.footer {
  display: grid;
  gap: var(--space-3);
}

.footer__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.footer__name {
  font-family: var(--font-display);
  font-size: var(--step-1);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  list-style: none;
  padding: 0;
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--foam-muted);
}

.footer__links a:hover {
  color: var(--glow);
}

.footer__row--small {
  color: var(--foam-muted);
}

.footer__log {
  color: var(--glow);
}

.footer__built {
  color: var(--foam-muted);
  font-size: var(--step--1);
}
