/* =========================================================
   OptiWeb Systems — Scroll-Stop Website
   Design system: black + techy blue, futuristic, motion-first
   ========================================================= */

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

:root {
  /* Colors */
  --bg: #05070A;
  --bg-alt: #0D141F;
  --card: rgba(13, 20, 31, 0.6);
  --card-solid: #0D141F;
  --border: rgba(111, 178, 255, 0.14);
  --border-strong: rgba(111, 178, 255, 0.32);
  --accent: #2F8FFF;
  --accent-light: #6DC3FF;
  --accent-glow: rgba(47, 143, 255, 0.35);
  --text: #F5F7FA;
  --text-muted: #8B97A8;
  --text-dim: #707C8F;

  /* Type */
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Archivo', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

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

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: var(--accent); color: #05070A; }

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: var(--bg); }
body::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-light));
  border-radius: 10px;
}
body::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 1rem;
}

section { position: relative; padding: clamp(5rem, 10vw, 8rem) 0; }
.section-alt { background: linear-gradient(180deg, transparent, rgba(13,20,31,0.5), transparent); }

.section-head { max-width: 640px; margin-bottom: 3.5rem; }
.section-head h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 1rem; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }

/* =============== Wave Background Canvas =============== */
#wave-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(111,178,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111,178,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 70%);
}

/* =============== Loader =============== */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.6s var(--ease), visibility 0.6s var(--ease);
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo {
  width: 56px; height: 56px;
  object-fit: contain;
  animation: pulse 2s ease-in-out infinite;
}
.loader-mark {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.loader-mark span { color: var(--accent-light); }
.loader-bar {
  width: 200px;
  height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.3s ease;
}
.loader-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* =============== Scroll Progress =============== */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  box-shadow: 0 0 10px var(--accent-glow);
  z-index: 1000;
  transition: width 0.05s linear;
}

/* =============== Navbar =============== */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.5s var(--ease);
}

#navbar.pill {
  top: 14px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(820px, 92vw);
  padding: 0.65rem 1.25rem;
  background: rgba(13, 20, 31, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 100px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.nav-logo {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.nav-logo-mark {
  width: 28px; height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}
.nav-logo-text span { color: var(--accent-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.nav-links a { transition: color 0.25s ease; }
.nav-links a:hover { color: var(--text); }

.nav-cta {
  padding: 0.55rem 1.3rem;
  border-radius: 100px;
  background: var(--accent);
  color: #05070A;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.25s ease;
  box-shadow: 0 0 0 rgba(47,143,255,0);
}
.nav-cta:hover {
  background: var(--accent-light);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}

.nav-toggle { display: none; }

/* =============== Buttons =============== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.75rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #05070A;
}
.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--accent-light);
  background: rgba(111,178,255,0.06);
  transform: translateY(-2px);
}

/* =============== Hero =============== */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding-top: 6rem;
  z-index: 2;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
}
.hero-orb-1 { width: 500px; height: 500px; background: var(--accent-glow); top: -10%; left: -10%; }
.hero-orb-2 { width: 400px; height: 400px; background: rgba(109,195,255,0.2); bottom: -10%; right: -10%; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--card);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 2rem;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 8px var(--accent-light);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

#hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
  max-width: 900px;
  margin-bottom: 1.5rem;
}
#hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent-light), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 3.5rem;
}

.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.scroll-hint-line { width: 1px; height: 36px; background: linear-gradient(var(--accent-light), transparent); }

/* =============== Scroll Animation Section (3D asset zone) =============== */
#scroll-animation {
  position: relative;
  height: 350vh;
  z-index: 2;
}

.scroll-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.scroll-asset-placeholder {
  width: min(1200px, 90vw);
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border-strong);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(47,143,255,0.06), rgba(13,20,31,0.4));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem;
}
.scroll-asset-placeholder h3 {
  font-size: 1.4rem;
  color: var(--accent-light);
}
.scroll-asset-placeholder p {
  color: var(--text-muted);
  max-width: 420px;
  font-size: 0.92rem;
}
.scroll-asset-placeholder code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(0,0,0,0.3);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}

#scroll-frame-canvas {
  display: none;
  width: 100%;
  height: 100%;
}
#scroll-frame-canvas.ready { display: block; }
.scroll-asset-placeholder.hidden { display: none; }
#scroll-load-progress {
  font-family: var(--font-mono);
  color: var(--accent-light);
  font-size: 1.1rem;
}

.annotation-card {
  position: absolute;
  max-width: 280px;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.annotation-card.visible { opacity: 1; transform: translateY(0); }
.annotation-card h4 { font-size: 0.95rem; color: var(--accent-light); margin-bottom: 0.4rem; }
.annotation-card p { font-size: 0.82rem; color: var(--text-muted); }

/* =============== Cards (glass-morphism) =============== */
.card {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  transition: all 0.4s var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

/* =============== Services =============== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.service-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(47,143,255,0.18), rgba(109,195,255,0.06));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}
.service-card h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.service-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1.25rem; }
.service-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.service-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.service-list li::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-light);
  flex-shrink: 0;
}

/* =============== Portfolio / Selected Work =============== */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
.work-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}
.work-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.work-card h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }
.work-card p { color: var(--text-muted); font-size: 0.92rem; }
.work-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.work-status.live { color: #6DFFB0; border: 1px solid rgba(109,255,176,0.3); background: rgba(109,255,176,0.06); }
.work-status.progress { color: var(--accent-light); border: 1px solid var(--border-strong); background: rgba(47,143,255,0.06); }
.work-status.upcoming { color: var(--text-dim); border: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.work-link {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--accent-light);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* =============== Process =============== */
.process-list {
  display: flex;
  flex-direction: column;
}
.process-step {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}
.process-step:last-child { border-bottom: none; }
.process-num {
  font-family: var(--font-head);
  font-size: 2.5rem;
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px var(--border-strong);
}
.process-step h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.process-step p { color: var(--text-muted); font-size: 0.95rem; max-width: 560px; }

/* =============== Account / Manage Subscription =============== */
.account-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.account-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1.75rem;
}
.account-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}
.account-input {
  flex: 1;
  min-width: 200px;
  padding: 0.9rem 1.25rem;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.account-input::placeholder { color: var(--text-dim); }
.account-input:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}
.account-status {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  min-height: 1.2em;
  color: var(--text-muted);
}
.account-status.success { color: #6DFFB0; }
.account-status.error { color: #FF8A8A; }

@media (max-width: 480px) {
  .account-form { flex-direction: column; }
}

/* =============== CTA Section =============== */
#cta {
  text-align: center;
}
.cta-box {
  background: linear-gradient(160deg, rgba(47,143,255,0.1), rgba(13,20,31,0.6));
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  padding: clamp(3rem, 8vw, 5rem) clamp(1.5rem, 6vw, 4rem);
  position: relative;
  overflow: hidden;
}
.cta-box h2 { font-size: clamp(1.9rem, 4vw, 3rem); margin-bottom: 1rem; }
.cta-box p { color: var(--text-muted); max-width: 480px; margin: 0 auto 2.5rem; font-size: 1.05rem; }

/* =============== Footer =============== */
footer {
  padding: 3rem 0 2.5rem;
  border-top: 1px solid var(--border);
  z-index: 2;
  position: relative;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.footer-social {
  display: flex;
  gap: 0.75rem;
}
.footer-social a {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.25s ease;
  font-size: 0.85rem;
}
.footer-social a:hover { border-color: var(--accent-light); color: var(--accent-light); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.footer-bottom a:hover { color: var(--accent-light); }

/* =============== Reveal Animation Utility =============== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* =============== Responsive =============== */
@media (max-width: 900px) {
  .services-grid { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  #navbar.pill { width: 94vw; }
  .process-step { grid-template-columns: 50px 1fr; gap: 1.25rem; }
  .process-num { font-size: 1.8rem; }
  .annotation-card { max-width: 220px; padding: 1rem 1.25rem; bottom: 1.5vh !important; top: auto !important; }
  #scroll-animation { height: 250vh; }
}

/* =============== Reduced Motion =============== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
