/* =====================================================================
   Sealworks — responsive layer (2026-11-20)
   Loaded LAST in <head> on every page with the shared header.
   Additive overrides only. Remove the <link> to roll back.

   Breakpoints
     < 640px      phones (iPhone, iPhone Duo closed)      → hamburger menu
     640–1023px   iPhone Duo open, iPad portrait, small   → primary nav inline
                  laptops / split screen                     (was hamburger)
     860–1023px   iPhone Duo open landscape, iPad          → home hero side by side
     ≥ 1024px     desktop                                 → unchanged, except fluid
                                                             66px headlines to 1279px
   ===================================================================== */

/* ---------- 1. Header height must match the page's top padding ----------
   Pages pad the top 67px (<768) / 85px (768–1023) / 115px (≥1024), and the
   sticky sub-navs use the same numbers. Lock the header to those heights so
   nothing peeks between the header and a sticky sub-nav. */
@media (max-width: 767px) {
  html body header.header { min-height: 67px; max-height: 67px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  html body header.header { min-height: 85px; max-height: 85px; }
}

/* ---------- 2. Logo size ---------- */
@media (max-width: 639px) {
  html body header.header a[aria-label="Go home"] img { width: clamp(200px, 62vw, 260px) !important; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  html body header.header a[aria-label="Go home"] img { width: clamp(200px, 33vw, 340px) !important; }
}

/* ---------- 3. Primary nav inline from 640px (no hamburger) ---------- */
@media (min-width: 640px) and (max-width: 1023px) {
  html body header.header { padding-left: 16px !important; padding-right: 16px !important; gap: 16px; }
  html body header.header nav[aria-label="Primary Navigation"] { text-align: center; }
  html body header.header .menu-icon { display: none !important; }

  html body header.header .main-nav {
    position: relative !important; top: auto !important; left: auto !important; right: auto !important;
    width: auto !important; max-height: none !important; overflow: visible !important;
    flex-direction: row !important; align-items: center !important;
    gap: clamp(14px, 2.6vw, 32px) !important;
    padding: 0 !important; margin: 0 !important;
    border: 0 !important; box-shadow: none !important; background: transparent !important;
  }
  html body header.header .main-nav li { width: auto !important; padding: 0 !important; border: 0 !important; }

  html body header.header .main-nav li a {
    display: block !important; white-space: nowrap;
    font-size: clamp(15px, 1.75vw, 18px) !important; line-height: 1.2 !important;
    font-weight: 400 !important; color: #002D9A !important;
    padding: 24px 2px 10px !important; background: none !important; text-align: center !important;
  }
  html body header.header .main-nav li a:hover,
  html body header.header .main-nav li a:focus-visible { background: none !important; color: #000 !important; padding-left: 2px !important; }
  html body header.header .main-nav li a:focus-visible { outline: 2px solid #002D9A; outline-offset: 2px; border-radius: 2px; }

  /* active page: black, bold, red bar on top (same as desktop) */
  html body header.header .main-nav li a.active,
  html body header.header .main-nav li .active { color: #000 !important; font-weight: 700 !important; background: none !important; }
  html body header.header .main-nav .active::before,
  html body header.header .main-nav a.active::before {
    top: 0 !important; bottom: auto !important; left: 0 !important; right: 0 !important;
    width: 100% !important; height: 6px !important; background-color: #CC0000 !important;
  }

  /* yellow hover sweep (same as desktop) */
  html body header.header .main-nav a::after { display: block !important; bottom: 7px !important; height: 10px !important; }
  html body header.header .main-nav a.active::after { display: none !important; }
}

/* ---------- 4. Fluid 66px section headlines (process, our work, …) ----------
   Desktop size stays 66px at 1280px+; scales down smoothly below that
   instead of jumping straight to 66px at 768px. */
@media (min-width: 768px) and (max-width: 1279px) {
  html body main .md\:text-\[66px\] { font-size: clamp(40px, 5.2vw, 66px) !important; line-height: 1.16 !important; }
}

/* ---------- 5. Resources hero headline (84px desktop) ---------- */
@media (min-width: 641px) and (max-width: 1279px) {
  html body .swd-hero h1 { font-size: clamp(52px, 6.8vw, 84px) !important; }
}

/* ---------- 6. Process hero: diagram fills its panel ---------- */
@media (min-width: 768px) {
  html body .sw-hero-light-aside .gatsby-image-wrapper { width: min(88%, 560px) !important; max-width: none !important; margin: 0 auto !important; }
  html body .sw-hero-light-aside > div { width: 100%; display: flex; justify-content: center; }
}

@media (max-width: 767px) {
  html body .sw-hero-light-aside .gatsby-image-wrapper { width: min(calc(100% - 32px), 560px) !important; margin-left: auto !important; margin-right: auto !important; }
  html body .sw-hero-light-aside > div { width: 100%; display: flex; justify-content: center; }
}

/* ---------- 7. Home hero ("amazing experiences" + word cloud) ---------- */
/* 640–859 (Duo open portrait): stacked, cloud a bit smaller */
@media (min-width: 640px) and (max-width: 859px) {
  html body .bg-yellow.lg\:flex-row .sw-tag-host { max-width: 500px !important; margin-left: auto !important; margin-right: auto !important; }
}
/* 860–1023 (Duo open landscape, iPad): side by side, like desktop */
@media (min-width: 860px) and (max-width: 1023px) {
  html body .bg-yellow.lg\:flex-row { flex-direction: row !important; justify-content: space-between !important; align-items: center !important; }
  html body .bg-yellow.lg\:flex-row > div:first-child { flex: 0 0 40%; max-width: none !important; margin: 0 !important; padding: 24px 0 24px 28px; }
  html body .bg-yellow.lg\:flex-row > div:first-child h1 { font-size: 36px !important; line-height: 52px !important; }
  html body .bg-yellow.lg\:flex-row > .tags { flex: 1 1 auto; min-width: 0; }
  html body .bg-yellow.lg\:flex-row .sw-tag-host { max-width: 540px !important; margin: 16px 20px 16px auto !important; }
  html body .sw-tw.b, html body .sw-tw .b { font-size: clamp(22px, 2.5vw, 28px) !important; }
  html body .sw-tw.a, html body .sw-tw .a { font-size: clamp(26px, 2.9vw, 32px) !important; }
  html body .sw-tw.m, html body .sw-tw .m { font-size: clamp(20px, 2.3vw, 26px) !important; }
}

/* ---------- 8. Short screens (landscape phones, Duo closed landscape) ---------- */
@media (max-height: 700px) {
  html body .sw-call-tab { font-size: 14px; padding: 8px 18px 9px; }
}

/* ---------- 9. Phones: home hero headline + word cloud ----------
   At 382px the 40px headline ran edge to edge and cloud words overlapped. */
@media (max-width: 639px) {
  html body .bg-yellow.lg\:flex-row > div:first-child h1 { font-size: clamp(28px, 8.4vw, 40px) !important; line-height: 1.45 !important; }
  html body .sw-tw.b, html body .sw-tw .b { font-size: clamp(15px, 4.4vw, 22px) !important; }
  html body .sw-tw.a, html body .sw-tw .a { font-size: clamp(18px, 5vw, 26px) !important; }
  html body .sw-tw.m, html body .sw-tw .m { font-size: clamp(15px, 4.4vw, 22px) !important; }
}

/* ---------- 10. Side by side for the top two blocks, 860–1023px ----------
   (iPhone Duo open landscape, iPad landscape-ish, small windows)
   Keeps the desktop two-column layout instead of stacking everything. */
@media (min-width: 860px) and (max-width: 1023px) {
  /* Home — block 2: blue "we believe…" box + story */
  html body main .lg\:flex-row.lg\:gap-7 { flex-direction: row !important; gap: 24px !important; }
  html body main .lg\:flex-row.lg\:gap-7 > div:first-child { width: 34% !important; max-width: 400px; padding-left: 28px !important; padding-right: 28px !important; }
  html body main .lg\:flex-row.lg\:gap-7 > div:first-child h2 { font-size: 32px !important; line-height: 40px !important; }
  html body main .lg\:flex-row.lg\:gap-7 > div:last-child { width: 66% !important; margin: 0 !important; }
  html body main .lg\:flex-row.lg\:gap-7 .stories-content { font-size: 21px !important; line-height: 44px !important; }

  /* Process — block 2: notebook + "we start every project with a blank slate" */
  html body main div:has(> .sw-bs-notebook) { flex-direction: row !important; align-items: center !important; gap: 32px !important; margin-bottom: 96px !important; }
  html body main .sw-bs-notebook { flex: 0 0 32%; max-width: 300px !important; }
  html body main div:has(> .sw-bs-notebook) > div:last-child { flex: 1 1 auto; min-width: 0; padding: 0 !important; margin-right: 28px !important; }

  /* Our work — block 1: "our work is tailored to you." + collage */
  html body main section:has(> .sw-ow-hero-aside) { flex-direction: row !important; align-items: center !important; gap: 24px !important; }
  html body main section:has(> .sw-ow-hero-aside) > div:first-child { flex: 0 0 38% !important; width: 38% !important; }
  html body main .sw-ow-hero-aside { position: relative !important; flex: 1 1 auto !important; width: auto !important; min-width: 0; }

  /* Our work — block 2: ingredients grid + recipe text */
  html body main .sw-recipe { flex-direction: row !important; }
  html body main .sw-recipe { gap: 28px !important; }
  html body main .sw-recipe > .sw-ingredients-wrap,
  html body main .sw-recipe > .sw-ingredients-wrap + div { width: auto !important; flex: 1 1 0 !important; max-width: none !important; min-width: 0; margin-left: 0 !important; }
  html body main .sw-recipe .sw-ingredients { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }

  /* Resources — hero text + sticky-note stats */
  html body .swd-hero { flex-wrap: nowrap !important; gap: 32px !important; }
  html body .swd-hero-text { flex: 1 1 0 !important; }
  html body .swd-stats { flex: 0 0 330px !important; }

  /* Connect — hero text + sketch */
  html body main section:has(> .sw-cn-image-right) { flex-direction: row !important; align-items: center !important; gap: 28px !important; }
  html body main section:has(> .sw-cn-image-right) > div:first-child { display: flex !important; flex: 0 0 40% !important; width: 40% !important; margin-left: 20px !important; }
  html body main .sw-cn-image-right { order: 0 !important; flex: 1 1 auto !important; width: auto !important; min-width: 0; }
}

/* ---------- 11. Connect hero headline was clipped 860–1279px ---------- */
@media (min-width: 860px) and (max-width: 1279px) {
  html body main h1.sw-cn-h1 { font-size: clamp(44px, 4.6vw, 72px) !important; line-height: 1.05 !important; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  html body main .sw-cn-image-right { flex: 1 1 58% !important; width: 58% !important; min-width: 0; }
  html body main section:has(> .sw-cn-image-right) > div:first-child { flex: 0 0 38% !important; width: 38% !important; }
}
