/* ============================================================
   Cosmic Robotics - minimal site styles
   ============================================================ */

:root {
  --black: #000000;
  --ink: #0a0c10;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --hairline: rgba(255, 255, 255, 0.16);
  --teal: #00c7a6;
  --max: 1400px;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--black);
  color: var(--white);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ---------------- Accessibility ---------------- */
/* Visible keyboard focus ring (keyboard only, not mouse clicks) on every interactive element. */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 2px;
}
/* The solid-white CTAs sit on bright media; the offset teal ring lands on the dark page
   around them and stays visible. */
.btn:focus-visible { outline-offset: 4px; }

/* Skip-to-content link: off-screen until focused, then drops into view for keyboard users. */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  transform: translateY(-130%);
  background: var(--white);
  color: var(--black);
  padding: 0.7rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0 0 4px 0;
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------------- Header ---------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 2.5vw, 1.75rem) var(--pad);
  transition: background-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}
.site-header.scrolled {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}
/* Resting (un-scrolled) header: a soft top scrim so nav links stay legible over bright
   hero frames before any scroll. Fades out once the solid scrolled background takes over. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.site-header.scrolled::before { opacity: 0; }

.wordmark { display: inline-flex; align-items: center; }
.logo {
  display: block;
  height: clamp(19px, 2.4vw, 28px);
  width: auto;
}

.site-nav { display: flex; align-items: center; gap: clamp(1.25rem, 2.5vw, 2rem); }

.nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  transition: color 0.25s var(--ease);
}
.nav-link:hover { color: var(--white); }

/* ---------------- Panels (full-viewport sections) ---------------- */
.panel {
  position: relative;
  min-height: 100vh;           /* fallback for browsers without svh (Safari < 15.4) */
  min-height: 100svh;
  display: flex;
  align-items: flex-end;       /* anchor content low, SpaceX-style */
  overflow: hidden;
}

.media { position: absolute; inset: 0; z-index: 0; background-color: var(--black); }

/* Gradient fallbacks shown before real media is dropped in */
#hero .media     { background: radial-gradient(120% 90% at 50% 10%, #16202e 0%, #070a0f 55%, #000 100%); }
#beyond .media   { background: linear-gradient(180deg, #0a0e16 0%, #2a2622 55%, #5a4f44 100%); }
#platform .media { background: radial-gradient(120% 100% at 70% 30%, #122033 0%, #0a0e16 60%, #000 100%); }

.media-asset {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Darkening scrim for legibility */
.scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0) 35%),
    linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 55%);
}

.panel-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(4rem, 11vh, 9rem);
}

.title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.02;
  font-size: clamp(2rem, 7.5vw, 4.5rem);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.45);
  hyphens: none;
  overflow-wrap: break-word;
}

.flavor {
  margin-top: 1.1rem;
  max-width: 40ch;
  font-weight: 400;
  font-size: clamp(1rem, 1.7vw, 1.4rem);
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65), 0 2px 28px rgba(0, 0, 0, 0.65);
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
  padding: 0.85rem 2rem;
  background: var(--white);
  color: var(--black);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--white);
  border-radius: 2px;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { background: transparent; color: var(--white); }

.btn-ghost {
  margin-top: 0;
  background: transparent;
  color: var(--white);
  border-color: var(--hairline);
}
.btn-ghost:hover { background: var(--white); color: var(--black); border-color: var(--white); }

.btn-sm {
  margin-top: 0;
  padding: 0.6rem 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

/* Constellation tease button - teal-accented to draw the eye toward the product */
.btn-constellation {
  background: transparent;
  color: var(--white);
  border-color: var(--teal);
  position: relative;
  gap: 0.5em;
}
.constellation-mark {
  flex-shrink: 0;
  color: var(--teal);
  transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn-constellation::after {
  content: "\2197"; /* ↗ */
  margin-left: 0.15em;
  font-size: 0.9em;
  color: var(--teal);
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
}
.btn-constellation:hover {
  background: var(--teal);
  color: #04130f;
  border-color: var(--teal);
}
.btn-constellation:hover .constellation-mark { color: #04130f; transform: rotate(90deg); }
.btn-constellation:hover::after { color: #04130f; transform: translate(2px, -2px); }

/* ---------------- Reveal-on-scroll ---------------- */
/* The hidden start-state is scoped to .js (set on <html> by the head script) so that
   WITHOUT working JavaScript everything is visible — the page is never blank. */
.reveal { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal { opacity: 0; transform: translateY(26px); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.flavor.reveal { transition-delay: 0.12s; }

/* ---------------- Scroll cue ---------------- */
.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1.4rem, 3.5vh, 2.4rem);
  transform: translateX(-50%);
  z-index: 3;
  width: 24px;
  height: 40px;
  display: flex;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.3s var(--ease);
}
.scroll-cue:hover { opacity: 1; }
.scroll-cue-line {
  position: relative;
  width: 1px;
  height: 100%;
  background: var(--hairline);
  overflow: hidden;
}
.scroll-cue-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -60%;
  width: 100%;
  height: 60%;
  background: var(--white);
  animation: scrollCue 2.1s var(--ease) infinite;
}
@keyframes scrollCue {
  0%   { transform: translateY(0); }
  100% { transform: translateY(280%); }
}

/* ---------------- Ground Truth (news) ---------------- */
.news {
  background: var(--black);
  padding: clamp(4rem, 10vh, 8rem) 0;
  border-top: 1px solid var(--hairline);
}
.news-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}
.news-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.news-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: clamp(2rem, 5vw, 3.5rem);
}
.news-kicker {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
.news-card {
  display: block;
  color: var(--white);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.news-card:hover { border-color: var(--teal); transform: translateY(-4px); }
.news-card-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: radial-gradient(120% 120% at 60% 20%, #16202e 0%, #0a0e16 70%);
}
.news-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease);
}
.news-card:hover .news-card-media img { transform: scale(1.04); }
.news-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.news-card-tag { color: var(--teal); font-weight: 600; }
.news-card-headline {
  padding: 0.7rem 1.25rem 1.4rem;
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.22;
}

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--black);
  border-top: 1px solid var(--hairline);
  padding: clamp(2rem, 5vw, 3.5rem) var(--pad);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.footer-row {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-logo { height: clamp(24px, 3vw, 34px); width: auto; display: block; }
.footer-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-actions .btn { margin-top: 0; }
.footer-meta { font-size: 0.8rem; color: var(--muted); letter-spacing: 0.04em; }
.footer-meta .nav-link { text-transform: none; }
.footer-links { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }

/* ---------------- Responsive ---------------- */

/* On narrower screens, full-bleed cover-cropping wastes the media (e.g. it slices the sides
   off the 16:9 Constellation dashboard) and a full-height panel leaves dead space. So below
   800px every panel collapses to a compact "framed" stack: the whole media frame on top
   (image or video, sized to its own height — no crop, no bars) with the title directly
   beneath it, and the panel shrinks to fit. Wider screens keep the immersive full-bleed look. */
@media (max-width: 800px) {
  .panel {
    min-height: 0;
    flex-direction: column;
    justify-content: flex-start;
  }
  .panel .media {
    position: relative;
    inset: auto;
  }
  .panel .media-asset {
    position: relative;
    inset: auto;
    height: auto;
  }
  .panel-content {
    padding-top: 1.4rem;
    padding-bottom: 2.4rem;
  }
  /* Compact hero has no room for the scroll cue */
  #hero .scroll-cue { display: none; }
}

@media (max-width: 600px) {
  .flavor { max-width: 30ch; }
  .footer-row { flex-direction: column; align-items: flex-start; }
  /* Keep the header to logo + Constellation + Inquire on small screens */
  .site-nav .nav-link { display: none; }
  .site-nav { gap: 0.6rem; }
  .btn-sm { padding: 0.5rem 0.75rem; font-size: 0.6rem; letter-spacing: 0.06em; }
  /* The HEADER Constellation button collapses to just its sparkle mark on mobile to save
     width. Scoped to .site-nav so the in-section CTA keeps its full label + arrow. */
  .site-nav .btn-constellation { padding: 0.5rem 0.7rem; }
  .site-nav .btn-constellation span { display: none; }
  .site-nav .btn-constellation::after { display: none; }
  .site-nav .constellation-mark { width: 17px; height: 17px; }
  /* Keep long single words (e.g. INFRASTRUCTURE) clear of the edges */
  .title { font-size: clamp(1.9rem, 9vw, 3.2rem); }
  /* News cards stack on small screens */
  .news-grid { grid-template-columns: 1fr; }
}

/* News: two columns on tablet */
@media (min-width: 601px) and (max-width: 900px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-cue-line::after { animation: none; }
  .media-asset { /* JS pauses background video for reduced-motion users; poster remains */ }
}
