/* ==========================================================================
   Dyna-K — Mobile / tablet overrides. Loaded last on every page.
   ========================================================================== */

/* ---- Global safety nets ---- */
html { -webkit-text-size-adjust: 100%; }
img, video, iframe, svg { max-width: 100%; }
table { max-width: 100%; }
.nav-mobile-contact, .sub-toggle { display: none; }

/* ---- Mobile navigation (<= 980px) ---- */
@media (max-width: 980px) {
  .navbar { position: relative; }
  .nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; font-size: 25.5px; line-height: 1;
    border-radius: var(--radius); cursor: pointer;
  }
  .nav-main {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--navy-deep);
    max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 6px 0 12px;
    box-shadow: 0 16px 32px rgba(10,25,49,.25);
  }
  .nav-main.is-open { display: flex; }
  body.nav-locked { overflow: hidden; }

  .nav-main > li { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav-main > li > a {
    flex: 1 1 0; color: var(--white); padding: 14px var(--gutter);
    font-size:22px;
  }
  .nav-main > li > a::after { display: none; }
  .nav-main > li.active > a,
  .nav-main > li > a:hover { color: var(--blue-light); }

  .sub-toggle {
    display: block; flex: 0 0 56px; background: none; border: 0;
    border-left: 1px solid rgba(255,255,255,.08);
    color: var(--blue-light); font-size:22px; cursor: pointer; padding: 0;
  }
  .sub-toggle:hover { transform: none; box-shadow: none; }
  .nav-main > li.sub-open > .sub-toggle { transform: rotate(180deg); }

  /* Submenus: collapsed accordion instead of hover flyout */
  .nav-main .dropdown {
    position: static; display: none; flex: 1 0 100%;
    min-width: 0; border: 0; box-shadow: none;
    background: rgba(255,255,255,.04); padding: 4px 0;
  }
  .nav-main > li:hover .dropdown { display: none; }
  .nav-main > li.sub-open .dropdown { display: block; }
  .nav-main .dropdown a {
    color: var(--blue-light); font-size:20px;
    padding: 12px calc(var(--gutter) + 14px);
  }
  .nav-main .dropdown a:hover { background: rgba(255,255,255,.06); color: var(--white); }

  /* The desktop top bar is hidden here, so surface phone/email in the menu */
  .nav-main > li.nav-mobile-contact {
    display: flex; flex-direction: column; border-bottom: 0;
    padding: 10px var(--gutter) 0; gap: 2px;
  }
  .nav-mobile-contact a {
    color: var(--blue-light); font-family: var(--f-mono); font-size:18px; padding: 8px 0;
  }
}

/* ---- Tablet & down (<= 900px) ---- */
@media (max-width: 900px) {
  body { font-size:23px; }
  section { padding: 32px 0; }
  .hero-full { min-height: 0; }
  .hero-full .container { padding-bottom: 110px; }
  .overview-grid, .split, .about-split .container { gap: 28px; }
  .footer-grid { gap: 28px; }
  .site-footer { padding-top: 44px; }
  .about-media-float { right: 0; bottom: -16px; }
  .about-split { padding-bottom: 48px; }
  .media-card-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .initiatives-grid, .gallery-grid[style] { grid-template-columns: 1fr 1fr !important; }
}

/* ---- Phones (<= 600px) ---- */
@media (max-width: 600px) {
  :root { --gutter: 18px; }
  body { font-size:20px; line-height: 1.6; }
  section { padding: 26px 0; }
  section.tight { padding: 20px 0; }

  /* Header */
  .brand-logo { height: 42px; }

  /* Headings */
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-head h2 { font-size: 27.5px; }
  .section-head p { max-width: none; }
  .page-hero h1 { font-size: 26px; }
  .hero h1 { font-size: 32px; }
  .hero-full h1 { font-size: 32px; line-height: 1.15; }
  .hero-full .container { padding-top: 56px; padding-bottom: 96px; }
  .hero p.lede { font-size:22px; margin-bottom: 24px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { justify-content: center; }
  .hero-carousel { height: 260px; }
  .hero-specs { gap: 18px; margin-top: 28px; }

  /* Home page strip / why band */
  .service-strip { margin-top: -44px; margin-bottom: 28px; }
  .service-chip { min-width: 50%; flex: 1 1 50%; padding: 18px 10px; }
  .service-chip:nth-child(2n) { border-right: none; }
  .why-band { padding: 44px 0 40px; }
  .pillar { padding: 0 6px; }
  .pillar span { font-size:15px; }

  /* Cards & grids */
  .frame-card { padding: 22px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stats-row .stat { padding: 20px 16px; border-bottom: 1px solid var(--line); }
  .stats-row .stat:nth-child(2n) { border-right: none; }
  .stats-row .stat:nth-last-child(-n+2) { border-bottom: none; }
  .logo-strip { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .cat-card { padding: 24px 12px 20px; }
  .cat-card h3 { font-size:20px; }
  .cat-card p { font-size:18px; }
  .initiatives-grid, .gallery-grid[style] { grid-template-columns: 1fr !important; }

  /* Float images (initiatives) stack above the text */
  .overview-copy img[style*="float"], .overview-copy p img[style*="float"] {
    float: none !important; margin: 0 0 12px 0 !important; max-width: 100% !important;
  }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand p { max-width: none; }
  .footer-bottom { flex-direction: column; gap: 8px; font-size:15px; }

  /* Forms: 16px inputs stop iOS Safari from zooming on focus */
  .field input, .field select, .field textarea,
  input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
  select, textarea { font-size:22px; }
  .form-panel { padding: 20px; }
  .form-grid { gap: 14px; }
  .btn { padding: 14px 20px; }
  form .btn, form button[type="submit"] { width: 100%; justify-content: center; }

  /* Spec rows */
  .spec-list .row { padding: 14px 0; }

  /* Embedded maps / tables never force sideways scroll */
  iframe { max-width: 100%; }
  .overview-copy, .spec-list, .form-panel { overflow-wrap: anywhere; }
  .overview-copy table { display: block; overflow-x: auto; }
  .overview-copy ul { padding-left: 20px; }

  /* Product rotator + loop showcase */
  .rot-stage { height: 300px; }
  .rot-thumb.pos-0 { width: 180px; height: 180px; }
  .loop-showcase { max-width: 320px; }
}

/* ---- Small phones (<= 380px) ---- */
@media (max-width: 380px) {
  .cat-grid { grid-template-columns: 1fr; }
  .service-chip { min-width: 100%; flex: 1 1 100%; border-right: none; }
  .hero-full h1, .hero h1 { font-size: 28px; }
  .stats-row .stat .num { font-size: 26px; }
}

/* ---- Touch devices: no sticky hover lifts ---- */
@media (hover: none) {
  .btn:hover, button:hover, .frame-card:hover, .cat-card:hover { transform: none; box-shadow: none; }
  .nav-main > li:hover .dropdown { display: none; }
}

/* ---- Company profile: milestone timeline + plant photo on phones ---- */
@media (max-width: 600px) {
  .journey-detail { gap: 8px; }
  .journey-arrow { width: 32px; height: 32px; }
  .journey-icon { width: 36px; height: 36px; }
  .journey-icon svg { width: 17px; height: 17px; }
  .journey-detail-body { gap: 10px; }
  .page-company-profile .g-wide, .page-about .g-wide { aspect-ratio: 16/9 !important; }
}

/* Form fields never overflow their panel */
.form-grid > * { min-width: 0; }
.field input, .field select, .field textarea { width: 100%; max-width: 100%; }
