/* ===================================================================
   PRAVI — RESPONSIVE LAYER
   Loaded AFTER directions.css on every page. The desktop design is
   untouched; everything here only takes effect at narrower widths.

   Strategy: pages keep their inline desktop grid definitions. The
   utility classes below only set columns/gaps INSIDE media queries
   with !important, so they override React inline styles on small
   screens while leaving the desktop layout exactly as designed.

   Breakpoints:   1080  laptop / tablet-landscape
                   860  tablet-portrait
                   560  phone
   =================================================================== */

/* ------------------------------------------------------------------ *
   1. NAV — hamburger + mobile drawer (shared chrome, all pages)
 * ------------------------------------------------------------------ */
.dir-editorial .nav .row { gap: 20px; }

/* burger button — hidden on desktop */
.nav-burger {
  display: none;
  margin-left: auto;
  width: 46px; height: 46px;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 5px;
  border: 1px solid var(--rule);
  background: var(--paper);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-burger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink);
  transition: transform .25s ease, opacity .2s ease;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* mobile drawer */
.nav-mobile {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--paper);
  border-top: 2px solid var(--pravi-orange);
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 24px 48px -18px rgba(11,20,48,.28);
  z-index: 60;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-mobile a { display: block; color: var(--ink); text-decoration: none; }
.nav-mobile .nm-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 5vw;
  font-family: 'DM Sans', sans-serif; font-size: 17px; font-weight: 600;
  border-bottom: 1px solid var(--rule-soft);
  width: 100%; background: transparent; cursor: pointer; text-align: left;
}
.nav-mobile .nm-item.active { color: var(--pravi-blue); }
.nav-mobile .nm-caret { font-size: 11px; opacity: .5; transition: transform .2s ease; }
.nav-mobile .nm-caret.open { transform: rotate(180deg); }
.nav-mobile .nm-sub {
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule-soft);
}
.nav-mobile .nm-sub a {
  padding: 13px 6vw; font-size: 15px; font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.nav-mobile .nm-sub a:last-child { border-bottom: 0; }
.nav-mobile .nm-cta {
  margin: 18px 5vw 22px;
  padding: 16px 22px;
  background: var(--pravi-blue); color: var(--paper);
  font-family: 'DM Sans', sans-serif; font-size: 15.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}

@media (max-width: 1080px) {
  .dir-editorial .nav ul.nav-desktop { display: none !important; }
  .dir-editorial .nav .row .cta.nav-desktop-cta { display: none !important; }
  .nav-burger { display: flex; }
  .nav-mobile.show { display: block; }
  .dir-editorial .nav .brand img { height: 46px !important; }
}

/* ------------------------------------------------------------------ *
   2. SECTION RHYTHM — tighten padding as the viewport shrinks
 * ------------------------------------------------------------------ */
@media (max-width: 1080px) {
  .page .section { padding: 72px 5vw; }
  .page .section.tight { padding: 48px 5vw; }
  .page .section.wide { padding: 44px 5vw; }
}
@media (max-width: 560px) {
  .page .section { padding: 52px 6vw; }
  .page .section.tight,
  .page .section.wide { padding: 40px 6vw; }
}

/* ------------------------------------------------------------------ *
   3. DISPLAY TYPE — keep the big serif from overflowing tiny screens
 * ------------------------------------------------------------------ */
@media (max-width: 560px) {
  .dir-editorial .display { font-size: clamp(42px, 13vw, 60px); line-height: .96; }
  .dir-editorial .lead { font-size: 18.5px; line-height: 1.45; }
  .dir-kinetic .display { font-size: clamp(52px, 16vw, 86px); }
  .dir-architect .display { font-size: clamp(54px, 16vw, 92px); }
  .dir-civic .display { font-size: clamp(44px, 13vw, 72px); }
}

/* ------------------------------------------------------------------ *
   4. UTILITY GRID COLLAPSES (override inline desktop grids)
 * ------------------------------------------------------------------ */
/* → single column at laptop width */
@media (max-width: 1080px) {
  .r-stack-lg { grid-template-columns: 1fr !important; gap: 34px !important; }
  .r-3up { grid-template-columns: repeat(2, 1fr) !important; }
  .r-4up { grid-template-columns: repeat(2, 1fr) !important; }
}
/* → single column at tablet-portrait */
@media (max-width: 860px) {
  .r-stack-md { grid-template-columns: 1fr !important; gap: 28px !important; }
  .r-2to1 { grid-template-columns: 1fr !important; gap: 22px !important; }
}
/* → single column at phone */
@media (max-width: 560px) {
  .r-stack-lg, .r-stack-md { gap: 24px !important; }
  .r-3up, .r-4up { grid-template-columns: 1fr !important; }
  .r-2col-sm { grid-template-columns: 1fr !important; gap: 18px !important; }
}

/* Bordered card grids: once they leave the desktop layout, swap inner
   right-borders for bottom dividers so columns/rows read cleanly and we
   never double a line against the container edge. Columns themselves are
   driven by r-3up / r-4up / r-2to1, not here. */
@media (max-width: 1080px) {
  .r-bordered > * {
    border-right: none !important;
    border-bottom: 1px solid var(--rule) !important;
  }
  .r-bordered > *:last-child { border-bottom: none !important; }
}

/* ------------------------------------------------------------------ *
   5. PRAVI WAY — RoadmapLine: drop the center spine, stack cards
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
  .pv-roadmap { padding: 8px 0 !important; }
  .pv-roadmap > div:not(.pv-step-row),
  .pv-roadmap .pv-dot-col { display: none !important; }
  .pv-roadmap .pv-step-row {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    margin-bottom: 4px !important;
  }
  .pv-roadmap .pv-col {
    grid-column: 1 !important;
    text-align: left !important;
    padding: 0 !important;
    visibility: visible !important;
  }
  .pv-roadmap .pv-col:empty { display: none !important; }
  .pv-roadmap .pv-col .card,
  .pv-roadmap .pv-col > div {
    max-width: 100% !important;
    text-align: left !important;
    display: block !important;
  }
  .pv-roadmap .pv-col .card h3 { font-size: 40px !important; }
}

/* ------------------------------------------------------------------ *
   6. LIFE AT PRAVI — editorial photo mosaic → simple grid
 * ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .r-mosaic { grid-template-columns: repeat(2, 1fr) !important; grid-auto-rows: 220px !important; }
  .r-mosaic > * { grid-column: auto !important; grid-row: auto !important; }
}
@media (max-width: 560px) {
  .r-mosaic { grid-template-columns: 1fr !important; grid-auto-rows: 240px !important; }
}

/* ------------------------------------------------------------------ *
   7. BLOG BENTO (home) — 6-col span grid → single column
 * ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .r-bento { grid-template-columns: 1fr !important; grid-auto-rows: auto !important; }
  .r-bento > * { grid-column: auto !important; grid-row: auto !important; }
}

/* ------------------------------------------------------------------ *
   8. LEDGER / WIDE ROWS — multi-column rows that must restructure
 * ------------------------------------------------------------------ */
/* services SectorsLedger: 130px 1fr 320px */
@media (max-width: 860px) {
  .r-ledger-row {
    grid-template-columns: auto 1fr !important;
    gap: 18px !important;
    padding: 24px 22px !important;
  }
  .r-ledger-row .r-ledger-media { display: none !important; }
}
/* resources Events: 320px 1fr auto */
@media (max-width: 860px) {
  .r-event-row {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .r-event-row .r-event-media { max-width: 100%; }
  .r-event-row .r-event-aside { text-align: left !important; min-width: 0 !important; }
}
/* careers Roles: 70px 2.2fr 1fr 1fr 1.2fr 110px */
@media (max-width: 860px) {
  .r-role-row {
    grid-template-columns: 48px 1fr auto !important;
    gap: 14px !important;
    padding: 20px 20px !important;
  }
  .r-role-row .r-role-hide { display: none !important; }
}
@media (max-width: 560px) {
  .r-role-row { grid-template-columns: 1fr auto !important; }
  .r-role-row .r-role-no { display: none !important; }
}

/* category ServiceBlock header: auto 1fr auto */
@media (max-width: 700px) {
  .r-svc-head {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 24px 22px !important;
  }
  .r-svc-head .r-svc-dur { text-align: left !important; }
  .r-svc-body { grid-template-columns: 1fr !important; }
  .r-svc-body > * { border-right: none !important; }
  .r-svc-body > *:first-child { border-bottom: 1px solid var(--rule) !important; }
}

/* services CorePractices: 1fr 1fr editorial spread → stacked, image first */
@media (max-width: 860px) {
  .r-practice { grid-template-columns: 1fr !important; }
  .r-practice > div { order: 0 !important; border-left: none !important; border-right: none !important; }
  .r-practice > div:first-child { min-height: 280px !important; }
  .r-practice > div:last-child { padding: 34px 26px 32px !important; }
}

/* careers Fellowship: image panel shrink when stacked */
@media (max-width: 860px) {
  .r-fellow > *:first-child { min-height: 300px !important; }
  .r-fellow > *:last-child { padding: 40px 30px !important; }
}

/* ------------------------------------------------------------------ *
   9. FOOTER — 5-col → 2-col → 1-col, with brand block full width
 * ------------------------------------------------------------------ */
@media (max-width: 980px) {
  .home-footer-grid { grid-template-columns: 1fr 1fr 1fr !important; gap: 30px !important; }
  .home-footer-grid > *:first-child { grid-column: 1 / -1 !important; }
}
@media (max-width: 620px) {
  .home-footer-grid { grid-template-columns: 1fr 1fr !important; gap: 26px !important; }
}
@media (max-width: 420px) {
  .home-footer-grid { grid-template-columns: 1fr !important; }
}

/* ------------------------------------------------------------------ *
   10. CTA band + generic form grids
 * ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .r-form-2 { grid-template-columns: 1fr !important; }
  .r-form-2 label[style*="span 2"],
  .r-form-2 .r-form-full { grid-column: 1 / -1 !important; }
}

/* Inputs comfortably tappable on mobile */
@media (max-width: 560px) {
  .dir-editorial input,
  .dir-editorial textarea,
  .dir-editorial .btn { font-size: 16px; }
}
