/* ============================================================
   Rackncloud — homepage styles
   Edit the design tokens below to retheme the whole page.
   ============================================================ */

:root {
  /* palette */
  --bg: #050a14;            /* deep navy — page base */
  --bg-raised: #0a1322;     /* graphite navy — panels */
  --surface: #0d1626;       /* card surface */
  --line: #1d2a3e;          /* hairline borders */
  --line-strong: #2b3c56;
  --ink: #e8eef7;           /* headings */
  --text: #c3cfe0;          /* body */
  --muted: #8fa1ba;         /* secondary text */
  --blue: #7fb3e0;          /* cool blue */
  --cyan: #37d0e6;          /* accent */
  --violet: #8b7ff0;        /* subtle violet */
  --cta-ink: #04121b;       /* text on cyan */

  /* type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* layout */
  --container: 72rem;
  --pad-x: clamp(1.25rem, 5vw, 2.5rem);

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- reset & base ---------- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  /* single-screen layout: hero fills, footer sits at the bottom in flow */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; max-width: 65ch; }

a { color: var(--blue); }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--cyan);
  color: var(--cta-ink);
  border-radius: 0.375rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.5rem;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: 1.4rem var(--pad-x);
  animation: fade-down 0.9s var(--ease-out) 0.55s backwards;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark { width: 1.7rem; height: 1.7rem; color: var(--cyan); }

.gateway-status {
  display: none;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(55, 208, 230, 0.8);
  animation: pulse 2.8s ease-in-out infinite;
}

.header-access {
  margin-left: auto;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
  cursor: not-allowed; /* disabled placeholder — no destination yet */
  transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}
.header-access:not(:disabled):hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(55, 208, 230, 0.06);
}

@media (min-width: 40rem) {
  .gateway-status { display: inline-flex; }
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }

/* vertical rack rails */
.rack-lines {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg,
      rgba(127, 179, 224, 0.045) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(90deg,
      rgba(127, 179, 224, 0.02) 0 1px, transparent 1px 21px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.35) 60%, transparent);
}

/* drifting cloud haze */
.haze {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}
.haze-cyan {
  width: 55vw; height: 55vw;
  min-width: 480px; min-height: 480px;
  top: -18%; right: -12%;
  background: radial-gradient(circle, rgba(55, 208, 230, 0.10), transparent 65%);
  animation: drift-a 46s ease-in-out infinite alternate;
}
.haze-violet {
  width: 45vw; height: 45vw;
  min-width: 380px; min-height: 380px;
  bottom: -22%; left: -14%;
  background: radial-gradient(circle, rgba(139, 127, 240, 0.07), transparent 65%);
  animation: drift-b 58s ease-in-out infinite alternate;
}

.ambient-leds { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.8; }

.hero-inner {
  display: grid;
  gap: 3rem;
  align-items: center;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  /* header is in normal flow above, so this only shapes the hero's own breathing room */
  padding: clamp(1.5rem, 5svh, 4rem) var(--pad-x) clamp(1.5rem, 5svh, 4rem);
}

.hero-copy > :not(h1) { animation: rise 0.9s var(--ease-out) both; }
.hero-copy .hero-desc    { animation-delay: 0.5s; }
.hero-copy .hero-actions { animation-delay: 0.64s; }
.hero-copy .cta-note     { animation-delay: 0.78s; }

.hero h1 {
  font-size: clamp(2.5rem, 5.2vw + 1rem, 4.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.025em;
}
.hero h1 .accent { color: var(--cyan); }

/* typographic line reveal — lines slide out of a clipped box */
.hero h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.12em;   /* keep descenders unclipped */
  margin-bottom: -0.12em;
}
.hero h1 .line-in {
  display: inline-block;
  animation: line-up 0.95s var(--ease-out) backwards;
}
.hero h1 .line:nth-child(2) .line-in { animation-delay: 0.16s; }

.hero-desc {
  margin-top: 1.4rem;
  font-size: clamp(1.05rem, 0.6vw + 0.95rem, 1.2rem);
  color: var(--text);
  max-width: 34rem;
}

.hero-actions {
  margin-top: 2.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.4rem;
}

.hero-tagline {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--blue);
}

.cta-note {
  margin-top: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hero-visual { display: none; }
.hero-visual svg {
  width: 100%;
  height: auto;
  max-height: 68svh;
  display: block;
  margin-inline: auto;
  transition: transform 0.7s var(--ease-out);
  will-change: transform;
}

/* rack boot sequence — units power on one after another */
.units g { animation: unit-on 0.5s ease-out backwards; }
.units g:nth-child(1) { animation-delay: 0.55s; }
.units g:nth-child(2) { animation-delay: 0.67s; }
.units g:nth-child(3) { animation-delay: 0.79s; }
.units g:nth-child(4) { animation-delay: 0.91s; }
.units g:nth-child(5) { animation-delay: 1.03s; }
.units g:nth-child(6) { animation-delay: 1.15s; }
.units g:nth-child(7) { animation-delay: 1.27s; }
.units g:nth-child(8) { animation-delay: 1.39s; }
.units g:nth-child(9) { animation-delay: 1.51s; }

/* cloud floats gently */
.cloud { animation: float 7s ease-in-out infinite alternate; }

/* data packets climbing the uplink */
.packet { opacity: 0; animation: packet-up 3.2s linear infinite; }
.packet.p2 { animation-delay: 1.6s; }

.elevation-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  fill: #5b7091;
}

/* uplink dash flow */
.uplink { animation: flow 2.6s linear infinite; }

/* blinking LEDs — three phase groups */
.led    { animation: blink 2.4s ease-in-out infinite; }
.led.l2 { animation-duration: 3.2s; animation-delay: 0.9s; }
.led.l3 { animation-duration: 2.9s; animation-delay: 1.7s; }

@media (min-width: 60rem) {
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; }
  .hero-visual {
    display: block;
    max-width: 26rem;
    justify-self: center;
    animation: rise 1.1s var(--ease-out) 0.2s both;
  }
}

/* ---------- footer (overlay at the bottom of the single screen) ---------- */

.site-footer {
  display: flex;
  justify-content: center;
  padding: 1.3rem var(--pad-x);
  animation: fade-in 1s ease-out 1.1s backwards;
}
.footer-legal { font-size: 0.8rem; color: var(--muted); }

/* parallax layers follow the pointer softly (transform set from script.js) */
.ambient-leds, .rack-lines {
  transition: transform 0.9s var(--ease-out);
  will-change: transform;
}

/* ---------- compact heights: everything must fit one screen ---------- */

@media (max-height: 700px) {
  .hero-inner { padding-top: 4.2rem; padding-bottom: 3.6rem; }
  .hero h1 { font-size: clamp(1.9rem, 5vw + 0.8rem, 3.1rem); }
  .hero-desc { margin-top: 1rem; font-size: 1rem; }
  .hero-actions { margin-top: 1.5rem; }
  .cta-note { margin-top: 1rem; }
}

@media (max-height: 600px) {
  .hero-inner { padding-top: 3.6rem; padding-bottom: 3rem; }
  .hero h1 { font-size: clamp(1.6rem, 4.6vw + 0.7rem, 2.5rem); }
  .hero-desc { margin-top: 0.8rem; font-size: 0.95rem; }
  .hero-actions { margin-top: 1.2rem; }
  .cta-note { font-size: 0.68rem; }
  .site-footer { padding: 0.9rem var(--pad-x); }
}

/* ---------- keyframes ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes line-up {
  from { transform: translateY(112%); }
  to   { transform: none; }
}
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes unit-on {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes float {
  from { transform: translateY(0); }
  to   { transform: translateY(-7px); }
}
@keyframes packet-up {
  0%   { opacity: 0; transform: translateY(0); }
  12%  { opacity: 1; }
  82%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-64px); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.2; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
@keyframes flow {
  to { stroke-dashoffset: -22; }
}
@keyframes drift-a {
  to { transform: translate(-8vw, 6vh); }
}
@keyframes drift-b {
  to { transform: translate(7vw, -5vh); }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-copy > *, .hero-visual, .hero h1 .line-in { animation: none; }
  .site-header, .site-footer, .units g, .cloud { animation: none; }
  .led, .status-dot, .uplink, .haze, .packet { animation: none; }
  .header-access, .hero-visual svg, .ambient-leds, .rack-lines { transition: none; }
}
