/* ==========================================================================
   ASC.hk Dark Theme & Motion Design System
   Palette inspired by ASC.hk botanical terracotta & sage emblem
   ========================================================================== */

:root {
  --bg-base: #07080c;
  --bg-card: rgba(16, 19, 28, 0.72);
  --bg-card-hover: rgba(22, 26, 39, 0.88);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #f4f6fb;
  --text-secondary: #a1a9bd;
  --text-muted: #6c758d;

  /* Brand & Card Accents */
  --ember: #cd5c2b;
  --ember-soft: #f0a47a;
  --sage: #75a132;
  --sage-soft: #9ed052;
  --cyan: #38bdf8;
  --rose: #fb7185;
  --amber: #f59e0b;

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-lg: 22px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

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

img,
svg {
  display: block;
}

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

.container {
  width: min(1160px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* ==========================================================================
   Background Canvas, Ambient Orbs & Noise Texture
   ========================================================================== */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  pointer-events: none;
}

.ambient-glows {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.24;
  will-change: transform;
  animation: orbFloat 18s ease-in-out infinite alternate;
}

.glow-orb--ember {
  width: 520px;
  height: 520px;
  top: -140px;
  left: -100px;
  background: radial-gradient(circle, var(--ember), transparent 70%);
}

.glow-orb--sage {
  width: 460px;
  height: 460px;
  top: 22%;
  right: -130px;
  background: radial-gradient(circle, var(--sage), transparent 70%);
  animation-delay: -6s;
  animation-duration: 22s;
}

.glow-orb--indigo {
  width: 560px;
  height: 560px;
  bottom: -180px;
  left: 30%;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  opacity: 0.16;
  animation-delay: -11s;
  animation-duration: 25s;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: radial-gradient(rgba(255, 255, 255, 0.85) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

@keyframes orbFloat {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(40px, -30px, 0) scale(1.08);
  }
  100% {
    transform: translate3d(-30px, 45px, 0) scale(0.95);
  }
}

/* ==========================================================================
   Floating Glass Bottom Bar
   ========================================================================== */

.site-bottom-bar {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 40;
  padding: 0 1rem;
  pointer-events: none;
}

.bottom-bar-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(12, 15, 23, 0.82);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55);
}

.brand-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.08rem;
}

.brand-icon-wrap {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(205, 92, 43, 0.16), rgba(117, 161, 50, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.35s var(--ease-out);
}

.brand-mark:hover .brand-icon-wrap {
  transform: rotate(-6deg) scale(1.06);
}

.brand-tld {
  color: var(--ember-soft);
}

.bottom-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 0;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

/* Remove horizontal margins when links overflow the pill container */
.site-bottom-bar.is-overflowing {
  padding-inline: 0;
}

.site-bottom-bar.is-overflowing .bottom-bar-inner {
  width: 100%;
  border-radius: 0;
  border-inline: 0;
  gap: 0.45rem;
  padding: 0.5rem 0.75rem;
}

.site-bottom-bar.has-scroll .bottom-nav {
  flex: 1;
  justify-content: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-inline: 0.75rem;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}

.nav-link {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero {
  padding: 4.5rem 0 3.5rem;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-emblem-stage {
  position: relative;
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  margin-bottom: 1.75rem;
}

.emblem-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(240, 164, 122, 0.28);
  animation: spinSlow 24s linear infinite;
}

.emblem-ring--inner {
  inset: 12px;
  border-style: solid;
  border-color: rgba(158, 208, 82, 0.2) transparent rgba(205, 92, 43, 0.35) transparent;
  animation-direction: reverse;
  animation-duration: 14s;
}

.emblem-core {
  position: relative;
  width: 86px;
  height: 86px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.08), rgba(16, 19, 28, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(205, 92, 43, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  animation: floatGentle 5s ease-in-out infinite;
}

.hero-favicon {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

@keyframes spinSlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes floatGentle {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.hero-title {
  margin: 0;
  max-width: 19ch;
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 5.4vw, 4.25rem);
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.035em;
}

.gradient-text {
  background: linear-gradient(115deg, #f4f6fb 10%, var(--ember-soft) 48%, var(--sage-soft) 92%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerGradient 7s ease infinite;
}

@keyframes shimmerGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero-subtitle {
  margin: 1.4rem 0 2rem;
  max-width: 62ch;
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.45rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ember), #d8723d);
  color: #fff;
  box-shadow: 0 10px 30px rgba(205, 92, 43, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(205, 92, 43, 0.5);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   Products Section & Bento Grid
   ========================================================================== */

.products-section {
  padding: 2.5rem 0 7.5rem;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.section-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--ember-soft);
  margin-bottom: 0.35rem;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  letter-spacing: -0.025em;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.25rem;
}

/* Card Spanning */
.portal-card {
  grid-column: span 2;
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  transform-style: preserve-3d;
  transition:
    transform 0.35s var(--ease-out),
    border-color 0.3s ease,
    background-color 0.3s ease,
    box-shadow 0.35s ease,
    opacity 0.3s ease;
  --mouse-x: 50%;
  --mouse-y: 50%;
  --card-accent: var(--ember-soft);
}

.portal-card:nth-child(1),
.portal-card:nth-child(2) {
  grid-column: span 3;
}

.portal-card:nth-child(3),
.portal-card:nth-child(4),
.portal-card:nth-child(5) {
  grid-column: span 2;
}

.card-accent-sage { --card-accent: var(--sage-soft); }
.card-accent-cyan { --card-accent: var(--cyan); }
.card-accent-ember { --card-accent: var(--ember-soft); }
.card-accent-rose { --card-accent: var(--rose); }
.card-accent-amber { --card-accent: var(--amber); }

.portal-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.portal-card.is-keyboard-focus {
  border-color: var(--card-accent);
  box-shadow: 0 0 0 2px var(--card-accent), 0 24px 60px rgba(0, 0, 0, 0.6);
}

.card-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    420px circle at var(--mouse-x) var(--mouse-y),
    color-mix(in srgb, var(--card-accent) 16%, transparent),
    transparent 65%
  );
}

.portal-card:hover .card-spotlight {
  opacity: 1;
}

.card-border-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    320px circle at var(--mouse-x) var(--mouse-y),
    color-mix(in srgb, var(--card-accent) 55%, transparent),
    transparent 65%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.portal-card:hover .card-border-glow {
  opacity: 1;
}

.card-content {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--card-accent);
}

.badge-index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--card-accent) 30%, transparent);
}

.card-domain {
  position: relative;
  z-index: 3;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.card-domain:hover {
  color: var(--card-accent);
}

.card-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.card-copy {
  flex: 1;
}

.card-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.card-desc {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.62;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--card-accent);
  padding: 0.35rem 0.1rem;
  transition: gap 0.25s var(--ease-out), filter 0.25s ease;
}

.card-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s var(--ease-out);
}

.portal-card:hover .card-link {
  gap: 0.55rem;
  filter: brightness(1.15);
}

.portal-card:hover .card-link svg {
  transform: translate(2px, -2px);
}

/* Make entire card clickable via stretched link pattern */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ==========================================================================
   Card Micro-Visualizations (Animated SVG & UI Widgets)
   ========================================================================== */

.card-visual {
  border-radius: 14px;
  background: rgba(7, 9, 14, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.85rem 1rem;
}

/* 1. Wear OS Watch */
.visual-wear {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0.9rem;
}

.watch-bezel {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #141a24 45%, #0a0d12 100%);
  border: 2px solid rgba(158, 208, 82, 0.35);
  box-shadow: 0 0 28px rgba(117, 161, 50, 0.2);
}

.watch-ring {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--sage-soft);
  border-right-color: rgba(158, 208, 82, 0.35);
  animation: spinSlow 6s linear infinite;
}

.watch-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.watch-time {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.watch-sub {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  color: var(--sage-soft);
  margin-top: 0.2rem;
}

/* 2. AQI Gauge */
.visual-aqi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.aqi-gauge {
  width: 112px;
  height: 66px;
  flex-shrink: 0;
}

.gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 7;
  stroke-linecap: round;
}

.gauge-arc {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 145;
  stroke-dashoffset: 38;
  animation: gaugeBreath 4.5s ease-in-out infinite;
}

.gauge-dot {
  fill: #fff;
  filter: drop-shadow(0 0 6px var(--cyan));
}

@keyframes gaugeBreath {
  0%,
  100% {
    stroke-dashoffset: 42;
  }
  50% {
    stroke-dashoffset: 24;
  }
}

.aqi-pillars {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.aqi-pillars span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.1);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.22);
}

/* 3. AdPlus Terminal */
.visual-terminal {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-secondary);
}

.term-status {
  font-size: 0.63rem;
  font-weight: 600;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
  background: rgba(205, 92, 43, 0.22);
  color: var(--ember-soft);
}

.term-line--ok .term-status {
  background: rgba(117, 161, 50, 0.22);
  color: var(--sage-soft);
}

/* 4. Pulscore2 ECG Waveform */
.visual-pulse {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ecg-svg {
  width: 100%;
  height: 46px;
}

.ecg-track {
  stroke: rgba(251, 113, 133, 0.18);
  stroke-width: 2;
}

.ecg-line {
  stroke: var(--rose);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 90 220;
  animation: ecgSweep 2.6s linear infinite;
  filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.65));
}

@keyframes ecgSweep {
  from {
    stroke-dashoffset: 310;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.bpm-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: #fecdd3;
}

.heart-beat {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 10px var(--rose);
  animation: heartPulse 1.15s ease-in-out infinite;
}

@keyframes heartPulse {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.45);
  }
  45% {
    transform: scale(0.95);
  }
  60% {
    transform: scale(1.3);
  }
}

/* 5. Mathless Compound Growth */
.visual-compound {
  padding: 0.65rem 0.85rem;
}

.compound-svg {
  width: 100%;
  height: 70px;
}

.compound-curve {
  stroke: var(--amber);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: drawCurve 3.4s var(--ease-out) infinite alternate;
}

.compound-node {
  fill: #fde68a;
  filter: drop-shadow(0 0 7px var(--amber));
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes drawCurve {
  0% {
    stroke-dashoffset: 180;
  }
  65%,
  100% {
    stroke-dashoffset: 0;
  }
}

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */

.reveal-up {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.7s var(--ease-out) var(--delay, 0ms),
    transform 0.7s var(--ease-out) var(--delay, 0ms);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 980px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-card:nth-child(n) {
    grid-column: span 1;
  }

  .portal-card:nth-child(1) {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .products-section {
    padding-bottom: 6.5rem;
  }

  .nav-link {
    font-size: 0.84rem;
    padding: 0.42rem 0.75rem;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .portal-card:nth-child(n) {
    grid-column: span 1;
  }

  .card-split {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }
}

/* ==========================================================================
   Reduced Motion Accessibility
   ========================================================================== */

@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-up {
    opacity: 1;
    transform: none;
  }
}
