/* =============================================================
   ARK LABS — BASE STYLES
   Design tokens, reset, typography, layout primitives, nav,
   footer, and shared components used across every page.
   ============================================================= */

/* ---- Design tokens ---- */
:root {
  --navy: #0C2340;
  --navy-deep: #08182B;
  --cyan: #00AEE8;
  --cyan-dark: #0090C0;
  --cyan-light: #E6F7FD;
  --steel: #5A7184;
  --light-blue: #F0F7FF;
  --card-blue: #D9ECFD;
  --green: #0D8A6A;
  --green-light: #E8F5F0;
  --coral: #E8807A;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --white: #FFFFFF;
  --navy-alt: #1A2B3C;
  --bg-warm: #FAFBFD;
  --border: #E2EAF2;
  --border-light: #EDF2F7;
}

/* ---- Reset + base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--navy);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* Defensive: media never wider than its container. */
img, svg, video, iframe { max-width: 100%; }
img, video { height: auto; }
/* Long URLs / IDs / model names in body text shouldn't punch the layout. */
p, li, dd, blockquote, figcaption { overflow-wrap: anywhere; }

/* ---- Shared section primitives ---- */
.section-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.76em; font-weight: 700; color: var(--cyan);
  text-transform: uppercase; letter-spacing: 2px; margin-bottom: 14px;
}
.section-tag .bar { width: 20px; height: 2px; background: var(--cyan); border-radius: 1px; }
.section-title {
  font-size: 2.4em; font-weight: 800; color: var(--navy);
  line-height: 1.15; margin-bottom: 14px; letter-spacing: -0.5px;
}
.section-subtitle { font-size: 1.05em; color: var(--steel); line-height: 1.7; max-width: 620px; }

/* ---- Announcement bar ---- */
.announcement {
  background: var(--navy); color: white; text-align: center;
  padding: 10px 20px; font-size: 0.82em; font-weight: 500;
}
.announcement a { color: var(--cyan); text-decoration: none; font-weight: 700; margin-left: 6px; }
.announcement a:hover { text-decoration: underline; }

/* ---- Navigation ---- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 48px; height: 68px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: inline-flex; align-items: center;
  text-decoration: none; line-height: 0;
}
.nav-logo-img {
  height: 22px; width: auto; display: block;
}
/* Legacy placeholder mark — kept for any archived pages still referencing it */
.nav-logo .ark-mark {
  width: 32px; height: 32px; background: var(--cyan);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: white;
}
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links > a,
.nav-links > .nav-dropdown > a {
  color: var(--steel); text-decoration: none; font-size: 0.88em;
  font-weight: 500; transition: color 0.2s; display: inline-flex; align-items: center; gap: 4px;
}
.nav-links > a:hover,
.nav-links > .nav-dropdown > a:hover { color: var(--navy); }
.nav-links a.is-active { color: var(--cyan); font-weight: 600; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after {
  content: ''; width: 6px; height: 6px; display: inline-block;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px); margin-left: 2px;
}
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(6px);
  background: white; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(12,35,64,0.08);
  padding: 10px; min-width: 260px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
/* Wider menus for dropdowns with long subtitles (Solutions, Developers). */
.nav-dropdown-menu--wide { min-width: 360px; }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu a {
  display: block; padding: 10px 14px; border-radius: 8px;
  font-size: 0.88em; color: var(--navy); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown-menu a:hover { background: var(--light-blue); color: var(--cyan-dark); }
.nav-dropdown-menu a .sub {
  display: block; font-size: 0.78em; color: var(--steel); font-weight: 400; margin-top: 2px;
}

.nav-cta-group { display: flex; gap: 10px; align-items: center; }

/* Drawer wrapper — invisible on desktop (display:contents lets nav-links and
   nav-cta-group lay out as direct children of .nav). Becomes a real fixed
   off-canvas drawer below 1024px. */
.nav-drawer { display: contents; }

/* Hamburger toggle — hidden on desktop, 44x44 hit area on mobile (WCAG 2.5.5). */
.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  background: transparent; border: none; cursor: pointer;
  padding: 0; position: relative;
  border-radius: 8px;
}
.nav-toggle:hover { background: var(--light-blue); }
.nav-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.nav-toggle-bar {
  position: absolute; left: 11px; right: 11px; height: 2px;
  background: var(--navy); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease;
}
.nav-toggle-bar:nth-child(1) { top: 14px; }
.nav-toggle-bar:nth-child(2) { top: 21px; }
.nav-toggle-bar:nth-child(3) { top: 28px; }
.nav.is-open .nav-toggle-bar:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav.is-open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav.is-open .nav-toggle-bar:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* Per-dropdown chevron toggle button — hidden on desktop (CSS chevron handles
   the affordance there). On mobile this becomes the tap target that expands
   the dropdown's children inline as an accordion. */
.nav-dropdown-toggle {
  display: none;
  width: 44px; height: 44px;
  background: transparent; border: none; cursor: pointer;
  padding: 0; position: relative;
  border-radius: 8px;
}
.nav-dropdown-toggle::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy);
  transform: translate(-50%, -70%) rotate(45deg);
  transition: transform 0.2s ease;
}
.nav-dropdown-toggle[aria-expanded="true"]::before {
  transform: translate(-50%, -30%) rotate(-135deg);
}
.nav-dropdown-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Backdrop behind the open drawer. */
.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(12,35,64,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 998;
}
.nav-backdrop.is-visible { opacity: 1; pointer-events: auto; }

/* Body scroll lock when drawer open. */
body.has-nav-open { overflow: hidden; }

/* ---- Buttons ---- */
.btn-ghost {
  padding: 8px 18px; border-radius: 8px; font-size: 0.88em; font-weight: 600;
  color: var(--navy); background: transparent; border: none;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-ghost:hover { background: var(--light-blue); }

.btn-outline {
  padding: 8px 18px; border-radius: 8px; font-size: 0.88em; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--navy);
  background: transparent; cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }

.btn-primary {
  padding: 9px 22px; border-radius: 8px; font-size: 0.88em; font-weight: 600;
  background: var(--cyan); color: white; border: none;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-primary:hover { background: var(--cyan-dark); }

.btn-primary-lg {
  padding: 14px 32px; border-radius: 10px; font-size: 1em; font-weight: 700;
  background: var(--cyan); color: white; border: none;
  cursor: pointer; transition: all 0.2s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary-lg:hover {
  background: var(--cyan-dark); transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,174,232,0.25);
}

.btn-outline-lg {
  padding: 14px 32px; border-radius: 10px; font-size: 1em; font-weight: 600;
  border: 2px solid var(--border); color: var(--navy);
  background: white; cursor: pointer; transition: all 0.2s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-outline-lg:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---- Footer ---- */
.footer {
  position: relative;
  background: var(--bg-warm); padding: 56px 60px 36px;
}
/* Coral closing bar — brand signature motif (deck closing-slide rule).
   Pulled up 2px to seal the seam with the preceding section (no light
   border-top stripe showing between navy and coral). */
.footer::before {
  content: ""; position: absolute; left: 0; right: 0; top: -2px;
  height: 3px; background: var(--coral); z-index: 2;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-top { display: flex; justify-content: space-between; margin-bottom: 44px; gap: 48px; flex-wrap: wrap; }
.footer-brand { max-width: 280px; }
.footer-brand .footer-logo {
  display: inline-block; margin-bottom: 14px; line-height: 0;
  text-decoration: none;
}
.footer-brand .footer-logo-img {
  height: 20px; width: auto; display: block;
}
/* Legacy placeholder mark — kept for any archived pages still referencing it */
.footer-brand .logo-text {
  font-size: 1.2em; font-weight: 800; color: var(--navy); letter-spacing: 1.5px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.footer-brand .logo-text .ark-mark {
  width: 26px; height: 26px; background: var(--cyan); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: white;
}
.footer-brand p { font-size: 0.82em; color: var(--steel); line-height: 1.6; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-col h5 {
  font-size: 0.75em; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 14px;
}
.footer-col a {
  display: block; font-size: 0.85em; color: var(--steel);
  text-decoration: none; margin-bottom: 9px; transition: color 0.2s;
}
.footer-col a:hover { color: var(--cyan); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 20px;
  display: flex; justify-content: space-between; font-size: 0.78em; color: #A0AEC0;
  gap: 16px; flex-wrap: wrap;
}

/* ---- Simple page hero (for placeholder + content pages) ---- */
.page-hero {
  position: relative;
  padding: 80px 60px; background: var(--light-blue);
}
/* Coral cover bar — brand signature motif (deck cover-slide rule) */
.page-hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px; background: var(--coral);
}
.page-hero-inner { max-width: 1100px; margin: 0 auto; }
.page-hero h1 { font-size: 2.6em; font-weight: 800; line-height: 1.1; letter-spacing: -0.8px; color: var(--navy); margin-bottom: 12px; }
.page-hero p { font-size: 1.05em; color: var(--steel); line-height: 1.6; max-width: 720px; }

.page-body { padding: 80px 60px; background: var(--white); }
.page-body-inner { max-width: 1100px; margin: 0 auto; }

.placeholder-note {
  background: var(--amber-light); border: 1px dashed var(--amber);
  border-radius: 10px; padding: 16px 20px; color: #7A4A07;
  font-size: 0.9em; line-height: 1.6;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  /* Prevent the off-screen drawer (transform translateX(100%)) from
     inflating the document width and triggering horizontal scroll. */
  html, body { overflow-x: clip; }
  /* IMPORTANT: backdrop-filter on the .nav creates a containing block for
     position: fixed descendants (per CSS spec). That trapped .nav-drawer
     inside a 68px-tall nav box instead of letting it cover the viewport.
     Drop the blur on mobile — the navbar still has rgba(255,255,255,0.95)
     so it stays mostly opaque. */
  .nav { padding: 0 20px; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav-toggle { display: inline-block; }

  /* Drawer becomes a real off-canvas panel. */
  .nav-drawer {
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(380px, 100vw);
    background: var(--white);
    box-shadow: -8px 0 32px rgba(12,35,64,0.12);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    padding: 80px 20px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
  }
  .nav.is-open .nav-drawer { transform: translateX(0); visibility: visible; }

  /* Vertical link list inside drawer. */
  .nav-links {
    display: flex; flex-direction: column;
    align-items: stretch; gap: 0;
    margin-bottom: 24px;
  }
  .nav-links > a,
  .nav-links > .nav-dropdown > a {
    display: flex; align-items: center;
    min-height: 48px;
    padding: 12px 12px;
    font-size: 1em; font-weight: 600; color: var(--navy);
    border-radius: 8px;
  }
  .nav-links > a:hover,
  .nav-links > .nav-dropdown > a:hover { background: var(--light-blue); }

  /* Dropdown becomes accordion. */
  .nav-dropdown {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
  }
  .nav-dropdown > a { grid-column: 1; }
  .nav-dropdown-toggle { display: inline-block; grid-column: 2; }
  .nav-dropdown > a::after { display: none; } /* hide desktop chevron */
  .nav-links > a { border-bottom: 1px solid var(--border-light); }

  .nav-dropdown-menu {
    grid-column: 1 / -1;
    position: static; transform: none;
    border: none; box-shadow: none; border-radius: 0;
    padding: 0 0 8px 16px;
    min-width: 0; white-space: normal;
    opacity: 1; pointer-events: auto;
    display: none;
    background: transparent;
  }
  .nav-dropdown-menu--wide { min-width: 0; }
  .nav-dropdown.is-expanded > .nav-dropdown-menu { display: block; }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    /* Hover/focus-within reverts on mobile — accordion is click-based. */
    opacity: 1; pointer-events: auto; transform: none;
  }
  .nav-dropdown:not(.is-expanded):hover .nav-dropdown-menu,
  .nav-dropdown:not(.is-expanded):focus-within .nav-dropdown-menu {
    display: none;
  }
  .nav-dropdown-menu a {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 0.95em;
  }

  /* CTAs stack full-width at the bottom of the drawer. */
  .nav-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
  }
  .nav-cta-group .btn-ghost,
  .nav-cta-group .btn-outline,
  .nav-cta-group .btn-primary {
    text-align: center;
    padding: 12px 18px;
    font-size: 0.95em;
  }

  .page-hero, .page-body { padding-left: 24px; padding-right: 24px; }
  .footer { padding-left: 24px; padding-right: 24px; }
  .footer-top { flex-direction: column; }
  .footer-cols { gap: 32px; }
  /* Touch-friendly footer links — WCAG 2.5.5 wants 44x44 minimum.
     The desktop margin-bottom: 9px gives a ~16px tap height; bump to
     ~36-40px on touch surfaces. */
  .footer-col a {
    padding: 10px 0;
    margin-bottom: 0;
  }
}

/* Narrow phones — keep announcement readable, scale hero. */
@media (max-width: 600px) {
  .announcement { font-size: 0.78em; padding: 10px 16px; line-height: 1.45; }
  .announcement a { display: inline-block; margin-left: 0; }
  .nav { padding: 0 16px; height: 64px; }
  .page-hero { padding: 56px 20px; }
  .page-hero h1 { font-size: 2em; }
  .page-hero p { font-size: 1em; }
  .page-body { padding: 56px 20px; }
  .nav-drawer { width: 100vw; padding-top: 76px; }
  .footer { padding: 48px 20px 28px; }
  .footer-cols { gap: 28px; }
}

/* Reduced motion — disable drawer/backdrop transitions. */
@media (prefers-reduced-motion: reduce) {
  .nav-drawer, .nav-backdrop, .nav-toggle-bar, .nav-dropdown-toggle::before {
    transition: none;
  }
}

/* Stacked hero CTAs — make every hero CTA group's buttons equal width
   when they wrap to a column on phones. Matches every *-hero-ctas
   variant across the site (.hero-ctas, .ph-hero-ctas, .pc-hero-ctas,
   .ac-hero-ctas, .sol-hero-ctas, .aud-hero-ctas, .research-hero-ctas,
   .partners-hero-ctas, .about-hero-ctas, .news-hero-ctas, .blog-hero-ctas). */
@media (max-width: 640px) {
  [class*="hero-ctas"] {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  [class*="hero-ctas"] > .btn-primary,
  [class*="hero-ctas"] > .btn-primary-lg,
  [class*="hero-ctas"] > .btn-outline,
  [class*="hero-ctas"] > .btn-outline-lg,
  [class*="hero-ctas"] > .btn-ghost,
  [class*="hero-ctas"] > a,
  [class*="hero-ctas"] > button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
