/*
 * OrthoM8 — Shared Navigation & Layout CSS
 * Applies to all pages under /Orthom8/
 */

/* ═══════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════ */
:root {
  --brand-cobalt:      #1A56FF;
  --brand-cobalt-dim:  #0E38C2;
  --brand-gold:        #B8972A;
  --brand-gold-light:  #D4AC3A;
  --brand-gold-pale:   rgba(184,151,42,0.12);
  --page-bg:           #060C18;
  --surface-bg:        #0B1325;
  --surface-2:         #0F1A30;
  --surface-glass:     rgba(10, 17, 34, 0.7);
  --tx-main:           #E8EDF5;
  --tx-sub:            #6E7E9A;
  --tx-muted:          #3A4A62;
  --brand-rule:        rgba(255,255,255,0.06);
  --brand-rule-strong: rgba(255,255,255,0.12);
  --glow-cobalt:       rgba(26,86,255,0.15);
  --glow-gold:         rgba(184,151,42,0.12);
  --header-bg:         rgba(6,12,24,0.88);
  --scan-line:         rgba(26,86,255,0.04);
  --drawer-bg:         #080F20;
  --node-bg:           rgba(26, 86, 255, 0.03);
}

[data-theme="light"] {
  --page-bg:           #F7F8FC;
  --surface-bg:        #EDEEF5;
  --surface-2:         #E4E6F0;
  --surface-glass:     rgba(237,238,245,0.88);
  --tx-main:           #0A1020;
  --tx-sub:            #4A5568;
  --tx-muted:          #9AA5B8;
  --brand-rule:        rgba(0,0,0,0.07);
  --brand-rule-strong: rgba(0,0,0,0.14);
  --glow-cobalt:       rgba(26,86,255,0.08);
  --glow-gold:         rgba(184,151,42,0.08);
  --header-bg:         rgba(247,248,252,0.92);
  --scan-line:         rgba(26,86,255,0.02);
  --drawer-bg:         #F2F3FA;
  --node-bg:           rgba(26, 86, 255, 0.05);
}

/* ═══════════════════════════════════════════════════
   GLOBAL BASE STYLES
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--page-bg);
  color: var(--tx-main);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 768px) {
  body { font-size: 14px; }
}

#app {
  opacity: 0;
  transition: opacity 0.8s ease;
  min-height: 100vh;
  background: var(--page-bg); /* Extra safety for theme switching */
}

#app.visible { opacity: 1; }

/* ═══════════════════════════════════════════════════
   LOGO THEME SWAP
═══════════════════════════════════════════════════ */
.logo-dark-theme  { display: block; }
.logo-light-theme { display: none;  }
[data-theme="light"] .logo-dark-theme  { display: none;  }
[data-theme="light"] .logo-light-theme { display: block; }

/* ═══════════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════════ */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; height: 68px; z-index: 200;
  background: var(--header-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--brand-rule-strong);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2.5rem); transition: background 0.3s;
}

@media (max-width: 768px) {
  #site-header { height: 60px; }
}

.logo-wrap { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-name { font-size: 11px; font-weight: 700; letter-spacing: 4px; text-transform: uppercase; color: var(--tx-main); }

.header-nav { display: flex; align-items: center; gap: clamp(1rem, 2vw, 2.5rem); list-style: none; }
.header-nav a {
  font-size: clamp(9px, 1vw, 10px); font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  color: var(--tx-sub); text-decoration: none;
  transition: color 0.2s; position: relative; padding-bottom: 2px;
}
.header-nav a::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 1px; background: var(--brand-cobalt); transform: scaleX(0); transform-origin: left; transition: transform 0.25s;
}
.header-nav a:hover { color: var(--tx-main); }
.header-nav a:hover::after { transform: scaleX(1); }
.header-nav a.active { color: var(--brand-gold-light) !important; font-weight: 700; }
.header-nav a.active::after { transform: scaleX(1); background: var(--brand-gold-light); }

.header-controls { display: flex; align-items: center; gap: 0.75rem; }
.theme-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--brand-rule-strong); background: transparent; color: var(--tx-sub);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; transition: border-color 0.2s, color 0.2s;
}
.theme-btn:hover { border-color: var(--brand-gold); color: var(--brand-gold-light); }
.lang-wrap { position: relative; display: flex; align-items: center; }
.lang-wrap::after { content: '▾'; position: absolute; right: 8px; font-size: 8px; color: var(--tx-sub); pointer-events: none; }
.lang-select {
  appearance: none; background: transparent; border: 1px solid var(--brand-rule-strong);
  color: var(--tx-main); font-family: 'Fira Code', monospace; font-size: 10px;
  font-weight: 500; letter-spacing: 2px; padding: 0 2rem 0 0.75rem; height: 34px; cursor: pointer;
}
.lang-select:focus { outline: none; border-color: var(--brand-cobalt); }
.lang-select option { background: var(--page-bg); color: var(--tx-main); }

.hamburger {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--brand-rule-strong);
  cursor: pointer; padding: 0; transition: border-color 0.2s;
}
.hamburger:hover { border-color: var(--brand-cobalt); }
.hamburger span {
  display: block; width: 20px; height: 1.5px; background: var(--tx-main);
  transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
  transform-origin: center;
}
.hamburger.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
.mobile-header-right { display: none; align-items: center; gap: 0.5rem; }

/* ═══════════════════════════════════════════════════
   MOBILE DRAWER
═══════════════════════════════════════════════════ */
#mobile-drawer {
  position: fixed; top: 0; right: 0;
  width: min(320px, 88vw); height: 100dvh;
  z-index: 300; background: var(--drawer-bg);
  border-left: 1px solid var(--brand-rule-strong);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
#mobile-drawer.open { transform: translateX(0); }

#drawer-overlay {
  position: fixed; inset: 0; z-index: 290;
  background: rgba(6,12,24,0.65); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
#drawer-overlay.visible { opacity: 1; pointer-events: all; }

.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 68px; flex-shrink: 0;
  border-bottom: 1px solid var(--brand-rule-strong);
}
.drawer-close {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--brand-rule-strong); background: transparent;
  color: var(--tx-sub); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.drawer-close:hover { border-color: var(--brand-cobalt); color: var(--brand-cobalt); }

.drawer-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--brand-rule-strong);
  border-bottom: 1px solid var(--brand-rule-strong); flex-shrink: 0;
}
@media (max-width: 360px) {
  .drawer-stats { grid-template-columns: 1fr; }
  .ds-cell { border-left: none !important; border-top: 1px solid var(--brand-rule-strong); }
  .ds-cell:first-child { border-top: none; }
}
.ds-cell { background: var(--drawer-bg); padding: clamp(0.75rem, 3vw, 1rem); }
.ds-num { font-family: 'Fira Code', monospace; font-size: 1rem; color: var(--brand-gold-light); }
.ds-lbl { font-size: 8px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--tx-muted); margin-top: 3px; }

.drawer-nav { flex: 1; padding: 0.5rem 0; display: flex; flex-direction: column; }
.drawer-nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(0.75rem, 3vw, 1rem) 1.5rem;
  font-size: 11px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--tx-sub); text-decoration: none;
  border-bottom: 1px solid var(--brand-rule);
  transition: color 0.2s, background 0.2s, padding-left 0.25s;
}
.drawer-nav a:hover { color: var(--tx-main); background: var(--brand-rule); padding-left: 2rem; }
.nav-arrow { color: var(--brand-cobalt); font-size: 10px; opacity: 0; transition: opacity 0.2s; }
.drawer-nav a:hover .nav-arrow { opacity: 1; }

.drawer-controls {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--brand-rule); flex-shrink: 0;
}
.drawer-controls .lang-wrap { flex: 1; }
.drawer-controls .lang-select { width: 100%; }

.drawer-footer {
  padding: 1.25rem 1.5rem; border-top: 1px solid var(--brand-rule-strong);
  display: flex; flex-direction: column; gap: 0.75rem; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0.7rem 1.5rem; background: var(--brand-cobalt); color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; text-decoration: none;
  border: none; cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-primary:hover { background: var(--brand-cobalt-dim); box-shadow: 0 0 24px rgba(26,86,255,0.4); transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0.7rem 1.5rem; background: transparent; color: var(--tx-main);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--brand-rule-strong); cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--brand-gold); color: var(--brand-gold-light); background: var(--brand-gold-pale); }
.btn-gold {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0.8rem 2rem; background: var(--brand-gold); color: #060C18;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase; text-decoration: none;
  border: none; cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}
.btn-gold:hover { background: var(--brand-gold-light); box-shadow: 0 0 28px rgba(184,151,42,0.45); transform: translateY(-1px); }

/* ═══════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════ */
#site-footer { background: var(--surface-bg); border-top: 1px solid var(--brand-rule-strong); padding: clamp(3rem, 5vw, 5rem) clamp(1.25rem, 4vw, 4rem); }
.footer-grid { 
  display: grid; 
  grid-template-columns: 1.5fr repeat(3, 1fr); 
  gap: clamp(2rem, 4vw, 3rem); 
  max-width: 1380px; 
  margin: 0 auto; 
}
@media (max-width: 1200px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: span 3; margin-bottom: 1rem; }
}
.footer-brand-name { font-family: 'Playfair Display', serif; font-size: 1.4rem; font-weight: 700; color: var(--tx-main); margin-bottom: 0.75rem; }
.footer-brand-desc { font-size: 13px; line-height: 1.7; color: var(--tx-sub); }
.footer-col-title { font-size: 9px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--tx-main); margin-bottom: 1.25rem; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.footer-links a { font-size: 13px; color: var(--tx-sub); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--brand-cobalt); }
.footer-bottom { max-width: 1380px; margin: 2.5rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--brand-rule); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-bottom p { font-family: 'Fira Code', monospace; font-size: 10px; color: var(--tx-muted); }

/* ═══════════════════════════════════════════════════
   TYPOGRAPHY UTILITIES
═══════════════════════════════════════════════════ */
.text-eyebrow {
  font-family: 'Fira Code', monospace; font-size: 9px; font-weight: 500;
  letter-spacing: 4px; text-transform: uppercase; color: var(--brand-cobalt);
  display: flex; align-items: center; gap: 10px;
}
.text-eyebrow::before { content: ''; display: inline-block; width: 24px; height: 1px; background: var(--brand-cobalt); opacity: 0.7; }
.section-heading {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; color: var(--tx-main);
}
.section-heading em { font-style: italic; color: var(--brand-gold-light); }
.hero-heading {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 5.5vw, 5rem);
  font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; color: var(--tx-main);
}
.hero-heading em { font-style: italic; color: var(--brand-gold-light); }
.hero-heading strong { font-weight: 700; }
.hero-body { font-size: 15px; line-height: 1.75; color: var(--tx-sub); }
.body-text  { font-size: 15px; line-height: 1.75; color: var(--tx-sub); }

/* ═══════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════ */
.layout-container { max-width: 1380px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 4rem); }
body.drawer-open { overflow: hidden; }
#app { opacity: 0; transition: opacity 0.5s ease; }
#app.visible { opacity: 1; }

/* ═══════════════════════════════════════════════════
   GLOBAL SAFETY — prevents overflow on any screen size
═══════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
img  { max-width: 100%; height: auto; }
video:not(.hero-bg-video):not(.terminal-bg-video) { max-width: 100%; }

/* ═══════════════════════════════════════════════════
   ANIMATIONS & TRANSITIONS
   Initial hidden states — no auto-fire.
   animations.js adds .revealed via IntersectionObserver.
   body.o8-js is set by animations.js on load.
   If JS never runs, body lacks .o8-js and the fallback
   block below immediately shows all elements.
═══════════════════════════════════════════════════ */
.anim-fade-in    { opacity: 0; }
.anim-slide-up   { opacity: 0; transform: translateY(56px); }
.anim-slide-down { opacity: 0; transform: translateY(-56px); }
.anim-slide-left  { opacity: 0; transform: translateX(56px); }
.anim-slide-right { opacity: 0; transform: translateX(-56px); }

.anim-fade-in.revealed    { animation: fade-in    0.9s ease                        both; }
.anim-slide-up.revealed   { animation: slide-up   0.9s cubic-bezier(0.16,1,0.3,1) both; }
.anim-slide-down.revealed { animation: slide-down 0.9s cubic-bezier(0.16,1,0.3,1) both; }
.anim-slide-left.revealed  { animation: slide-left  0.9s cubic-bezier(0.16,1,0.3,1) both; }
.anim-slide-right.revealed { animation: slide-right 0.9s cubic-bezier(0.16,1,0.3,1) both; }

.delay-1 { animation-delay: 0.12s; }
.delay-2 { animation-delay: 0.24s; }
.delay-3 { animation-delay: 0.36s; }
.delay-4 { animation-delay: 0.48s; }
.delay-5 { animation-delay: 0.60s; }

@keyframes fade-in    { to   { opacity: 1; } }
@keyframes slide-up   { from { opacity: 0; transform: translateY(56px);  filter: blur(4px); } to { opacity: 1; transform: translateY(0);  filter: blur(0); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-56px); filter: blur(4px); } to { opacity: 1; transform: translateY(0);  filter: blur(0); } }
@keyframes slide-left  { from { opacity: 0; transform: translateX(56px);  filter: blur(4px); } to { opacity: 1; transform: translateX(0);  filter: blur(0); } }
@keyframes slide-right { from { opacity: 0; transform: translateX(-56px); filter: blur(4px); } to { opacity: 1; transform: translateX(0);  filter: blur(0); } }

/* No-JS fallback: if animations.js never ran, show everything immediately */
body:not(.o8-js) .anim-fade-in,
body:not(.o8-js) .anim-slide-up,
body:not(.o8-js) .anim-slide-down,
body:not(.o8-js) .anim-slide-left,
body:not(.o8-js) .anim-slide-right {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* ═══════════════════════════════════════════════════
   HOVER EFFECTS — works on mouse & touch
═══════════════════════════════════════════════════ */

/* Nav links — underline sweep already exists, boost text brightness */
.header-nav a:hover,
.footer-links a:hover,
.drawer-nav a:hover { color: var(--tx-main) !important; }

/* Interactive cards — lift + cobalt glow */
.perf-card:hover,
.stat-card:hover,
.director-card:hover,
.contact-card:hover,
.glass-panel:hover {
  box-shadow: 0 8px 32px rgba(26,86,255,0.18), 0 0 0 1px rgba(26,86,255,0.22);
}

/* Buttons — cobalt/gold glow already in .btn-primary/:hover, add pointer feedback */
.btn-primary, .btn-ghost, .btn-gold {
  transition: background 0.2s, box-shadow 0.25s, transform 0.18s, border-color 0.2s, color 0.2s !important;
}
.btn-primary:active, .btn-ghost:active, .btn-gold:active {
  transform: scale(0.97) !important;
}

/* ═══════════════════════════════════════════════════
   HEADER SCROLL BEHAVIOUR
═══════════════════════════════════════════════════ */
#site-header {
  transition: transform 0.38s cubic-bezier(0.16,1,0.3,1), background 0.3s, box-shadow 0.3s !important;
}
#site-header.scrolled  { background: rgba(6,12,24,0.97) !important; box-shadow: 0 1px 32px rgba(0,0,0,0.5); }
#site-header.nav-hidden { transform: translateY(-100%); }

/* ═══════════════════════════════════════════════════
   ENHANCED BUTTON GLOW
═══════════════════════════════════════════════════ */
.btn-primary:hover { box-shadow: 0 0 32px rgba(26,86,255,0.55), 0 0 64px rgba(26,86,255,0.18) !important; }
.btn-gold:hover    { box-shadow: 0 0 32px rgba(212,172,58,0.55), 0 0 64px rgba(212,172,58,0.18) !important; }

/* ═══════════════════════════════════════════════════
   SCAN-LINE OVERLAY
═══════════════════════════════════════════════════ */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 1000; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, var(--scan-line) 2px, var(--scan-line) 4px);
  opacity: 0.6;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — TABLET ≤ 1024px
═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .header-nav, .header-controls { display: none !important; }
  .hamburger, .mobile-header-right { display: flex !important; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 768px
═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 420px) {
  .logo-name { display: none; }
}
