/* bioce.cloud apex landing — BioCE navy system (locked estate brand).
   Theme: dark only. Accent: sky #35b8f0 (+ deep #1f8fce in the one brand
   gradient). Shape rule: 28px outer panels, 18px nested media, pill controls.
   Motion: scroll-linked movement is linear (driven by main.js); entrances use
   cubic-bezier(.16,1,.3,1). Reduced motion collapses everything to static. */

/* ── Fonts (self-hosted) ─────────────────────────────────────────────────── */
@font-face { font-family: 'Sora'; font-weight: 600; font-display: swap;
  src: url('/assets/fonts/Sora-600-latin.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap;
  src: url('/assets/fonts/Sora-700-latin.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap;
  src: url('/assets/fonts/Inter-400-latin.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap;
  src: url('/assets/fonts/Inter-500-latin.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap;
  src: url('/assets/fonts/Inter-600-latin.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Thai'; font-weight: 400; font-display: swap;
  src: url('/assets/fonts/NotoSansThai-400-thai.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Thai'; font-weight: 600; font-display: swap;
  src: url('/assets/fonts/NotoSansThai-600-thai.woff2') format('woff2'); }

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --canvas: #071426;
  --canvas2: #0a1c33;
  --card: #0c2036;
  --card2: #0e2440;
  --ink: #eef4fb;
  --body: #b9c6d9;
  --muted: #7f94ad;
  --accent: #35b8f0;
  --accent-deep: #1f8fce;
  --line: rgba(148, 178, 215, .10);
  --line2: rgba(148, 178, 215, .18);
  --nav-h: 68px;
  --r-panel: 28px;
  --r-media: 18px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --display: 'Sora', 'Noto Sans Thai', sans-serif;
  --text: 'Inter', 'Noto Sans Thai', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
/* Smooth anchor scrolling is a motion enhancement, not a default. */
html.motion-ready { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html.motion-ready { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font: 400 16px/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Bilingual: exactly one language renders at a time (estate pattern). */
html[data-lang="en"] .th { display: none; }
html[data-lang="th"] .en { display: none; }
html[data-lang="th"] body { line-height: 1.75; }

h1, h2, h3 { font-family: var(--display); color: var(--ink); margin: 0; }
html[data-lang="th"] h1, html[data-lang="th"] h2, html[data-lang="th"] h3 {
  letter-spacing: 0;
  line-height: 1.18;
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

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

/* ── Buttons (estate pill system) ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font: 600 15px/1 var(--text);
  white-space: nowrap;
  transition: transform .18s var(--ease-out), border-color .18s, box-shadow .18s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #04121f;
  box-shadow: 0 8px 28px rgba(53, 184, 240, .22);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
  border: 1px solid rgba(238, 244, 251, .22);
  color: var(--ink);
  background: rgba(255, 255, 255, .03);
}
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-1px); }
@media (min-width: 768px) { .btn { height: 56px; padding: 0 30px; } }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(7, 20, 38, .82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(238, 244, 251, .10);
  animation: nav-in .5s var(--ease-out) both;
}
@keyframes nav-in { from { opacity: 0; transform: translateY(-8px); } }
.nav-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand img { border-radius: 8px; }
.brand-name { font: 700 19px var(--display); letter-spacing: -.02em; }
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-link { color: var(--body); font-size: 14.5px; font-weight: 500; }
.nav-link:hover { color: var(--ink); }
.lang-toggle {
  cursor: pointer;
  border: 1px solid var(--line2);
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 15px;
  font: 600 13px var(--text);
  transition: border-color .2s;
}
.lang-toggle:hover { border-color: var(--accent); }
.nav .nav-cta { height: 42px; padding: 0 20px; font-size: 14px; }
@media (max-width: 767px) {
  :root { --nav-h: 60px; }
  .hide-sm { display: none; }
  .nav .nav-cta { padding: 0 16px; }
}

/* ── Hero: the gateway aperture ──────────────────────────────────────────── */
/* DEFAULT (no JS / reduced motion / mobile): a normal static hero, fully
   readable. The 155vh pin + sticky scene are opt-in via html.motion-ready,
   which only exists when JS runs and motion is allowed. */
.hero-wrap { height: auto; }
.hero-scene {
  min-height: calc(100dvh - var(--nav-h));
  padding: calc(var(--nav-h) + 24px) 0 64px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(1100px 520px at 78% 8%, rgba(53, 184, 240, .10), transparent 60%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas2) 100%);
}
@media (min-width: 768px) {
  .motion-ready .hero-wrap { height: 155vh; }
  .motion-ready .hero-scene {
    position: sticky;
    top: var(--nav-h);
    height: calc(100dvh - var(--nav-h));
    padding: 0;
  }
}
.hero-grid {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 0 64px;
  display: grid;
  grid-template-columns: 6fr 6fr;
  align-items: center;
  gap: 56px;
}
.hero-copy h1 {
  font-size: clamp(36px, 3.8vw, 55px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.045em;
}
html[data-lang="th"] .hero-copy h1 { line-height: 1.18; font-size: clamp(34px, 3.7vw, 54px); }
.hero-sub {
  margin: 22px 0 0;
  max-width: 44ch;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.55;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

/* Portal frame + shutters. --ap is aperture progress: 0 closed, 1 fully open.
   The load intro transitions to .42; scroll scrub then writes --ap directly. */
.hero-visual { min-width: 0; }
.portal {
  --ap: 0;
  position: relative;
  border-radius: var(--r-panel);
  overflow: hidden;
  border: 1px solid var(--line2);
  background: var(--card);
  box-shadow: 0 40px 90px rgba(2, 8, 20, .55);
}
.portal-shot { width: 100%; transform: scale(1.06); transform-origin: center; }
.shutter {
  /* Shutters exist only on the motion path — a no-JS or reduced-motion visit
     sees the portal fully open, nothing covered. */
  display: none;
  position: absolute;
  inset: 0 auto 0 0;
  width: 51%;
  background: linear-gradient(105deg, var(--canvas2), var(--card2));
  border-right: 1px solid var(--line2);
  transform: translateX(calc(-104% * var(--ap)));
}
.motion-ready .shutter { display: block; }
.shutter-r {
  inset: 0 0 0 auto;
  border-right: none;
  border-left: 1px solid var(--line2);
  background: linear-gradient(255deg, var(--canvas2), var(--card2));
  transform: translateX(calc(104% * var(--ap)));
}
.portal.intro .shutter { transition: transform .9s var(--ease-out); }
.portal.intro .portal-shot { transition: transform .9s var(--ease-out); }
.portal.open { --ap: .42; }
.portal.open .portal-shot { transform: scale(1.025); }
.portal-caption {
  margin: 14px 4px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
}

/* Load-in entrances (hero copy). Gated on .motion-ready so a no-JS visit
   renders everything in place; .booted (added by JS two frames after load)
   triggers the staggered rise via plain transitions — deterministic in every
   renderer, no keyframe/delay edge cases. */
.motion-ready .reveal-load {
  opacity: 0;
  transform: translateY(18px);
  transition: transform .72s var(--ease-out) var(--d, 0ms), opacity .6s ease-out var(--d, 0ms);
}
.motion-ready.booted .reveal-load { opacity: 1; transform: none; }

@media (max-width: 767px) {
  .hero-scene { padding: calc(var(--nav-h) + 16px) 0 64px; }
  .hero-grid { grid-template-columns: 1fr; padding: 0 20px; gap: 36px; }
  /* The desktop two-line break must never clip a narrow viewport. */
  .hero-copy h1 br { display: none; }
  .hero-copy h1 { font-size: clamp(32px, 8.6vw, 42px); }
  .portal-shot { aspect-ratio: 16 / 11; object-fit: cover; object-position: top; }
  .hero-ctas .btn { flex: 0 1 auto; }
}
@media (max-width: 380px) { .hero-ctas { flex-direction: column; align-items: stretch; } }

/* ── Estate statement ────────────────────────────────────────────────────── */
.estate {
  min-height: 92vh;
  display: flex;
  align-items: center;
  background: var(--canvas);
}
.estate-inner { width: 100%; max-width: 1440px; margin: 0 auto; padding: 96px 64px 96px 8vw; }
.estate-line {
  font-size: clamp(44px, 6vw, 80px);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.06;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.estate-sub { margin: 28px 0 0; max-width: 42ch; font-size: clamp(17px, 1.5vw, 20px); color: var(--body); }

/* Converging lines: opposite entry directions resolve on one axis. */
.motion-ready .converge { display: block; opacity: .15; transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.motion-ready .converge.from-left { transform: translateX(-40px); }
.motion-ready .converge.from-right { transform: translateX(40px); }
.motion-ready .is-visible .converge { opacity: 1; transform: none; }
@media (max-width: 767px) {
  .estate { min-height: 0; }
  .estate-inner { padding: 96px 20px; }
  .motion-ready .converge.from-left, .motion-ready .converge.from-right { transform: translateY(20px); }
}

/* ── Destination shelf ───────────────────────────────────────────────────── */
/* DEFAULT (no JS / reduced motion): a static asymmetric grid — complete and
   readable with zero script. The 420vh pinned horizontal shelf is opt-in via
   html.motion-ready on desktop. */
.shelf-wrap { height: auto; background: var(--canvas2); }
.shelf-stage { height: auto; }
.shelf-head { padding: 96px 20px 0; max-width: 1440px; margin: 0 auto; }
@media (min-width: 768px) { .shelf-head { padding: 128px 64px 0; } }
.eyebrow {
  margin: 0 0 10px;
  font: 600 12.5px var(--text);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.shelf-head h2 { font-size: clamp(30px, 3.6vw, 52px); letter-spacing: -.035em; }

/* Static default: vertical stack (mobile) / asymmetric grid (desktop). */
.shelf { display: flex; flex-direction: column; gap: 18px; padding: 24px 20px 96px; }
@media (min-width: 768px) {
  .shelf {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 48px 64px 128px;
  }
  .tile[data-tile="0"] { grid-column: span 7; }
  .tile[data-tile="1"] { grid-column: span 5; }
  .tile[data-tile="2"] { grid-column: span 5; }
  .tile[data-tile="3"] { grid-column: span 7; }
}

.tile {
  min-height: 430px;
  border-radius: var(--r-panel);
  border: 1px solid var(--line2);
  background: linear-gradient(180deg, var(--card), var(--card2));
  padding: clamp(20px, 3vh, 36px) clamp(22px, 2.6vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--body);
  overflow: hidden;
  will-change: transform, opacity;
}
.tile h3 { font-size: clamp(30px, 3.4vw, 52px); letter-spacing: -.035em; line-height: 1.05; }
.tile-meta { display: flex; align-items: center; gap: 14px; }
.status {
  font: 600 12.5px var(--text);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
}
.status-live { color: #052030; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); }
.status-soon { color: var(--muted); border: 1px solid var(--line2); }
.domain { font: 500 13px var(--text); letter-spacing: .02em; color: var(--muted); }
.tile-blurb { margin: 0; max-width: 52ch; font-size: clamp(15px, 1.2vw, 17px); }
.tile-shot {
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  border-radius: var(--r-media);
  overflow: hidden;
  border: 1px solid var(--line);
}
.tile-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tile-cta {
  color: var(--accent);
  font: 600 14.5px var(--text);
  margin-top: 8px;
}
.tile-live { transition: border-color .24s cubic-bezier(.2, .8, .2, 1); }
.tile-live:hover, .tile-live:focus-visible { border-color: var(--accent); }

/* Coming-soon tiles: quiet typographic surface, deliberately still. */
.tile-soon { cursor: default; }
.tile-quiet {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-media);
  border: 1px dashed var(--line2);
  margin-top: 8px;
}
.tile-quiet span {
  font: 600 clamp(56px, 8vw, 120px) var(--display);
  letter-spacing: -.04em;
  color: rgba(238, 244, 251, .06);
}

@media (max-width: 767px) { .tile-shot { min-height: 200px; } }

/* The PINNED horizontal shelf: opt-in enhancement (JS + desktop + motion OK).
   Everything above is the complete static page it degrades back to. */
@media (min-width: 768px) {
  .motion-ready .shelf-wrap { height: 420vh; }
  .motion-ready .shelf-stage {
    position: sticky;
    top: var(--nav-h);
    height: calc(100dvh - var(--nav-h));
    overflow: hidden;
  }
  .motion-ready .shelf-head { padding: 6vh 64px 0; }
  .motion-ready .shelf {
    position: absolute;
    inset: 0;
    display: block;
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .motion-ready .tile {
    position: absolute;
    left: 50%;
    top: 57%;
    width: min(72vw, 1040px);
    height: 66vh;
    min-height: 0;
    /* Vertical centering lives on `translate` so the scrub JS owns `transform`
       (horizontal travel + scale) without recomputing the -50% Y each frame. */
    translate: 0 -50%;
    transform: translate3d(-50%, 0, 0);
  }
  .motion-ready .tile-cta {
    position: absolute;
    right: clamp(22px, 2.6vw, 40px);
    top: clamp(20px, 3vh, 36px);
    margin: 0;
    visibility: hidden;
  }
  .motion-ready .tile-live:hover .tile-cta,
  .motion-ready .tile-live:focus-visible .tile-cta { visibility: visible; }
}

/* ── Route ledger ────────────────────────────────────────────────────────── */
.routes { max-width: 1440px; margin: 0 auto; padding: 144px 64px; }
.routes > h2 { font-size: clamp(32px, 4vw, 58px); letter-spacing: -.035em; max-width: 16ch; }
.route-band {
  margin-top: 72px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  transition: transform .3s var(--ease-out);
}
.route-band:hover { transform: translateX(8px); }
.route-band-offset { margin-left: 10vw; }
.route-band-offset:hover { transform: translateX(-8px); }
.route-copy h3 { font-size: clamp(26px, 2.8vw, 42px); letter-spacing: -.025em; }
.route-copy p { margin: 12px 0 10px; max-width: 48ch; font-size: clamp(15px, 1.2vw, 17px); }
.route-band .domain { transition: color .3s; }
.route-band:hover .domain { color: var(--body); }
.route-divider { height: 1px; background: var(--line); margin-top: 72px; }
@media (max-width: 767px) {
  .routes { padding: 80px 20px; }
  .route-band, .route-band-offset { margin-left: 0; flex-direction: column; align-items: flex-start; min-height: 0; margin-top: 48px; }
  .route-band:hover, .route-band-offset:hover { transform: none; }
  .route-divider { margin-top: 48px; }
}

/* ── Closing route ───────────────────────────────────────────────────────── */
.closing {
  min-height: 92dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--canvas2);
}
.closing-grid {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 128px 64px 96px;
  display: grid;
  grid-template-columns: 7fr 5fr;
  align-items: end;
  gap: 48px;
}
.closing-copy h2 { font-size: clamp(34px, 4.2vw, 62px); letter-spacing: -.035em; }
.closing-copy p { margin: 18px 0 0; max-width: 46ch; font-size: clamp(16px, 1.4vw, 19px); }
.closing-copy .btn { margin-top: 30px; }
.closing-note { font-size: 14px; color: var(--muted); }
.closing-mark { display: flex; justify-content: flex-end; }
.closing-mark img { width: min(420px, 100%); opacity: .14; border-radius: 40px; }
.footer {
  border-top: 1px solid var(--line);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 64px;
  font-size: 13.5px;
  color: var(--muted);
}
.footer nav { display: flex; gap: 22px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }
@media (max-width: 767px) {
  .closing-grid { grid-template-columns: 1fr; padding: 80px 20px 64px; }
  .closing-mark { justify-content: flex-start; }
  .closing-mark img { width: 180px; opacity: .10; }
  .footer { padding: 16px 20px; }
}

/* ── Scroll reveals (generic) ────────────────────────────────────────────── */
.motion-ready .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: transform .7s var(--ease-out), opacity .52s ease-out;
}
.motion-ready .reveal.from-left { transform: translateX(-56px); }
.motion-ready .reveal.from-right { transform: translateX(56px); }
.motion-ready .reveal.is-visible { opacity: 1; transform: none; }
@media (max-width: 767px) {
  .motion-ready .reveal.from-left, .motion-ready .reveal.from-right { transform: translateY(24px); }
}

/* Reduced motion: everything static, everywhere. */
@media (prefers-reduced-motion: reduce) {
  .motion-ready .reveal, .motion-ready .reveal-load, .motion-ready .converge {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
  .shutter { display: none !important; }
  .portal .portal-shot { transform: none !important; }
  .nav { animation: none; }
}
