/* =========================================================
   WhenThen — landing page
   Theme: deep navy + monochrome blue (carried over)
   ========================================================= */

:root {
  --navy: #061828;
  --navy-rgb: 6, 24, 40;
  --navy-soft: #10324d;
  --navy-soft-rgb: 16, 50, 77;
  --blue: #1e6fb9;
  --blue-rgb: 30, 111, 185;
  --ice: #ddeaf7;
  --ice-rgb: 221, 234, 247;
  --pass: #5fd3a5;
  --pass-rgb: 95, 211, 165;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 1rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --maxw: 1180px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: var(--navy);
  color: var(--ice);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  background: var(--ice);
  color: var(--navy);
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.accent { color: #7fb6e8; }
.muted { color: rgba(var(--ice-rgb), 0.55); }

/* ------------------------- */
/* BUTTONS                   */
/* ------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.1rem 1.5rem;
  border-radius: 10px;
  font: 600 1rem / 1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.btn svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-primary {
  background: linear-gradient(180deg, var(--blue) 0%, color-mix(in srgb, var(--blue) 86%, var(--navy) 14%) 100%);
  color: var(--ice);
  box-shadow: 0 10px 30px rgba(var(--blue-rgb), 0.28), inset 0 0 0 0 rgba(var(--ice-rgb), 0);
}
.btn-primary:hover {
  box-shadow: 0 12px 34px rgba(var(--blue-rgb), 0.38), inset 0 0 0 2px rgba(var(--ice-rgb), 0.75);
}

/* Buttons rendered as <button> */
button.btn,
button.nav-cta { border: 0; font-family: var(--font); color: var(--ice); cursor: pointer; }
button.nav-cta { font-size: inherit; font-weight: inherit; line-height: inherit; }
.site-nav .nav-cta:hover { background: rgba(var(--blue-rgb), 0.32); }

/* Concept-build note */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: rgba(var(--navy-soft-rgb), 0.96);
  border: 1px solid rgba(var(--ice-rgb), 0.22);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 220ms ease, transform 220ms ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.btn-ghost {
  background: transparent;
  color: var(--ice);
}
.btn-ghost:hover { transform: scale(1.05); }

.btn-sm {
  padding: 0.95rem 1.15rem;
  border-radius: 0.8rem;
  font-size: 0.98rem;
  font-weight: 700;
}


/* ------------------------- */
/* NAV                       */
/* ------------------------- */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--gutter);
  background: linear-gradient(180deg, rgba(var(--navy-rgb), 0.85), rgba(var(--navy-rgb), 0));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; }

.site-nav nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.93rem;
  font-weight: 600;
}
.site-nav nav a { text-decoration: none; opacity: 0.85; }
.site-nav nav a:hover { opacity: 1; }
.site-nav .nav-cta {
  opacity: 1;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--ice-rgb), 0.3);
  background: rgba(var(--blue-rgb), 0.18);
}

/* ------------------------- */
/* HERO                      */
/* ------------------------- */

#hero {
  width: 100%;
  min-height: 100svh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 52% 42%, rgba(var(--navy-soft-rgb), 0.92), rgba(var(--navy-rgb), 1) 58%),
    linear-gradient(135deg, var(--navy), var(--navy-soft));
}

/* Pre-animation state, painted before GSAP runs so there is no flash.
   Values match the gsap.set() calls in main.js. If the script never runs,
   a failsafe animation reveals the content after 3s. */
@media (prefers-reduced-motion: no-preference) {
  #caption,
  #app-subheader,
  #hero-actions { opacity: 0; transform: translateY(16px); }
  #app-title-row { opacity: 0; transform: translateY(18px) scale(0.96); transform-origin: left center; }
  #caption,
  #app-subheader,
  #hero-actions,
  #app-title-row { animation: wt-failsafe 0.6s ease 3s forwards; }

  .anim-ready #caption,
  .anim-ready #app-subheader,
  .anim-ready #hero-actions,
  .anim-ready #app-title-row { animation: none; }
}
#tile-2 { transform: translate(-50%, -50%); }
#globe-wrap { transform: translate(250px, 250px) scale(0.35); transform-origin: 100% 100%; }
.hero-static #caption,
.hero-static #app-subheader,
.hero-static #hero-actions,
.hero-static #app-title-row { opacity: 1; transform: none; animation: none; }
.hero-static #globe-wrap { transform: none; }
@keyframes wt-failsafe { to { opacity: 1; transform: none; } }

/* Embedded (iframe preview): fixed height, no viewport-unit feedback */
.embedded #hero { min-height: 0; height: 780px; }
.embedded .logic-cloud { width: 100%; }

/* Logic word marquee */
.logic-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
}

.logic-cloud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  font-weight: 600;
}

.logic-word {
  position: absolute;
  white-space: nowrap;
  font-family: var(--mono);
}
.logic-word:nth-child(odd) { color: rgba(var(--ice-rgb), 0.82); }
.logic-word:nth-child(even) { color: rgba(var(--blue-rgb), 0.9); }

/* Tile 1 */
#tile-1 {
  position: relative;
  z-index: 10;
  width: min(78vw, 980px);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

#caption {
  font: 600 1rem / 1.15 var(--font);
  letter-spacing: 0.02em;
  color: var(--ice);
  text-shadow: 0 2px 12px rgba(var(--navy-rgb), 0.95), 0 0 18px rgba(var(--blue-rgb), 0.42);
}

#app-title-row {
  display: inline-flex;
  align-items: center;
  gap: 1.35rem;
  line-height: 1;
}

#app-title {
  font: 650 clamp(3.4rem, 9vw, 7.5rem) / 1.05 var(--font);
  letter-spacing: -0.02em;
  text-shadow: 5px 5px 10px var(--navy);
  color: var(--ice);
}

#app-logo {
  width: clamp(64px, 8vw, 120px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 14px rgba(var(--blue-rgb), 0.55));
}

#app-subheader {
  font: 500 clamp(1.1rem, 2vw, 1.6rem) / 1.3 var(--font);
  color: var(--ice);
}

#hero-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Tile 2 — product card */
#tile-2 {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  width: clamp(280px, 40vw, 480px);
  padding: 1.85rem 1.85rem 1.65rem;
  border-radius: var(--radius);
  opacity: 0;
  background:
    linear-gradient(135deg, rgba(var(--ice-rgb), 0.08) 0%, rgba(var(--ice-rgb), 0.02) 28%, rgba(var(--ice-rgb), 0) 55%),
    linear-gradient(180deg, rgba(var(--navy-soft-rgb), 0.94) 0%, rgba(var(--navy-rgb), 0.94) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(var(--ice-rgb), 0.34);
  box-shadow:
    0 26px 70px rgba(var(--navy-rgb), 0.56),
    inset 0 1px 0 rgba(var(--ice-rgb), 0.15),
    0 0 0 1px rgba(var(--blue-rgb), 0.14);
}

.card-eyebrow,
.eyebrow {
  display: inline-block;
  font: 700 0.72rem / 1 var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ice);
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: rgba(var(--blue-rgb), 0.2);
  border: 1px solid rgba(var(--ice-rgb), 0.24);
  margin-bottom: 0.95rem;
}

#tile-2 h2 {
  font: 700 clamp(1.45rem, 2.4vw, 2rem) / 1.16 var(--font);
  margin-bottom: 1rem;
  text-wrap: balance;
}

.card-tagline {
  font: 400 1.02rem / 1.6 var(--font);
  color: rgba(var(--ice-rgb), 0.82);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}
.card-meta li {
  font: 600 0.82rem / 1 var(--font);
  background: rgba(var(--ice-rgb), 0.06);
  border: 1px solid rgba(var(--ice-rgb), 0.16);
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.45rem;
}

/* Globe */
#globe-wrap {
  position: absolute;
  bottom: -340px;
  right: -80px;
  width: min(900px, 90vw);
  aspect-ratio: 1;
  opacity: 0;
  z-index: 5;
}

#globe {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 52px rgba(75, 163, 227, 0.22));
}

@media (min-width: 1600px) {
  #globe-wrap { width: 1200px; }
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(var(--ice-rgb), 0.6);
}
.scroll-hint i {
  width: 1px;
  height: 36px;
  background: linear-gradient(180deg, rgba(var(--ice-rgb), 0.7), transparent);
  animation: hint 1.8s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hint {
  0% { transform: scaleY(0); opacity: 1; }
  70% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* 404 page */
.section { padding: 4rem var(--gutter); }

/* Footer — distinct band marking the end of the pinned hero */
.site-footer {
  position: relative;
  z-index: 20;
  background: linear-gradient(180deg, #0c2a45 0%, #0a2238 100%);
  border-top: 1px solid rgba(var(--ice-rgb), 0.16);
  box-shadow: 0 -30px 60px rgba(var(--navy-rgb), 0.7);
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter) 2rem;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 182, 232, 0.9), transparent);
  box-shadow: 0 0 18px rgba(var(--blue-rgb), 0.8);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.5rem 2rem;
}
.footer-brand { display: flex; align-items: center; gap: 0.9rem; }
.footer-brand .brand-mark { width: 40px; height: 40px; }
.footer-brand strong { font-size: 1.15rem; }
.footer-brand p { margin-top: 0.25rem; font-size: 0.9rem; }
.footer-legal {
  grid-column: 1 / -1;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(var(--ice-rgb), 0.08);
  font-size: 0.82rem;
}
@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ------------------------- */
/* RESPONSIVE                */
/* ------------------------- */

@media (max-width: 900px) {
  #tile-1 { width: min(90vw, 680px); padding: 1.5rem; }
  #app-title-row { gap: 1rem; }
  #tile-2 { width: min(82vw, 440px); }
  #globe-wrap { width: 760px; right: -280px; bottom: -330px; }
}

@media (max-width: 700px) {
  .site-nav nav a:not(.nav-cta) { display: none; }
  #tile-1 { padding: 1rem; }
  #app-title-row { gap: 0.6rem; }
  #app-title { font-size: clamp(2.6rem, 13vw, 3.6rem); }
  #app-logo { width: clamp(40px, 11vw, 56px); }
  #hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #tile-2 { width: min(88vw, 400px); padding: 1.5rem; }
  #globe-wrap { width: 620px; right: -260px; bottom: -300px; }
  .embedded #hero { height: 720px; }
}

/* Reduced motion: no pinning, no marquee, everything visible */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i { animation: none; }
}
