/**
 * derFund Mobile Responsive - Glass overlays, hamburger, search, subscribe
 * Design System: v2.50 Gold Authority
 * Mockup: header-footer-v9.0-production.html
 *
 * Z-index map:
 *   9999  - backdrops (dark overlay behind panels)
 *   10000 - glass panels (hamburger, search, subscribe)
 *   1001  - hamburger button
 */

/* ===== HAMBURGER MENU: Logo + Subscribe items (WordPress menu items) ===== */
/* Hide from desktop horizontal nav */
.elementor-nav-menu--main .herald-menu-logo,
.elementor-nav-menu--main .herald-menu-subscribe {
  display: none !important;
}

/* Logo in dropdown: same line as X close button */
.elementor-nav-menu--dropdown .herald-menu-logo {
  padding: 12px 56px 12px 20px !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  background: none !important;
  list-style: none !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
}
.elementor-nav-menu--dropdown .herald-menu-logo a,
.elementor-nav-menu--dropdown .herald-menu-logo .elementor-item {
  font-family: 'Playfair Display', serif !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.5px !important;
  color: var(--text-primary) !important;
  background: none !important;
  padding: 0 !important;
  border: none !important;
}
.elementor-nav-menu--dropdown .herald-menu-logo .logo-der {
  color: var(--text-primary) !important;
}
.elementor-nav-menu--dropdown .herald-menu-logo .logo-fund {
  color: var(--gold) !important;
  font-style: italic;
}
/* Logo palette overrides for dropdown context */
:root[data-theme="sunrise"] .elementor-nav-menu--dropdown .herald-menu-logo .logo-der {
  color: #1C1A14 !important;
}
:root[data-theme="sunset"] .elementor-nav-menu--dropdown .herald-menu-logo .logo-der {
  color: #e8e0d0 !important;
}

/* Subscribe in dropdown: centered gold pill button */
.elementor-nav-menu--dropdown .herald-menu-subscribe {
  display: flex !important;
  justify-content: center !important;
  padding: 20px 24px 24px !important;
  border: none !important;
  border-bottom: none !important;
  border-top: none !important;
  background: none !important;
  list-style: none !important;
}
.elementor-nav-menu--dropdown .herald-menu-subscribe a,
.elementor-nav-menu--dropdown .herald-menu-subscribe .elementor-item {
  background: var(--gold) !important;
  color: #fff !important;
  padding: 10px 40px !important;
  border-radius: 6px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: center !important;
  display: inline-block !important;
  transition: background 0.2s !important;
  border: none !important;
}
.elementor-nav-menu--dropdown .herald-menu-subscribe a:hover,
.elementor-nav-menu--dropdown .herald-menu-subscribe .elementor-item:hover {
  background: var(--gold-hover) !important;
  color: #fff !important;
}

/* ===== GLASS OVERLAY BASE (search + subscribe panels) ===== */
.herald-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  z-index: 10000;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-top: env(safe-area-inset-top, 0);
}
.herald-overlay.open { display: flex; }

/* Palette variants */
:root[data-theme="sunrise"] .herald-overlay {
  background: rgba(245,241,232,0.65);
}
:root[data-theme="sunset"] .herald-overlay {
  background: rgba(13,17,23,0.65);
  border-bottom-color: rgba(255,255,255,0.08);
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  .herald-overlay { background: rgba(255,255,255,0.97); }
  :root[data-theme="sunrise"] .herald-overlay { background: rgba(245,241,232,0.97); }
  :root[data-theme="sunset"] .herald-overlay { background: rgba(13,17,23,0.97); }
}

/* ===== BACKDROPS ===== */
.herald-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
}
.herald-backdrop.open { display: block; }

/* Close button (shared by search + subscribe) */
.herald-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== SEARCH OVERLAY ===== */
.herald-search-inner {
  padding: 20px 16px 24px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.herald-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.herald-search-header span {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.herald-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border-medium);
  border-radius: 12px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s;
}
.herald-search-row:focus-within { border-color: var(--gold); }
.herald-search-row i {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}
.herald-search-row input {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  padding: 10px 0;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
.herald-search-row input::-webkit-search-decoration,
.herald-search-row input::-webkit-search-cancel-button,
.herald-search-row input::-webkit-search-results-button,
.herald-search-row input::-webkit-search-results-decoration {
  -webkit-appearance: none;
}
.herald-search-row input::placeholder { color: var(--text-muted); }
.herald-search-row button {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.herald-search-row button:hover { background: var(--gold-hover); }
.herald-search-row button:disabled { opacity: 0.5; cursor: not-allowed; background: var(--text-muted); }

/* DS v2.125.11: clear-X inside the search input. Subtle until hover.
 * Override the gold-bg styling that .herald-search-row button applies to all
 * buttons - clear-X is an inline icon button, not a CTA. */
.herald-search-row .herald-search-clear {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.herald-search-row .herald-search-clear:hover,
.herald-search-row .herald-search-clear:focus-visible {
  background: transparent;
  color: var(--gold);
  outline: none;
}
.herald-search-row .herald-search-clear[hidden] {
  display: none;
}
.herald-trending {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.herald-trending-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.herald-trending-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.herald-trending-tags a {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-panel);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.herald-trending-tags a:hover { background: var(--gold); color: #fff; }

/* ===== SUBSCRIBE OVERLAY ===== */
.herald-subscribe-inner {
  padding: 24px 16px 28px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}
.herald-subscribe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.herald-subscribe-header span {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.herald-subscribe-inner h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.herald-subscribe-inner p {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}
.herald-subscribe-form { display: flex; gap: 8px; }
.herald-subscribe-form input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border-medium);
  border-radius: 6px;
  background: var(--bg-card);
  font-family: 'Inter', sans-serif;
  font-size: 16px; /* iOS Safari auto-zooms any <input> with computed font-size < 16px on focus. Keep >= 16px. */
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.herald-subscribe-form input:focus { border-color: var(--gold); }
.herald-subscribe-form input::placeholder { color: var(--text-muted); }
.herald-subscribe-form button {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.herald-subscribe-form button:hover { background: var(--gold-hover); }
.herald-subscribe-form button:disabled { opacity: 0.5; cursor: not-allowed; background: var(--text-muted); }
.herald-subscribe-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.herald-subscribe-consent input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin-top: 3px;
}
.herald-subscribe-consent span {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.herald-subscribe-consent a { color: var(--gold); text-decoration: none; }
.herald-subscribe-consent a:hover { text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .herald-subscribe-form { flex-direction: column; }
  /* Overlay: pin to viewport, prevent horizontal overflow on iOS */
  .herald-overlay {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
  }
  /* Search overlay: constrain width, keep row layout */
  .herald-search-inner {
    padding: 16px 12px 20px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .herald-search-header {
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .herald-search-header span { min-width: 0; flex-shrink: 1; }
  .herald-search-close { flex-shrink: 0; }
  .herald-search-row {
    padding: 8px 12px;
    gap: 8px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
  }
  .herald-search-row i { flex-shrink: 0; }
  /* font-size MUST be >= 16px. iOS Safari auto-zooms the viewport on focus otherwise. */
  .herald-search-row input { font-size: 16px; flex: 1 1 0; min-width: 0; width: 0; padding: 6px 0; }
  /* Hide submit button on narrow mobile - form submits via Enter key;
     icon-plus-placeholder reads as "search" affordance (Apple HIG pattern) */
  .herald-search-row button[type="submit"] { display: none; }
  .herald-trending-tags { gap: 6px; }
  .herald-trending-tags a { font-size: 12px; padding: 5px 10px; }
  /* Subscribe overlay: constrain width, tighter padding */
  .herald-subscribe-inner {
    padding: 16px 12px 20px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .herald-subscribe-inner h3 { font-size: 1.2rem; }
  .herald-subscribe-form { max-width: 100%; box-sizing: border-box; }
  .herald-subscribe-form input { min-width: 0; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .herald-overlay,
  .herald-hamburger line,
  .herald-nav-links a,
  .herald-search-row,
  .herald-subscribe-form input,
  .herald-subscribe-form button {
    transition: none !important;
  }
}

/* ===== PRINT ===== */
@media print {
  .herald-hamburger,
  .herald-overlay,
  .herald-backdrop { display: none !important; }
}

/* ===== HEADER HEIGHT: mobile nav bar parity with mockup v9.2 =====
   Outer header section (3fc301ee) ships with padding-mobile: 12/16 in the
   Elementor JSON. That stacked on top of the nav-row's 12/16 padding
   (754abae8, overridden in palette.css) makes the mobile header ~24px
   taller than the mockup. Zero out the outer section's padding so only
   the nav-row dictates vertical space.
   The desktop/tablet outer padding (0/0) is fine; this is mobile-only. */
@media (max-width: 767px) {
  .elementor-location-header .elementor-element-3fc301ee {
    --padding-top: 0 !important;
    --padding-bottom: 0 !important;
    --padding-left: 0 !important;
    --padding-right: 0 !important;
    padding: 0 !important;
  }
}

/* ===== AUTHOR ARCHIVE HERO: desktop row, mobile stack =====
   Shortcode [derfund_author_hero_section] outputs .author-hero-layout
   with .author-hero-photo (portrait image) and .author-hero-body (meta).
   Desktop: side-by-side row. Mobile: single column, centered. */
.author-hero-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 32px;
  padding: 40px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.author-hero-photo img.author-hero-portrait {
  width: 240px;
  height: 320px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border-subtle);
  display: block;
}
.author-beat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.author-beat-pills .author-beat-pill {
  display: inline-block;
}
@media (max-width: 767px) {
  .author-hero-layout {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 28px 16px 24px;
    text-align: center;
  }
  .author-hero-photo img.author-hero-portrait {
    width: 160px;
    height: 213px;
  }
  .author-hero-body .author-hero-meta-social,
  .author-hero-body .author-beat-pills {
    justify-content: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
}
