/* ============================================================================
   GlowOps — Mobile Editorial Layer
   Loaded AFTER home.css / authority.css. EVERY rule lives inside a max-width
   query, so screens wider than the breakpoint render the approved desktop world
   untouched. This is a deliberate mobile editorial system (type scale, stacking,
   touch nav, safe-area), not a shrink. Primary breakpoint: 768px (phones + small
   tablets); refinements at 480px / 380px.
   ============================================================================ */

/* ---- iOS Safari engine concerns (apply at all sizes, harmless on desktop) ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ---- Mobile-only nav chrome: HIDDEN on desktop by default; the burger + panel
   are revealed only inside the ≤768px query below. Without this base rule the
   hamburger and (once opened) the menu panel leak onto wide screens. ---- */
.ew-folio__burger { display: none; }
.ew-folio__mobile { display: none; }

@media (max-width: 768px) {
  /* ---- global guards: no element may force a horizontal scroll ---- */
  html, body { overflow-x: hidden; max-width: 100%; }
  *, *::before, *::after { min-width: 0; }
  img, svg, video, iframe, canvas { max-width: 100%; height: auto; }
  /* fluid every oversized fixed container / centred max-width rail */
  .ew-bound { padding-left: 20px; padding-right: 20px; }
  [class*="__inner"], [class*="__colophon"], .ew-foot__cols, .ew-sub__inner,
  .ep-notes__inner, .wp-body__inner, .ew-edit__feature, .ew-mag-header__inner,
  .ew-pod-page-header__inner, .ew-pod-featured__inner, .ew-collab-page-header__inner {
    max-width: 100% !important;
  }

  /* ============================ HEADER / TOUCH NAV ======================== */
  .ew-folio {
    grid-template-columns: auto 1fr auto !important;
    padding: 12px 20px !important;
    padding-top: calc(12px + env(safe-area-inset-top)) !important;
    column-gap: 12px;
  }
  .ew-folio__left { display: none !important; }              /* date/vol meta -> off on mobile */
  .ew-folio__brand { justify-self: start; font-size: 20px; }
  .ew-folio__right { justify-self: end; }
  .ew-folio__right .ew-folio__nav,
  .ew-folio__right .ew-folio__studio { display: none !important; }  /* desktop nav hidden */
  .ew-folio__burger {
    display: inline-flex !important; flex-direction: column; justify-content: center;
    gap: 5px; width: 44px; height: 44px; padding: 10px; margin: -6px -8px -6px 0;
    background: transparent; border: 0; cursor: pointer;
  }
  .ew-folio__burger span { display: block; height: 2px; width: 100%; background: var(--glow); border-radius: 2px; transition: transform 180ms ease, opacity 160ms ease; }
  .ew-folio__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .ew-folio__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .ew-folio__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .ew-folio__mobile {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200;
    background: var(--velvet); color: var(--glow);
    padding: calc(24px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    animation: ew-menu-in 220ms ease;
  }
  @keyframes ew-menu-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
  .ew-folio__mobile-close {
    align-self: flex-end; width: 44px; height: 44px; background: transparent; border: 0;
    color: var(--glow); font-size: 26px; line-height: 1; cursor: pointer; margin-bottom: 8px;
  }
  .ew-folio__mobile-brand { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--glow); margin: 0 0 24px; }
  .ew-folio__mobile a, .ew-folio__mobile button {
    display: flex; align-items: center; min-height: 56px;
    font-family: var(--font-sans); font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--glow); background: transparent; border: 0; border-bottom: 1px solid rgba(242,233,216,0.12);
    text-align: left; cursor: pointer; width: 100%;
  }
  .ew-folio__mobile button.ew-folio__mobile-brand {
    min-height: auto;
    padding: 0 0 20px;
    font-family: var(--font-display);
    font-size: 30px;
    letter-spacing: 0;
    text-transform: none;
  }
  .ew-folio__mobile a[data-active="true"], .ew-folio__mobile button[data-active="true"] { color: var(--gold); }
  .ew-folio__mobile-section { margin-top: 18px; font-size: 11px; letter-spacing: 0.2em; color: var(--glow-mute); }

  /* ================================ HERO ================================= */
  .ew-hero { padding: 24px 20px 40px !important; min-height: auto !important; }
  .ew-hero__inner { grid-template-columns: 1fr !important; gap: 30px !important; }
  .ew-hero__title { font-size: clamp(46px, 15vw, 76px) !important; line-height: 1.0 !important; letter-spacing: -0.02em !important; }
  .ew-hero__title em { font-size: clamp(40px, 12.5vw, 66px) !important; line-height: 1.02 !important; letter-spacing: -0.03em !important; }
  .ew-hero__deck { font-size: 16px !important; line-height: 1.55 !important; }
  .ew-hero__cta { flex-direction: column; align-items: stretch; gap: 12px; }
  .ew-hero__btn { width: 100%; min-height: 50px; justify-content: center; }
  .ew-hero__subline { flex-wrap: wrap; gap: 8px 14px; }
  .ew-hero__issue { max-width: 100%; }
  .ew-hero__page img { width: 100%; }

  /* ===================== COLLAPSE MULTI-COLUMN GRIDS ===================== */
  .ew-womenprev__grid, .ew-women-3col, .ew-edit__portfolio-grid, .ew-colophon__cols,
  .ew-note__inner, .ew-collab__inner, .ew-pod-be-guest__inner, .ew-sub__inner,
  .ew-mag-header__inner, .ew-pod-page-header__inner, .ew-pod-featured__inner,
  .ew-collab-page-header__inner, .ew-collab-closing__inner, .arch-header__inner,
  .ew-edit__feature, .ep-notes__inner, .wp-body__inner {
    grid-template-columns: 1fr !important;
  }
  .ew-edit__meta { grid-template-columns: 1fr !important; }

  /* the editorial 12-col + 4-col card grids -> single feed */
  .ew-grid12, [style*="repeat(12"], [style*="repeat(4"], [style*="repeat(3"] { }
  .ew-women-grid, .ew-mag-grid, .ew-editions, .ew-pod-list { grid-template-columns: 1fr !important; }

  /* ==================== FIXED-PX "TABLE" ROWS -> STACK ==================== */
  .ew-convo-row { grid-template-columns: 40px 1fr !important; gap: 12px !important; }
  .arch-row { grid-template-columns: 1fr !important; grid-template-rows: auto !important; gap: 6px !important; }
  .arch-ep-cols, .arch-ep-row { grid-template-columns: 1fr auto !important; gap: 4px 12px !important; }
  .ew-entry-lane, .ew-collab__lane { grid-template-columns: 28px 1fr !important; gap: 12px !important; }

  /* ================================ FOOTER =============================== */
  .ew-foot { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .ew-foot__colophon { grid-template-columns: 1fr !important; gap: 28px !important; }
  .ew-foot__cols { grid-template-columns: 1fr 1fr !important; gap: 24px 18px !important; }
  .ew-foot__form { max-width: 100% !important; }

  /* spotlight / episode / woman readers: ensure single column + sane crop */
  .sr-opener { grid-template-columns: 1fr !important; min-height: auto !important; }
  .sr-opener__img { min-height: 64vw !important; }
  .velvet, .ew-velvet__inner { grid-template-columns: 1fr !important; }

  /* ============================ TYPE / RHYTHM ============================ */
  .ew-section { padding: 48px 20px !important; }
  .ew-section__head h2, .ew-mag-header__title, .ew-pod-page-header__title { font-size: clamp(30px, 8.5vw, 46px) !important; line-height: 1.05 !important; }
  .sr-article__body p, .wp-body p, .ep-notes p { font-size: 17px !important; line-height: 1.62 !important; }
  .sr-article { padding-left: 20px !important; padding-right: 20px !important; }
  .sr-article__headline { font-size: clamp(28px, 8vw, 42px) !important; line-height: 1.08 !important; }

  /* touch targets: every interactive element comfortably tappable */
  .ew-hero__btn, .ew-pod-page-header__btn, .ew-foot__cols a, .ew-folio__nav a,
  .ew-cta, button.ew-hero__readline { min-height: 44px; }
}

/* ---- very small phones (≤480) ---- */
@media (max-width: 480px) {
  .ew-foot__cols { grid-template-columns: 1fr !important; }
  .ew-hero__subline { font-size: 12px; }
  .ew-folio__brand { font-size: 18px; }
}

/* ---- narrowest (≤380: iPhone SE/mini) ---- */
@media (max-width: 380px) {
  .ew-bound { padding-left: 16px; padding-right: 16px; }
  .ew-hero { padding-left: 16px !important; padding-right: 16px !important; }
  .ew-section { padding-left: 16px !important; padding-right: 16px !important; }
}
