/* ============================================================
   THEME.CSS — GLOBAL DESIGN SYSTEM (Single Source of Truth)
   - Design tokens
   - Base page + typography + links
   - Global background video module
   - Layout helpers
   - Reusable UI components
   - Fixed navbar module (with dropdown + backdrop)
   ============================================================ */

/* ============================================================
   1) DESIGN TOKENS
   ============================================================ */
:root{
  /* Background */
  --bg0: #0b0c10;
  --bg1: #10121a;

  /* Text */
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);

  /* Glass surfaces */
  --glass: rgba(255,255,255,0.07);
  --glass2: rgba(255,255,255,0.11);

  /* Accents */
  --accent: #2aa6ff;
  --accent2: #5ee7ff;
  --steel: rgba(220,230,255,0.22);

  /* Borders */
  --border: rgba(255,255,255,0.12);
  --border2: rgba(255,255,255,0.18);

  /* Focus rings */
  --ring: rgba(42,166,255,0.22);
  --ringSoft: rgba(42,166,255,0.10);

  /* Shadows */
  --glow: 0 0 28px rgba(42,166,255,0.35);
  --shadow: 0 22px 70px rgba(0,0,0,0.62);

  /* Radii */
  --radius: 26px;
  --radiusSm: 14px;
  --pill: 999px;

  /* Typography */
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;

  /* Navbar (fallback; JS can overwrite via --nav-h) */
  --nav-h: 64px;
}

/* ============================================================
   2) BASE PAGE + GLOBAL RESETS
   ============================================================ */
html, body{ height: 100%; }

*,
*::before,
*::after{ box-sizing: border-box; }

body{
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;

  font-family: var(--font);
  color: var(--text);

  /* Fallback background (also used while video loads / if video fails) */
  background:
    radial-gradient(900px 600px at 50% 20%, rgba(42,166,255,0.16), transparent 60%),
    radial-gradient(900px 600px at 85% 80%, rgba(94,231,255,0.10), transparent 60%),
    radial-gradient(900px 600px at 15% 85%, rgba(220,230,255,0.06), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* Reserve space for fixed navbar only when you opt-in via JS */
body.has-navbar{ padding-top: var(--nav-h); }

/* Links */
a{ color: var(--accent2); text-decoration: none; }
a:hover,
a:focus-visible{ text-decoration: underline; }

/* ============================================================
   3) GLOBAL ACCESSIBILITY / MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce){
  *{
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   4) GLOBAL BACKGROUND VIDEO MODULE
   Required markup:
   <video class="bg-video" ...>
     <source src="/Videos/Background1.mp4" type="video/mp4">
   </video>
   ============================================================ */
.bg-video{
  position: fixed;
  inset: 0;

  width: 100%;
  height: 100%;
  object-fit: cover;

  z-index: -1;          /* behind UI */
  pointer-events: none; /* never block interaction */
  filter: none;         /* explicit: no processing */
}

@media (prefers-reduced-motion: reduce){
  .bg-video{ display: none; }
}

/* ============================================================
   5) LAYOUT HELPERS
   ============================================================ */
.dh-wrap{
  width: min(1100px, 100%);
  margin-inline: auto;
  padding: 24px;
}

.dh-row{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dh-grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 900px){
  .dh-grid-2{ grid-template-columns: 1fr; }
}

/* ============================================================
   6) REUSABLE COMPONENTS
   ============================================================ */

/* 6A) Glass panel / card */
.dh-panel{
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);

  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 6B) Primary pill button */
.dh-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  height: 46px;
  padding: 0 14px;
  border-radius: var(--pill);

  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);

  font-weight: 700;
  letter-spacing: 0.1px;

  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.dh-btn:hover{
  background: rgba(42,166,255,0.10);
  border-color: rgba(42,166,255,0.30);
  box-shadow: 0 0 0 1px rgba(42,166,255,0.10), var(--glow);
  transform: translateY(-1px);
}

.dh-btn.is-active,
.dh-btn[aria-current="true"]{
  background: rgba(42,166,255,0.16);
  border-color: rgba(42,166,255,0.42);
  box-shadow: 0 0 0 1px rgba(42,166,255,0.14), var(--glow);
}

.dh-btn:disabled{
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* 6C) Link tile */
.dh-link{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 11px 12px;
  border-radius: var(--radiusSm);

  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  text-decoration: none;

  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.dh-link:hover{
  background: rgba(42,166,255,0.10);
  border-color: rgba(42,166,255,0.26);
  box-shadow: 0 0 0 1px rgba(42,166,255,0.10);
  transform: translateY(-1px);
}

/* 6D) Icon button */
.dh-icon-btn{
  width: 34px;
  height: 34px;
  border-radius: 10px;

  border: 0;
  background: rgba(255,255,255,0.08);
  color: var(--text);

  cursor: pointer;
  transition: background 140ms ease;
}

.dh-icon-btn:hover{ background: rgba(255,255,255,0.12); }

/* 6E) Inputs */
.dh-input,
.dh-select,
.dh-textarea{
  padding: 12px 14px;
  border-radius: var(--radiusSm);
  border: 1px solid rgba(255,255,255,.16);

  background: rgba(10,14,20,.55);
  color: var(--text);

  font-family: var(--font);
  font-size: 0.95rem;
}

.dh-input:focus,
.dh-select:focus,
.dh-textarea:focus{
  outline: none;
  box-shadow: 0 0 0 4px var(--ringSoft);
  border-color: rgba(255,255,255,.28);
}

/* 6F) Pills / chips */
.dh-pill{
  display: inline-flex;
  align-items: center;

  height: 36px;
  padding: 0 12px;
  border-radius: var(--pill);

  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);

  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

/* ============================================================
   7) NAVBAR — GLOBAL MODULE (FIXED)
   Markup classes:
   .navbar,
   .nav-head, .nav-head__media, .nav-head__vid, .nav-head__txt,
   .nav-head__name, .nav-head__time, .nav-head__ctx,
   .nav-toggle, .navbar-menu-toggle, .navbar-menu,
   .navbar-menu-list, .nav-section-label, .nav-item, .nav-link,
   .nav-icon, .nav-text, .nav-divider, .nav-divider-line, .nav-backdrop
   ============================================================ */

/* 7A) Navbar shell */
.navbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 6000;

  /* content-driven height; JS measures and sets --nav-h */
  min-height: var(--nav-h);
  height: auto;

  display: flex;
  align-items: center;
  gap: 14px;

  padding: 0 18px;

  background: linear-gradient(180deg, rgba(16,18,26,0.92), rgba(16,18,26,0.74));
  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}

/* 7B) Brand / header card (transparent, no tablet) */
.nav-head{
  display: inline-flex;
  align-items: center;
  gap: 16px;

  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;

  max-width: min(860px, 78vw);

  color: var(--text);
  text-decoration: none;
}

.nav-head:hover{ text-decoration: none; }

.nav-head:focus-visible{
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-radius: 14px;

  /* keep ring off edges */
  padding: 6px 8px;
  margin: -6px -8px;
}

/* Media tile (image/video) */
.nav-head__media{
  position: relative;
  flex: 0 0 auto;

  width: 84px;
  height: 84px;
  border-radius: 22px;
  overflow: hidden;

  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
}

.nav-head__media img,
.nav-head__vid{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-head__vid{ opacity: 0.75; }

.nav-head__txt{
  min-width: 0;
  display: grid;
  line-height: 1.08;
}

.nav-head__name{
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-size: 1.10rem;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-head__time{
  font-size: 0.96rem;
  color: rgba(255,255,255,0.80);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-head__ctx{
  font-size: 0.92rem;
  color: rgba(255,255,255,0.72);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Checkbox toggle (hidden) */
.nav-toggle{ display: none; }

/* 7C) Menu toggle pill (pinned right) */
.navbar-menu-toggle{
  margin-left: auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 40px;
  padding: 0 14px;
  border-radius: var(--pill);

  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);

  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;

  cursor: pointer;
  user-select: none;

  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.navbar-menu-toggle:hover{
  background: rgba(42,166,255,0.10);
  border-color: rgba(42,166,255,0.30);
  box-shadow: 0 0 0 1px rgba(42,166,255,0.10), var(--glow);
  transform: translateY(-1px);
}

.nav-toggle:checked ~ .navbar-menu-toggle{
  background: rgba(42,166,255,0.16);
  border-color: rgba(42,166,255,0.42);
  box-shadow: 0 0 0 1px rgba(42,166,255,0.14), var(--glow);
}

/* 7D) Dropdown panel */
.navbar-menu{
  position: fixed;
  top: calc(var(--nav-h) + 10px);
  right: 18px;

  min-width: 260px;
  max-width: min(92vw, 420px);

  padding: 14px;

  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.05));
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  z-index: 6100;

  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.nav-toggle:checked ~ .navbar-menu{
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Menu list reset */
.navbar-menu-list,
.navbar-menu-list li{
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-menu-list li + li{ margin-top: 6px; }

/* Section label */
.nav-section-label{
  margin: 2px 0 4px;
  padding: 0 8px;

  font-size: 0.70rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;

  color: rgba(255,255,255,0.60);
}

/* Menu row links */
.nav-link{
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px;
  border-radius: var(--radiusSm);

  border: 1px solid transparent;
  color: var(--text);
  text-decoration: none;

  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.nav-link:hover{
  background: rgba(42,166,255,0.10);
  border-color: rgba(42,166,255,0.22);
  transform: translateY(-1px);
  text-decoration: none;
}

.nav-link:focus-visible{
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.nav-link.is-active,
.nav-link[aria-current="page"]{
  background: rgba(42,166,255,0.14);
  border-color: rgba(42,166,255,0.30);
}

/* Icons */
.nav-icon{
  width: 20px;
  height: 20px;
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg{
  width: 20px;
  height: 20px;
  display: block;
}

.nav-text{ min-width: 0; }

/* Divider */
.nav-divider{ margin: 10px 0; }

.nav-divider-line{
  width: 100%;
  height: 1px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
}

/* 7E) Backdrop overlay under dropdown */
.nav-backdrop{
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;

  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  z-index: 5900;

  display: none;
  opacity: 0;
  pointer-events: none;

  transition: opacity 180ms ease;
}

.nav-toggle:checked ~ .nav-backdrop{
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   8) RESPONSIVE: NAVBAR
   ============================================================ */
@media (max-width: 640px){
  .navbar{ padding: 0 12px; }

  .nav-head{
    max-width: 76vw;
    gap: 12px;
  }

  .nav-head__media{
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }

  .nav-head__ctx{ display: none; }

  .navbar-menu{
    left: 12px;
    right: 12px;
    min-width: unset;
  }
}

/* Extra-tight phones */
@media (max-width: 420px){
  .nav-head__media{
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }
  .nav-head__ctx{ display: none; }
}
