/* ============================================================
   CONEN.DEV — main.css — shared foundation ("THE DEEP")
   Shared by ALL pages. Page-specific rules live in css/<page>.css
   Sections:
   01 Tokens          06 Nav + mobile menu   11 Depth HUD
   02 Reset/base      07 Footer              12 Grain / plankton
   03 Typography      08 Marquee             13 Reveal system
   04 Buttons/links   09 Cursor              14 Media frames
   05 Glass           10 Preloader/transition 15 Responsive/reduced-motion
   ============================================================ */

/* ---------- 01 TOKENS ---------- */
:root {
  --abyss: #04070d;
  --deep: #0a1020;
  --ink: #060a14;
  --glow: #57e6ff;
  --glow-soft: rgba(87, 230, 255, .35);
  --aqua: #9df5e3;
  --ghost: #e8f1f6;
  --ghost-dim: rgba(232, 241, 246, .55);
  --ghost-faint: rgba(232, 241, 246, .28);
  --line: rgba(232, 241, 246, .12);
  --glass: rgba(255, 255, 255, .04);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --section-pad: clamp(5rem, 12vw, 11rem);
  --nav-h: 64px;
}

/* ---------- 02 RESET / BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--abyss);
  color: var(--ghost);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--glow); color: var(--abyss); }

:focus-visible {
  outline: 1px solid var(--glow);
  outline-offset: 3px;
  border-radius: 2px;
}

.container {
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section { position: relative; }

.section-pad { padding-block: var(--section-pad); }

/* ---------- 03 TYPOGRAPHY ---------- */
h1, h2, h3, .h-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: .95;
}

.h-xl { font-size: clamp(3rem, 11vw, 10rem); }
.h-lg { font-size: clamp(2.4rem, 7vw, 6rem); }
.h-md { font-size: clamp(1.8rem, 4.5vw, 3.6rem); }

/* italic serif accent inside display headlines */
.si, .serif-i {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.text-dim { color: var(--ghost-dim); }
.text-faint { color: var(--ghost-faint); }
.text-glow { color: var(--glow); }

/* dive-log section kicker:
   <p class="kicker mono"><span class="kicker__bracket">[</span> 01 — SERVICES
   <span class="kicker__bracket">]</span> <span class="kicker__depth">· DEPTH -0340M</span></p> */
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ghost-faint);
  display: flex;
  align-items: center;
  gap: .5em;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.kicker__bracket { color: var(--glow); opacity: .8; }
.kicker__depth { color: var(--ghost-faint); }

/* big lead paragraph */
.lead {
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  line-height: 1.5;
  color: var(--ghost-dim);
  max-width: 34em;
}

/* ---------- 04 BUTTONS / LINKS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .7em;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: 1em 1.9em;
  border-radius: 999px;
  position: relative;
  white-space: nowrap;
  transition: color .35s var(--ease-out), box-shadow .35s var(--ease-out),
              background-color .35s var(--ease-out), transform .3s var(--ease-out);
  will-change: transform;
}

/* primary: glass pill with cyan glow hover */
.btn-primary {
  color: var(--ghost);
  background: rgba(255, 255, 255, .03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .08);
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.06) 30%,
              transparent 55%, rgba(87,230,255,.18));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.btn-primary:hover {
  color: var(--glow);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.08),
              0 0 24px rgba(87,230,255,.28), 0 0 64px rgba(87,230,255,.12);
}
.btn-primary .btn__arrow { transition: transform .35s var(--ease-out); }
.btn-primary:hover .btn__arrow { transform: translateX(4px); }

/* text link with animated underline */
.text-link {
  position: relative;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ghost-dim);
  padding-bottom: 3px;
  transition: color .3s var(--ease-out);
}
.text-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .45s var(--ease-out);
}
.text-link:hover { color: var(--glow); }
.text-link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- 05 LIQUID GLASS ---------- */
.glass {
  background: rgba(255, 255, 255, .03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .08);
}
.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.06) 30%,
              transparent 55%, rgba(87,230,255,.18));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------- 06 NAV ---------- */
.nav {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 900;
  width: min(1240px, calc(100% - 2 * var(--gutter)));
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 10px 10px 10px 24px;
  transform: translateX(-50%);
  transition: transform .5s var(--ease-out), opacity .4s ease;
}
.nav.is-hidden {
  transform: translate(-50%, calc(-100% - 24px));
  opacity: 0;
  pointer-events: none;
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .12em;
  line-height: 1;
}
.nav__brand .tld { color: var(--glow); letter-spacing: 0; }

.nav__links {
  display: flex;
  gap: clamp(.8rem, 2vw, 1.8rem);
}
.nav__link {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ghost-dim);
  padding: .5em 0;
  transition: color .3s ease;
}
.nav__link:hover { color: var(--ghost); }
.nav__link.is-active { color: var(--ghost); }
.nav__link.is-active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--glow);
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--glow);
}

.nav__cta { flex-shrink: 0; }

/* burger (mobile) */
.nav__burger {
  display: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.nav__burger span {
  position: absolute;
  left: 50%; top: 50%;
  width: 18px; height: 1.5px;
  background: var(--ghost);
  transform: translate(-50%, -50%);
  transition: transform .4s var(--ease-out);
}
.nav__burger span:nth-child(1) { transform: translate(-50%, calc(-50% - 4px)); }
.nav__burger span:nth-child(2) { transform: translate(-50%, calc(-50% + 4px)); }
body.menu-open .nav__burger span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
body.menu-open .nav__burger span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }

/* mobile overlay menu */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(4, 7, 13, .92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--gutter);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease-out), visibility 0s linear .5s;
}
body.menu-open .menu-overlay {
  opacity: 1;
  visibility: visible;
  transition: opacity .5s var(--ease-out);
}
.menu-overlay__link {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.4rem, 9vw, 4.5rem);
  line-height: 1.25;
  color: var(--ghost);
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out), color .3s ease;
}
.menu-overlay__link:hover { color: var(--glow); }
.menu-overlay__link.is-active { color: var(--glow); }
body.menu-open .menu-overlay__link { opacity: 1; transform: none; }
body.menu-open .menu-overlay__link:nth-child(1) { transition-delay: .08s; }
body.menu-open .menu-overlay__link:nth-child(2) { transition-delay: .14s; }
body.menu-open .menu-overlay__link:nth-child(3) { transition-delay: .20s; }
body.menu-open .menu-overlay__link:nth-child(4) { transition-delay: .26s; }
body.menu-open .menu-overlay__link:nth-child(5) { transition-delay: .32s; }
body.menu-open .menu-overlay__link:nth-child(6) { transition-delay: .38s; }
.menu-overlay__meta {
  margin-top: 3rem;
  color: var(--ghost-faint);
  opacity: 0;
  transition: opacity .6s ease .45s;
}
body.menu-open .menu-overlay__meta { opacity: 1; }

/* ---------- 07 FOOTER ---------- */
.footer {
  position: relative;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--abyss), var(--ink));
  overflow: hidden;
}
.footer__cta {
  padding: var(--section-pad) 0 clamp(4rem, 8vw, 7rem);
  text-align: left;
}
.footer__cta-title {
  font-size: clamp(2.6rem, 8vw, 7.5rem);
  letter-spacing: -0.03em;
  line-height: .98;
}
.footer__cta-title .si { color: var(--glow); text-shadow: 0 0 40px rgba(87,230,255,.35); }
.footer__cta .btn { margin-top: 2.5rem; }

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
.footer__brand-line {
  margin-top: 1rem;
  color: var(--ghost-dim);
  max-width: 30em;
  font-size: .95rem;
}
.footer__col h4 {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ghost-faint);
  margin-bottom: 1.2rem;
}
.footer__col ul li { margin-bottom: .6rem; }
.footer__col a {
  color: var(--ghost-dim);
  font-size: .95rem;
  transition: color .3s ease;
}
.footer__col a:hover { color: var(--glow); }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--ghost-faint);
}

/* ---------- 08 MARQUEE ---------- */
/* markup: .marquee > .marquee__track > (.marquee__group x2, identical content) */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding-block: 1.4rem;
  white-space: nowrap;
}
.marquee__track {
  display: inline-flex;
  will-change: transform;
}
.marquee__group {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  padding-right: 2.5rem;
  flex-shrink: 0;
}
.marquee__item {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.6rem);
  letter-spacing: .04em;
  color: var(--ghost-faint);
  text-transform: uppercase;
}
.marquee__dot { color: var(--glow); font-size: .8em; }

/* ---------- 09 CURSOR ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 1200;
  pointer-events: none;
  border-radius: 50%;
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--glow);
  margin: -3px 0 0 -3px;
}
.cursor-ring {
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(87, 230, 255, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .3s var(--ease-out), height .3s var(--ease-out),
              margin .3s var(--ease-out), border-color .3s ease, background-color .3s ease;
}
.cursor-ring.is-hover {
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  border-color: rgba(87, 230, 255, .9);
  background: rgba(87, 230, 255, .06);
}
.cursor-ring.has-label {
  width: 84px; height: 84px;
  margin: -42px 0 0 -42px;
  background: rgba(4, 7, 13, .75);
  border-color: var(--glow);
}
.cursor-ring__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--glow);
  opacity: 0;
  transition: opacity .25s ease;
}
.cursor-ring.has-label .cursor-ring__label { opacity: 1; }

.sonar-ping {
  position: fixed;
  z-index: 1190;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border: 1px solid var(--glow);
  border-radius: 50%;
  pointer-events: none;
  animation: sonar .7s var(--ease-out) forwards;
}
@keyframes sonar {
  from { transform: scale(1); opacity: .9; }
  to   { transform: scale(7); opacity: 0; }
}

body.has-cursor, body.has-cursor a, body.has-cursor button,
body.has-cursor [data-magnetic], body.has-cursor [data-cursor] { cursor: none; }

/* ---------- 10 PRELOADER + PAGE TRANSITION ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1500;
  pointer-events: none;
}
.preloader__panel {
  position: absolute;
  left: 0; width: 100%; height: 50.5%;
  background: var(--ink);
  will-change: transform;
}
.preloader__panel--top { top: 0; }
.preloader__panel--bottom { bottom: 0; }
.preloader__panel--top::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0; width: 100%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--glow-soft), transparent);
}
.preloader__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 2;
}
.preloader__depth {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  letter-spacing: .14em;
  color: var(--ghost);
  font-variant-numeric: tabular-nums;
}
.preloader__line {
  width: 1px;
  height: 0;
  background: var(--glow);
  box-shadow: 0 0 12px var(--glow-soft);
  transition: height 1.8s var(--ease-in-out);
}
.preloader__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ghost-faint);
}
.preloader.is-opening .preloader__panel--top { transform: translateY(-101%); }
.preloader.is-opening .preloader__panel--bottom { transform: translateY(101%); }
.preloader.is-opening .preloader__panel { transition: transform .9s var(--ease-in-out); }
.preloader.is-opening .preloader__center { opacity: 0; transition: opacity .3s ease; }
.preloader.is-done { display: none; }

/* page transition veil (exit) */
.transition-veil {
  position: fixed;
  inset: -5% 0 0 0;
  z-index: 1400;
  background: var(--ink);
  transform: translateY(105%);
  border-radius: 40% 40% 0 0 / 6% 6% 0 0;
  pointer-events: none;
  will-change: transform;
}
body.is-exiting .transition-veil {
  transform: translateY(0);
  border-radius: 0;
  transition: transform .5s var(--ease-in-out), border-radius .5s ease;
}

/* quick entrance for pages after first dive */
.page-enter { opacity: 0; }
.page-enter.page-enter--go {
  opacity: 1;
  transition: opacity .4s ease;
}

/* ---------- 11 DEPTH HUD ---------- */
.depth-hud {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .9rem;
  pointer-events: none;
}
.depth-hud__readout {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ghost-dim);
  font-variant-numeric: tabular-nums;
  writing-mode: vertical-rl;
}
.depth-hud__readout .depth-hud__m { color: var(--glow); }
.depth-hud__track {
  position: relative;
  width: 1px;
  height: 180px;
  background: var(--line);
}
.depth-hud__marker {
  position: absolute;
  left: 50%;
  top: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px var(--glow-soft);
  transform: translate(-50%, -50%);
  will-change: top;
}
.depth-hud__section {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ghost-faint);
  writing-mode: vertical-rl;
}

/* ---------- 12 GRAIN + PLANKTON ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
  opacity: .04;
}
.plankton {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* content sits above plankton (NOT .nav — it must stay position:fixed / z-index:900) */
main, .footer { position: relative; z-index: 2; }

/* ---------- 13 REVEAL SYSTEM ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  filter: blur(6px);
  will-change: transform, opacity, filter;
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), filter .9s var(--ease-out);
}

/* split headline line masks */
[data-split] .split-line {
  display: block;
  overflow: hidden;
  clip-path: inset(-20% 0 -20% 0);
}
[data-split] .split-word {
  display: inline-block;
  will-change: transform;
}
[data-split] .split-char { display: inline-block; will-change: transform; }
[data-split]:not(.split-done) { visibility: hidden; }

/* ---------- 14 MEDIA FRAMES (video + designed fallback) ---------- */
/* markup: .media-frame > .media-fallback + video.lazy-video[data-src][muted][playsinline] */
.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--ink);
}
.media-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0; /* CONEN.initVideo fades it in */
}
.media-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(87,230,255,.12), transparent 55%),
    radial-gradient(90% 80% at 75% 85%, rgba(157,245,227,.07), transparent 60%),
    linear-gradient(160deg, var(--deep), var(--abyss) 70%);
}
.media-fallback::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(closest-side, rgba(87,230,255,.14), transparent 70%);
  animation: fallback-drift 14s var(--ease-in-out) infinite alternate;
}
@keyframes fallback-drift {
  from { transform: translate(-12%, -8%) scale(.9); }
  to   { transform: translate(12%, 10%) scale(1.1); }
}

/* ---------- 15 RESPONSIVE / REDUCED MOTION ---------- */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .nav__cta { display: none; }
  .nav__burger { display: block; }
  .depth-hud { display: none; }
  .footer__grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { --nav-h: 56px; }
  .nav { top: 10px; padding: 8px 8px 8px 18px; }
}

@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
  [data-split]:not(.split-done) { visibility: visible; }
  .cursor-dot, .cursor-ring, .plankton { display: none !important; }
  .media-fallback::after { animation: none; }
}
