/* =========================================================================
   Responsive layer — breakpoints:
   1180px (compact desktop) · 1080px (mobile navigation) · 900px (tablet) · 640px (phone)
   ========================================================================= */

@media (max-width: 1180px) {
  .header-phone span { display: none; }
  .header-phone { width: 44px; height: 44px; justify-content: center; border: 1px solid rgba(255,255,255,0.25); border-radius: var(--radius-sm); }
  .nav-link { padding-inline: 0.65rem; }
  .nav-link::after { left: 0.65rem; right: 0.65rem; }
  .mega-grid { grid-template-columns: 1fr 1fr 200px; }
  .footer-top { grid-template-columns: 1.2fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- Mobile navigation ---------- */
@media (max-width: 1080px) {
  :root { --header-h: 72px; }
  .brand img { width: 156px; }
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed; left: 0; right: 0; top: var(--nav-top, var(--header-h)); bottom: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0;
    background: var(--ink-900); padding: 1rem var(--gutter) 2rem;
    overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s;
  }
  .primary-nav.is-open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .no-js .primary-nav { position: static; visibility: visible; opacity: 1; transform: none; padding: 0 0 1rem; }
  .no-js .header-inner { flex-wrap: wrap; }
  .no-js .nav-toggle { display: none; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav-list > li { border-bottom: 1px solid var(--line-dark); }
  .nav-link { width: 100%; justify-content: space-between; padding: 1rem 0.25rem; min-height: 56px; font-size: 1.1rem; }
  .nav-link::after { display: none; }
  .mega-menu, .dropdown {
    position: static; width: auto; margin: 0; transform: none; opacity: 1; visibility: visible;
    box-shadow: none; border-top: 0; border-radius: var(--radius); background: var(--ink-800);
    display: none; transition: none;
  }
  .mega-menu::before, .dropdown::before { display: none; }
  .has-menu.is-open > .mega-menu, .has-menu.is-open > .dropdown { display: block; margin-bottom: 1rem; }
  .no-js .has-menu > .mega-menu, .no-js .has-menu > .dropdown { display: block; }
  .mega-grid { grid-template-columns: 1fr; }
  .mega-col { padding: 1rem 1.1rem; }
  .mega-col + .mega-col { border-left: 0; border-top: 1px solid var(--line-dark); }
  .mega-heading { color: var(--orange-soft); }
  .mega-list a, .dropdown a { color: #e7e8eb; padding-block: 0.65rem; min-height: 44px; }
  .mega-list .icon, .dropdown .icon { color: var(--orange-soft); }
  .mega-list a:hover, .dropdown a:hover, .mega-list a[aria-current="page"], .dropdown a[aria-current="page"] { background: rgba(243,146,0,0.12); color: #fff; }
  .mega-aside { display: none; }
  .dropdown { padding: 0.5rem 1.1rem; }
  .nav-actions { flex-direction: column; align-items: stretch; gap: 0.75rem; margin-top: 1.5rem; }
  .nav-actions .btn { width: 100%; min-height: 52px; }
  .header-phone { width: auto; height: auto; min-height: 52px; border: 1px solid rgba(255,255,255,0.25); justify-content: center; }
  .header-phone span { display: inline; }
  body.nav-open { overflow: hidden; }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .topbar p.topbar-msg { display: none; }
  .topbar .container { justify-content: flex-end; }
  .hero-grid, .page-hero-grid, .split, .split--60, .faq-layout, .article-layout { grid-template-columns: 1fr; }
  .hero-visual { min-height: 420px; max-width: 520px; width: 100%; margin-inline: auto; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps--3 { grid-template-columns: 1fr; }
  .steps-connector .step::after { display: none; }
  .value-item:nth-child(3) { border-left: 0; }
  .value-item:nth-child(n+3) { border-top: 1px solid var(--line); padding-top: 1.2rem; margin-top: 0.6rem; }
  .cover-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .post-card--featured { grid-template-columns: 1fr; }
  .post-card--featured .post-thumb { min-height: 220px; }
  .cta-band .container { flex-direction: column; align-items: flex-start; }
  .split-head, .related-head { flex-direction: column; align-items: flex-start; }
  .sidebar { position: static; }
  .page-hero h1 { max-width: none; }
  .footer-top { grid-template-columns: 1fr 1fr; }
}

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .topbar { display: none; }
  .brand img { width: 138px; }
  .hero { padding-top: 2.75rem; }
  .hero .btn-row .btn, .page-hero .btn-row .btn, .cta-band .btn-row .btn { width: 100%; }
  .hero-visual { min-height: 330px; }
  .process-card { display: none; }
  .book-mock { width: 200px; }
  .book-mock__title { font-size: 1.6rem; }
  .grid-2, .grid-3, .grid-4, .steps--4, .spec-grid, .form-grid { grid-template-columns: 1fr; }
  .value-item + .value-item { border-left: 0; border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 0.6rem; }
  .cover-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .cover-card .cover-title { font-size: 1rem; }
  .footer-top { grid-template-columns: 1fr; }
  .footer-bottom .container { flex-direction: column; }
  .faq-item summary { font-size: 1rem; padding: 1rem 1.1rem 0.9rem; }
  .faq-answer { padding: 0 1.1rem 1.1rem; }
  .form-footer .btn { width: 100%; }
  .tablist { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.4rem; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: thin; }
  .tab { flex: none; }
  .back-to-top { right: 0.9rem; bottom: 0.9rem; }
  .lightbox-close { top: 6px; right: 6px; }
}

@media (max-width: 380px) {
  .cover-grid { grid-template-columns: 1fr; max-width: 280px; margin-inline: auto; }
}

@media print {
  .site-header, .topbar, .site-footer, .back-to-top, .cta-band, .nav-toggle { display: none !important; }
  .page-hero, .hero { background: none; color: #000; border: 0; }
  .page-hero h1, .hero h1 { color: #000; }
}

/* Quick form */
@media (max-width: 900px) {
  .hero-form { justify-self: center; max-width: 560px; }
}
@media (max-width: 640px) {
  .quick-form { border-radius: 10px; }
  .qf-submit { min-height: 58px; }
}

/* 4-across cover grid */
@media (max-width: 1080px) { .cover-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .cover-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 380px)  { .cover-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; gap: 1rem; } }

/* Service-page hero form */
@media (max-width: 900px) {
  .page-hero .hero-form { justify-self: stretch; max-width: none; }
}
@media (max-width: 640px) {
  .topbar-links { gap: 1rem; }
}
