/* UrbanFiling static site: device adaptation layer (phones, tablets, laptops, desktops).
   Loaded on every page by tools/build-static-site.mjs. Desktop layout is unchanged;
   rules only switch on for small screens or touch input. */

/* ---- all devices ------------------------------------------------------ */
img, svg, video, iframe { max-width: 100%; height: auto; }
table { max-width: 100%; }
.uf-menu-btn { display: none; }
.header nav .uf-menu-extra { display: none; } /* phone-menu extras never show in the desktop bar */
.header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Readable minimum (12px) for the few decorative labels that were 10-11px. */
.topbar-badge, .footer small, .ws-duration, .doc-required, .header .logo div[style*="font-size:.64rem"] { font-size: 12px !important; }

/* ---- touch screens and anything narrower than a laptop ------------------ */
@media (hover: none) and (pointer: coarse) {
  /* A tap on "All Services" opens the page instead of a hover-only panel. */
  .mega-wrapper:hover .mega-menu, .mega-wrapper:focus-within .mega-menu { display: none !important; }
}
@media (max-width: 1023px), (pointer: coarse) {
  /* Comfortable tap targets (WCAG 2.5.8: at least 24px; we aim for 40px+). */
  .topbar a, .footer-links a, .footer-legal a, .footer-contact-list a, .footer-bottom a,
  .breadcrumb-inner a, li > a:only-child, .uf-svc-cat h2 a {
    display: inline-flex; align-items: center; min-height: 40px;
  }
  .footer-links { gap: 2px !important; }
  .nav-item { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-primary-sm, .btn-outline-sm { min-height: 44px; display: inline-flex; align-items: center; }
  input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; min-width: 24px; }
  input[type="range"] { min-height: 32px; }
  select { min-height: 44px; }
  label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 40px; }
}

/* ---- tablets and small laptops ---------------------------------------- */
@media (max-width: 1023px) {
  .header-inner, .topbar-inner, .section-inner, .footer-inner { padding-left: 16px; padding-right: 16px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ---- phones ------------------------------------------------------------ */
@media (max-width: 640px) {
  /* Mobile menu: the original CSS hides <nav> below 640px with no way to open it. */
  .header { position: sticky; }
  .header-inner { position: relative; }
  .uf-menu-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 44px; min-height: 44px; padding: 0 10px; margin-left: 4px;
    border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: #fff;
    color: var(--text-dark, #0f172a); font: 600 .8rem/1 inherit; cursor: pointer; flex-shrink: 0;
  }
  .uf-menu-btn svg { width: 22px; height: 22px; }
  .uf-menu-btn .uf-close { display: none; }
  html.uf-nav-open .uf-menu-btn .uf-open { display: none; }
  html.uf-nav-open .uf-menu-btn .uf-close { display: block; }
  html.uf-nav-open .header nav {
    display: flex !important; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 300;
    background: #fff; border-bottom: 1px solid var(--border, #e2e8f0);
    box-shadow: 0 16px 40px rgba(15, 23, 42, .14); padding: 8px 12px 14px;
    max-height: calc(100vh - 70px); max-height: calc(100dvh - 70px); overflow-y: auto;
  }
  html.uf-nav-open .header nav .nav-item { display: flex; width: 100%; min-height: 48px; font-size: 1rem; padding: 12px 14px; }
  html.uf-nav-open .header nav .mega-menu { display: none !important; }
  html.uf-nav-open .header nav .uf-menu-extra { display: flex; }
  .header nav .uf-menu-extra { border-top: 1px solid var(--border, #e2e8f0); margin-top: 6px; padding-top: 6px; }
  html.uf-nav-open body { overflow: hidden; }

  .header-inner { gap: 8px; height: 62px; }
  /* Logo: drop the small "13 Categories" line so the header fits. */
  .header .logo div[style*="font-size:.64rem"] { display: none; }
  .header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

  /* Readable text: nothing below 12px. */
  .topbar-badge, .footer small, small, .ws-duration, .doc-required { font-size: 12px !important; }
  .topbar { font-size: 13px; }
  .topbar-inner { flex-wrap: wrap; row-gap: 2px; }

  /* iOS Safari zooms into any field below 16px; keep the page steady. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
  button, input[type="submit"] { min-height: 44px; }
}

/* ---- narrow phones: "Book Consultation" moves into the menu -------------- */
@media (max-width: 480px) {
  .header-actions { display: none !important; }
  .uf-menu-btn { margin-left: auto; }
  .header nav .uf-menu-cta {
    display: flex; justify-content: center; margin-top: 8px; min-height: 48px; font-size: 1rem;
    background: linear-gradient(135deg, var(--primary, #1d4ed8), var(--secondary, #7c3aed)); color: #fff !important; border-radius: 10px;
  }
}
@media (min-width: 481px) { .header nav .uf-menu-cta { display: none !important; } }
@media (max-width: 360px) {
  .logo-text { font-size: 1rem !important; }
}

/* ---- large desktops ------------------------------------------------------ */
@media (min-width: 1920px) {
  html { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .header, .uf-menu-btn, .footer { display: none !important; }
}

/* ---- cookie choice banner (uf-journey.js) -------------------------------- */
.uf-cookie { position: fixed; left: 0; right: 0; bottom: 0; z-index: 400; padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.uf-cookie-in { max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .18); padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.uf-cookie-in p { flex: 1 1 320px; margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-dark, #0f172a); }
.uf-cookie-in a { color: var(--primary, #1d4ed8); text-decoration: underline; }
.uf-cookie-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.uf-cookie-btns button { min-height: 44px; padding: 0 16px; border-radius: 10px; font: 600 14px/1 inherit; cursor: pointer; }
.uf-cookie-no { background: #fff; color: var(--text-dark, #0f172a); border: 1px solid var(--border, #cbd5e1); }
.uf-cookie-yes { background: var(--primary, #1d4ed8); color: #fff; border: 1px solid transparent; }
@media (max-width: 480px) { .uf-cookie-btns { width: 100%; } .uf-cookie-btns button { flex: 1; } }
@media print { .uf-cookie { display: none !important; } }
