/* ============================================================
   NEXAGENTIS — Design Tokens & Component Styles
   Dark-first corporate site. Deep navy + teal/cyan accent.
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* --- Type Scale (fluid clamp) --- */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    8rem);

  /* Spacing (4px system) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'Montserrat', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
}

/* ==========================================================
   DARK MODE (DEFAULT) — Deep navy charcoal + teal accent
   Applied to :root so dark is the baseline.
   ========================================================== */
:root {
  --color-bg:               #0b0f19;
  --color-surface:          #111827;
  --color-surface-2:        #1a2236;
  --color-surface-offset:   #151d2e;
  --color-surface-dynamic:  #1e293b;
  --color-divider:          #1e293b;
  --color-border:           #2a3650;
  --color-text:             #e2e8f0;
  --color-text-muted:       #94a3b8;
  --color-text-faint:       #64748b;
  --color-text-inverse:     #0b0f19;
  --color-primary:          #2dd4bf;
  --color-primary-hover:    #5eead4;
  --color-primary-active:   #14b8a6;
  --color-primary-highlight: rgba(45, 212, 191, 0.1);
  --color-warning:          #fbbf24;
  --color-error:            #f87171;
  --color-success:          #34d399;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Duplicate for explicit dark toggle */
[data-theme="dark"] {
  --color-bg:               #0b0f19;
  --color-surface:          #111827;
  --color-surface-2:        #1a2236;
  --color-surface-offset:   #151d2e;
  --color-surface-dynamic:  #1e293b;
  --color-divider:          #1e293b;
  --color-border:           #2a3650;
  --color-text:             #e2e8f0;
  --color-text-muted:       #94a3b8;
  --color-text-faint:       #64748b;
  --color-text-inverse:     #0b0f19;
  --color-primary:          #2dd4bf;
  --color-primary-hover:    #5eead4;
  --color-primary-active:   #14b8a6;
  --color-primary-highlight: rgba(45, 212, 191, 0.1);
  --color-warning:          #fbbf24;
  --color-error:            #f87171;
  --color-success:          #34d399;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ==========================================================
   LIGHT MODE
   ========================================================== */
[data-theme="light"] {
  --color-bg:               #f1f5f9;
  --color-surface:          #ffffff;
  --color-surface-2:        #f8fafc;
  --color-surface-offset:   #e2e8f0;
  --color-surface-dynamic:  #e2e8f0;
  --color-divider:          #cbd5e1;
  --color-border:           #94a3b8;
  --color-text:             #0f172a;
  --color-text-muted:       #475569;
  --color-text-faint:       #94a3b8;
  --color-text-inverse:     #f1f5f9;
  --color-primary:          #0d9488;
  --color-primary-hover:    #0f766e;
  --color-primary-active:   #115e59;
  --color-primary-highlight: rgba(13, 148, 136, 0.08);
  --color-warning:          #d97706;
  --color-error:            #dc2626;
  --color-success:          #059669;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

/* ============================
   LAYOUT
   ============================ */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--content-default);
}

.section {
  padding-block: clamp(var(--space-12), 8vw, var(--space-24));
}

/* ============================
   HEADER
   ============================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(from var(--color-bg) l c h / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.06);
  transition: box-shadow 0.3s var(--ease-out);
}

.header--scrolled {
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-4);
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}

.header__logo svg {
  height: 32px;
  width: auto;
}

.header__wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.header__links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.header__links a {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.header__links a:hover {
  color: var(--color-primary);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: color var(--transition-interactive),
              background var(--transition-interactive);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-primary-highlight);
}

/* Mobile menu */
.mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  gap: 5px;
  cursor: pointer;
}

.mobile-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

.mobile-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}
.mobile-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  top: 65px;
  z-index: 99;
  background: var(--color-bg);
  padding: var(--space-8) var(--space-6);
  flex-direction: column;
  gap: var(--space-6);
}

.mobile-nav.active {
  display: flex;
}

.mobile-nav a {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  padding-block: var(--space-2);
}

.mobile-nav a:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .header__links,
  .header__nav .theme-toggle {
    display: none;
  }
  .mobile-toggle {
    display: flex;
  }
}

/* ============================
   HERO
   ============================ */
.hero {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--space-16), 12vw, var(--space-32));
}

.hero__grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image:
    linear-gradient(var(--color-primary) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-primary) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  padding: var(--space-1) var(--space-3);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.2);
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
}

.hero__badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: var(--space-6);
  max-width: 14ch;
}

.hero__title span {
  color: var(--color-primary);
}

.hero__description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 52ch;
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.hero__cta-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--transition-interactive),
              color var(--transition-interactive),
              transform var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-bg);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px oklch(from var(--color-primary) l c h / 0.3);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  transform: translateY(-1px);
}

/* ============================
   VENTURES / DEPARTMENTS
   ============================ */
.ventures {
  background: var(--color-surface);
}

.section__label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.section__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-bottom: var(--space-10);
}

.ventures__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1024px) {
  .ventures__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .ventures__grid {
    grid-template-columns: 1fr;
  }
}

.venture-card {
  background: var(--color-surface-2);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color var(--transition-interactive),
              transform var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

.venture-card:hover {
  border-color: oklch(from var(--color-primary) l c h / 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px oklch(from var(--color-primary) l c h / 0.06);
}

.venture-card--muted {
  opacity: 0.5;
  filter: grayscale(0.4);
}

.venture-card--muted:hover {
  opacity: 0.7;
  transform: none;
  box-shadow: none;
}

.venture-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.venture-card__dept {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
}

.venture-card__status {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.venture-card__status--active {
  color: var(--color-success);
  background: oklch(from var(--color-success) l c h / 0.1);
}

.venture-card__status--hold {
  color: var(--color-warning);
  background: oklch(from var(--color-warning) l c h / 0.1);
}

.venture-card__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.venture-card__focus {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.venture-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

/* ============================
   ABOUT SECTION
   ============================ */
.about {
  position: relative;
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(var(--space-8), 5vw, var(--space-16));
  align-items: start;
}

@media (max-width: 768px) {
  .about__grid {
    grid-template-columns: 1fr;
  }
}

.about__text h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.about__text p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.stat-card__number {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

.stat-card__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ============================
   TECHNOLOGY SECTION
   ============================ */
.technology {
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
}

.technology__grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.02;
  background-image:
    radial-gradient(circle at 1px 1px, var(--color-primary) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

.tech-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-4);
}

@media (max-width: 768px) {
  .tech-pillars {
    grid-template-columns: 1fr;
  }
}

.tech-pillar {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  border: 1px solid oklch(from var(--color-text) l c h / 0.06);
}

.tech-pillar__number {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
  letter-spacing: 0.08em;
}

.tech-pillar__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.tech-pillar__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ============================
   FOOTER
   ============================ */
.footer {
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  padding-block: var(--space-10);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: var(--space-8);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.footer__abn {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer__links {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--color-primary);
}

.footer__bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.footer__copy {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer__pplx {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-decoration: none;
}

.footer__pplx:hover {
  color: var(--color-text-muted);
}

/* ============================
   LEGAL PAGES (privacy, terms)
   ============================ */
.legal-page {
  padding-block: clamp(var(--space-12), 8vw, var(--space-24));
}

.legal-content {
  max-width: var(--content-default);
  margin-inline: auto;
}

.legal-content h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.legal-content .legal-updated {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  margin-bottom: var(--space-10);
}

.legal-content h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.legal-content h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.legal-content p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-4);
  max-width: 72ch;
}

.legal-content ul, .legal-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.legal-content li {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

.legal-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-content a:hover {
  color: var(--color-primary-hover);
}

.legal-content .highlight-box {
  background: var(--color-primary-highlight);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-block: var(--space-6);
}

.legal-content .highlight-box h3 {
  margin-top: 0;
  color: var(--color-primary);
}

/* ============================
   SCROLL ANIMATIONS (JS-driven IntersectionObserver)
   ============================ */
.fade-in {
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(12px);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger venture cards */
.ventures__grid .fade-in:nth-child(1) { transition-delay: 0s; }
.ventures__grid .fade-in:nth-child(2) { transition-delay: 0.06s; }
.ventures__grid .fade-in:nth-child(3) { transition-delay: 0.12s; }
.ventures__grid .fade-in:nth-child(4) { transition-delay: 0.18s; }
.ventures__grid .fade-in:nth-child(5) { transition-delay: 0.24s; }
.ventures__grid .fade-in:nth-child(6) { transition-delay: 0.3s; }

.tech-pillars .fade-in:nth-child(1) { transition-delay: 0s; }
.tech-pillars .fade-in:nth-child(2) { transition-delay: 0.08s; }
.tech-pillars .fade-in:nth-child(3) { transition-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================
   SKIP LINK
   ============================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-primary);
  color: var(--color-bg);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 200;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-2);
}