/* ---------------- Base & tokens ---------------- */
* { box-sizing: border-box; }
html { font-size: 16px; scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
  background: #fafafa;
  color: #111;
  font-size: 1rem;
}

img, video { max-width: 100%; height: auto; display: block; }

a { text-decoration: none; color: #007BFF; }
a:focus-visible, button:focus-visible { outline: 2px solid #87CEEB; outline-offset: 2px; }

:root {
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --maxw: 1100px;
}

/* -------------- Page containers -------------- */
.site-header, main, footer {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-2);
}

/* -------------- Header -------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #f1f1f1;
  padding: .5rem 1rem;
}
.site-header .brand { display: flex; align-items: center; gap: .75rem; }
.site-header .brand h1 { margin: 0; font-size: 1.5rem; color: rgb(17, 54, 118); }

/* Menu button (shown on <=900px) */
.menu-toggle {
  display: none;
  border: 1px solid #ccc;
  background: #fff;
  padding: .5rem .75rem;
  border-radius: .5rem;
  font-size: 1rem;
}

/* -------------- Top nav -------------- */
.top-nav { position: relative; z-index: 1001; }
.top-nav ul { list-style: none; display: flex; gap: .25rem; padding: 0; margin: 0; flex-wrap: wrap; }
.top-nav a {
  display: inline-block;
  padding: .6rem .9rem;
  border-radius: .4rem;
  transition: background-color .2s, color .2s;
  border: 0;               /* keep nav clean (no blue border) */
  color: inherit;
}
.top-nav a:hover,
.top-nav a.active { background: #87CEEB; color: #fff; }

/* -------------- Main grid -------------- */
main {
  position: relative; /* sits below header */
  z-index: 1;
  display: grid;
  gap: var(--space-2);
  padding-block: var(--space-2);
  grid-template-columns: 1fr;
  grid-template-areas: "left" "content";
}

.left-rail { grid-area: left; display: grid; gap: var(--space-2); align-content: start; }

/* Sidebars */
.sidebar { background: #eaeaea; padding: var(--space-2); border-radius: .5rem; }
.sidebar ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; }
.sidebar a {
  display: block;
  padding: .55rem .75rem;
  border-radius: .4rem;
  color: #000;
  transition: background-color .2s, color .2s;
  border: 0;               /* no blue border in sidebars */
}
.sidebar a:hover,
.sidebar a.active { background: #87CEEB; color: #fff; }

/* Content panel */
.content {
  grid-area: content;
  background: #fff;
  padding: var(--space-3);
  border-radius: .5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow-wrap: anywhere;
}
.content > :where(table, pre, code, .table-wrap) { max-width: 100%; overflow-x: auto; }

/* “Blue button” links only inside content */
.content a {
  color: #007BFF;
  border: 1px solid #007BFF;
  padding: 0.25em 0.5em;
  border-radius: 4px;
  transition: background .2s, color .2s;
}
.content a:hover { background: #007BFF; color: #fff; }

/* Media */
.video-container { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: .5rem; overflow: hidden; }
#introVideo { width: 100%; height: 100%; object-fit: cover; }

/* -------------- Responsive nav (<=900px) -------------- */
@media (max-width: 900px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid #d1d5db;
    background: #fff;
    padding: .5rem .75rem;
    border-radius: .5rem;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
  }

  .top-nav {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    display: none;           /* hidden by default */
    padding: .5rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    max-height: calc(100vh - 70px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .top-nav.open { display: block; }

  .top-nav ul {
    display: grid;
    grid-auto-rows: minmax(44px, auto);
    gap: .4rem;
    padding: 0;
    margin: 0;
  }

  .top-nav a {
    display: block;
    width: 100%;
    padding: .8rem 1rem;
    border-radius: .5rem;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #000;
    transition: background-color .2s, color .2s, border-color .2s;
  }
  .top-nav a:hover,
  .top-nav a.active {
    background: #87CEEB;
    color: #fff;
    border-color: #87CEEB;
  }
}

/* Desktop layout */
@media (min-width: 901px) {
  .menu-toggle { display: none; }
  .top-nav { display: block !important; position: static; box-shadow: none; padding: 0; }
}
@media (min-width: 900px) {
  main { grid-template-columns: minmax(220px,260px) 1fr; grid-template-areas: "left content"; align-items: start; }
}

/* -------------- Typography & footer -------------- */
h1 { font-size: clamp(1.5rem, 1.05rem + 2vw, 2.25rem); margin: 0 0 var(--space-2); }
h2 { font-size: clamp(1.25rem, 1.02rem + 1vw, 1.6rem); margin: var(--space-2) 0 var(--space-1); }

footer { background: #ffffff; text-align: center; padding: var(--space-2); margin-top: var(--space-4); }
.footer-nav a { border: 0; padding: .25em .5em; }

.flow > * + * { margin-top: .75rem; }

/* =========================================================
   PAGE-SCOPED (by body class: .page-<endpoint>)
   ========================================================= */

/* ---- Applications page: light-mode fallback background ---- */
body.page-applications {
  min-height: 100vh;
  background:
    radial-gradient(900px 1200px at 10% 80%, rgba(20, 47, 57, 0.12), transparent 70%),
    linear-gradient(135deg, #eef2ff, #e0f2fe, #ecfeff);
  background-attachment: fixed;
}

/* ---- Applications page: rich dark-mode background (your original) ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --c1: #051a4a; /* deep navy */
    --c2: #360339; /* plum */
    --c3: #29276f; /* indigo */
    --c4: #142f39; /* teal-slate */
  }

  body.page-applications {
    background-color: var(--c1);
    background-image:
      radial-gradient(1200px 800px at 85% 20%, rgba(54, 3, 57, 0.55), transparent 70%),
      radial-gradient(900px 1200px at 10% 80%,  rgba(20, 47, 57, 0.55), transparent 70%),
      conic-gradient(from 0turn  at 30% 35%, rgba(41, 39, 111, 0.25) 0 25%, transparent 25% 40%, rgba(5, 26, 74, 0.22) 40% 60%, transparent 60% 70%, rgba(54, 3, 57, 0.25) 70% 85%, transparent 85%),
      conic-gradient(from .5turn at 70% 65%, rgba(5, 26, 74, 0.20) 0 20%, transparent 20% 40%, rgba(41, 39, 111, 0.22) 40% 60%, transparent 60% 80%, rgba(20, 47, 57, 0.24) 80%),
      linear-gradient(105deg, rgba(41, 39, 111, 0.18), transparent 60%),
      linear-gradient(285deg, rgba(5, 26, 74, 0.18),  transparent 65%),
      linear-gradient(135deg, var(--c1), var(--c2), var(--c3), var(--c4));
    background-blend-mode: multiply, multiply, screen, screen, soft-light, soft-light, normal;
    background-size: 180% 180%, 180% 180%, 220% 220%, 220% 220%, 160% 160%, 160% 160%, 400% 400%;
    background-position: 90% 10%, 5% 95%, 10% 50%, 90% 50%, 0% 0%, 100% 100%, 0% 50%;
    background-attachment: fixed;
    animation: orbitShift 16s ease-in-out infinite, baseDrift 28s linear infinite;
  }

  @keyframes orbitShift {
    0%   { background-position: 90% 10%, 5% 95%, 10% 50%, 90% 50%, 0% 0%, 100% 100%, 0% 50%; }
    50%  { background-position: 30% 30%, 70% 80%, 30% 60%, 70% 40%, 30% 10%, 70% 90%, 100% 50%; }
    100% { background-position: 90% 10%, 5% 95%, 10% 50%, 90% 50%, 0% 0%, 100% 100%, 0% 50%; }
  }
  @keyframes baseDrift {
    0%   { background-size: 180% 180%, 180% 180%, 220% 220%, 220% 220%, 160% 160%, 160% 160%, 400% 400%; }
    50%  { background-size: 200% 200%, 200% 200%, 240% 240%, 240% 240%, 170% 170%, 170% 170%, 450% 450%; }
    100% { background-size: 180% 180%, 180% 180%, 220% 220%, 220% 220%, 160% 160%, 160% 160%, 400% 400%; }
  }

  @media (prefers-reduced-motion: reduce) {
    body.page-applications { animation: none; }
  }
}

/* Touch devices: avoid scroll jank from fixed backgrounds */
@media (hover: none) and (pointer: coarse) {
  body.page-applications {
    background-attachment: scroll;
    animation: none;
  }
}

/* Applications cards & elements */
.page-applications .page-title,
.page-applications .card,
.page-applications .hr-glow,
.page-applications .page-hero { max-width: var(--maxw); margin-inline: auto; }

.page-applications .page-title h1 {
  margin: 0;
  font-size: clamp(1.75rem, 1.1rem + 2.8vw, 2.6rem);
  line-height: 1.15;
  background: linear-gradient(90deg, #111 0%, #6366f1 35%, #22d3ee 60%, #34d399 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .2px;
}

.page-applications .title-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .65rem; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.7));
  border: 1px solid rgba(59,130,246,0.40);
  box-shadow: 0 0 8px rgba(59,130,246,0.6), 0 0 15px rgba(59,130,246,0.8), 0 0 25px rgba(59,130,246,0.7);
  backdrop-filter: blur(6px);
}
.page-applications .title-badge img { max-height: 56px; width: auto; display: block; }
.page-applications .title-badge img.icon-thick { max-height: 64px; }

.page-applications .card {
  max-width: var(--maxw); margin: var(--space-2) auto;
  padding: clamp(1rem, 1vw + 1rem, 2rem);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(10, 31, 68, 0.92), color-mix(in oklab, rgba(10,31,68,0.92), transparent 20%));
  border: 1px solid rgba(59,130,246,0.40);
  box-shadow: 0 1px 2px rgba(2,6,23,0.10);
  backdrop-filter: blur(8px);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  overflow: clip;
  color: #e7eefc;
}
.page-applications .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(2,6,23,0.10), 0 8px 16px rgba(2,6,23,0.06);
  border-color: color-mix(in oklab, rgba(59,130,246,0.40), #6366f1 12%);
}
.page-applications .card--prominent { position: relative; }
.page-applications .card--prominent::after {
  content: ""; position: absolute; inset: -1px; border-radius: 17px; pointer-events: none;
  background: linear-gradient(90deg, #111 0%, #6366f1 35%, #22d3ee 60%, #34d399 90%);
  opacity: .25; mask: linear-gradient(#000, transparent 35%);
}
.page-applications .logo-inline { filter: drop-shadow(0 2px 6px rgba(2,6,23,.12)); }

/* scope the pale text to cards/content, not the whole body */
.page-applications .content .card p { color: #e7eefc; opacity: .94; }

/* Features list */
.page-applications .feature-list { list-style: none; padding-left: 0; display: grid; gap: .5rem; margin: .5rem 0 0; }
.page-applications .feature-list > li { position: relative; padding-left: 1.6rem; }
.page-applications .feature-list > li::before {
  content: ""; position: absolute; left: 0; top: .35rem; width: 1rem; height: 1rem; border-radius: 8px;
  background:
    radial-gradient(circle at 30% 30%, white 0 30%, transparent 32%),
    linear-gradient(135deg, #6366f1, #22d3ee, #34d399);
  box-shadow: 0 2px 6px rgba(2,6,23,.20);
}

/* Dividers */
.page-applications .hr-glow {
  border: 0; height: 1px; margin: var(--space-4) auto; max-width: var(--maxw);
  background: linear-gradient(90deg, transparent, color-mix(in oklab, #6366f1 40%, transparent), transparent);
  box-shadow: inset 0 4px 7px 12px rgb(38, 0, 255);
  opacity: .8;
}
.page-applications .divider {
  height: 1px; margin: var(--space-3) 0;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, #22d3ee 45%, transparent), transparent);
  opacity: .8;
}

/* Carousel (scoped) */
.page-applications .carousel { position: relative; margin-block: var(--space-3); }
.page-applications .carousel-viewport {
  display: grid; grid-auto-flow: column; grid-auto-columns: 100%;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  max-width: 250px; margin-inline: auto; border: 1px solid #000; border-radius: 50px; background: transparent; -webkit-overflow-scrolling: touch;
}
.page-applications .carousel .slide { position: relative; scroll-snap-align: center; display: grid; margin: 0; }
.page-applications .carousel .slide img { width: 100%; height: auto; object-fit: contain; border-radius: 50px; user-select: none; pointer-events: none; display: block; }

.page-applications .carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 2.6rem; height: 2.6rem; border: 0; border-radius: 999px;
  background: color-mix(in oklab, #fff 88%, #6366f1 8%);
  box-shadow: 0 2px 12px rgba(2,6,23,.20);
  font-size: 1.35rem; line-height: 1; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.page-applications .carousel-btn:hover { transform: translateY(-50%) scale(1.05); box-shadow: 0 4px 18px rgba(2,6,23,.24); }
.page-applications .carousel-btn:disabled { opacity: .35; cursor: default; }
.page-applications .carousel-btn.prev { left: .5rem; }
.page-applications .carousel-btn.next { right: .5rem; }



/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .page-applications .carousel-viewport { scroll-behavior: auto; }
  .page-applications .card, .page-applications .carousel-btn { transition: none; }
}

.no-js .menu-toggle { display: none !important; }
.no-js .top-nav { display: block !important; position: static !important; box-shadow: none !important; }
