/* ============================================================
   PaxHelios — Responsive overrides (loaded everywhere via global.css)
   ============================================================ */

/* ------------------------------------ TABLET (≤ 900px) */
@media (max-width: 900px) {
  /* Wrap padding shrinks */
  .wrap, .wrap-wide { padding-left: 20px; padding-right: 20px; }

  /* Section spacing reduces */
  .section    { padding: 64px 0; }
  .section-sm { padding: 48px 0; }

  /* Header — show hamburger, hide nav text */
  .site-header .inner { gap: 12px; }
  .nav.nav-secondary { display: none; }
  .header-actions .lang-switch-wrap,
  .header-actions .desktop-only { display: none; }
  .mobile-menu-btn { display: inline-grid !important; }

  /* Section head: stack heading + CTA */
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }

  /* Typography softens */
  .display { font-size: clamp(40px, 9vw, 64px); }
  .h1      { font-size: clamp(32px, 6.5vw, 44px); }
  .h2      { font-size: clamp(26px, 5.5vw, 36px); }
}

/* ------------------------------------ PHONE (≤ 600px) */
@media (max-width: 600px) {
  .wrap, .wrap-wide { padding-left: 16px; padding-right: 16px; }

  .section    { padding: 48px 0; }
  .section-sm { padding: 36px 0; }

  /* Buttons & inputs — touch-friendly */
  .btn { height: 46px; padding: 0 18px; }
  .btn-sm { height: 38px; padding: 0 14px; }
  .btn-lg { height: 52px; padding: 0 22px; }
  .input, .select, .search { height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }

  /* Lede smaller */
  .lede { font-size: 16px; }

  /* Hero variants */
  .hero { padding: 32px 0 48px; }
  .hero-inner { min-height: 0 !important; gap: 48px !important; }
  .hero-stack { height: 360px !important; }
  .hero-card { width: 180px !important; }
  .hero-trust { gap: 12px; }
  .hero-partners { margin-top: 32px; }
  .partners-row { gap: 18px 24px; font-size: 14px; }

  /* Landing — programs / journal / voices grids */
  .programs-grid { grid-template-columns: 1fr !important; }
  .voices-grid   { grid-template-columns: 1fr !important; }
  .journal-grid  { grid-template-columns: 1fr !important; }
  .picks-grid    { grid-template-columns: repeat(2, 1fr) !important; gap: 24px 16px !important; }

  /* Catalogue — single column on tiny screens */
  .cat-grid { grid-template-columns: repeat(2, 1fr) !important; column-gap: 14px; row-gap: 32px; }
  .cat-row { grid-template-columns: 80px 1fr !important; gap: 14px; padding: 14px; }
  .cat-row-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--line); }
  .price-lg { font-size: 22px; margin-bottom: 0; text-align: left; }
  .cat-toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar-right { width: 100%; justify-content: space-between; }

  /* Active chips wrap */
  .active-chips { gap: 4px; }

  /* Subscription page */
  .pricing-grid { grid-template-columns: 1fr !important; }
  .pricing-card.is-featured { transform: none !important; }
  .pricing-card { padding: 28px 24px; }
  .price-amt .amt { font-size: 60px; }
  .sub-hero { padding: 48px 0 32px; }
  .sub-hero-orb { max-width: 320px; }
  .sub-hero-orb .floater { font-size: 11px; padding: 6px 10px; }
  .sub-stat-strip { grid-template-columns: 1fr 1fr !important; }
  .sub-stat-strip > div { padding: 18px 14px; }
  .sub-stat-strip .num { font-size: 32px; }
  .sub-final-card { padding: 40px 20px !important; }
  .compare-row { grid-template-columns: 1.2fr 1fr 1fr !important; }
  .compare-row > div { padding: 12px 10px; font-size: 13px; }
  .compare-row.head > div { font-size: 14px; }

  /* Programs page */
  .programs-hero { padding: 48px 0 32px; }
  .programs-hero-illus { display: none; }
  .program-row-card { padding: 28px 22px; min-height: 280px; }
  .program-row-card .modules { gap: 6px; flex-wrap: wrap; }
  .program-row-card .module { font-size: 11px; padding: 8px 10px; }
  .featured-program-card { padding: 28px 20px !important; gap: 28px !important; }
  .day-pills { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .day-pill { font-size: 12px; }
  .inc-line { padding: 22px 20px; flex-direction: column; align-items: flex-start; }
  .inc-line .btn-accent { margin-left: 0; width: 100%; }

  /* Journal */
  .jr-hero-top { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 32px; }
  .jr-feature-img { min-height: 320px; padding: 24px; }
  .jr-feature-img .issue { top: 18px; left: 24px; font-size: 12px; }
  .jr-feature-img .issue-n { font-size: 56px; }
  .jr-feature-img .number-grid .big { font-size: 110px; }
  .jr-feature-text h2 { font-size: 30px; }
  .jr-feature-text .deck { font-size: 16px; }
  .jr-tabs-section { position: static; }
  .jr-tabs-inner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 0; }
  .jr-search { align-self: stretch; justify-content: center; }
  .jr-main { padding: 40px 0; }

  /* Article */
  .article-hero { padding: 24px 0; }
  .article-hero-inner { padding: 0 16px; }
  .article-figure { padding: 0 16px; }
  .article-figure-inner { aspect-ratio: 16/10; border-radius: 14px; }
  .article-grid { padding: 24px 16px; gap: 32px; }
  .article-byline { gap: 12px; }
  .article-byline .actions { margin-left: 0; margin-top: 12px; }
  .article-byline { flex-wrap: wrap; }
  .article-body { font-size: 17px; line-height: 1.65; }
  .article-body .pull { margin: 1.5em 0; padding: 20px 0; }
  .author-card-large { padding: 0 16px; }
  .author-card-large .portrait { width: 100px; height: 100px; margin: 0 auto; }
  .author-card-large h3 { font-size: 26px; }
  .article-progress { top: 56px; }

  /* Gift */
  .gift-hero { padding: 48px 0 24px; }
  .gift-card-3d { max-width: 100%; }
  .gift-card-face { padding: 22px 22px 18px; }
  .gift-card-face .gc-brand { font-size: 20px; }
  .gift-card-face .gc-mid .duration { font-size: 38px; }
  .gift-card-face .gc-bottom .price-tag { font-size: 20px; }
  .gift-card-face .gc-bottom .for .recipient { font-size: 14px; }
  .gift-form, .gift-summary { padding: 24px 20px; }
  .duration-grid { grid-template-columns: 1fr; }
  .delivery-toggle { grid-template-columns: 1fr; }
  .date-row { grid-template-columns: 1fr; }
  .gift-summary { position: static; }
  .gift-summary .total-row .total-amt { font-size: 36px; }
  .for-grid { grid-template-columns: 1fr !important; }

  /* Author page */
  .author-hero-grid { gap: 24px !important; }
  .author-photo-frame { max-width: 220px; }
  .author-stats { gap: 18px; flex-wrap: wrap; }
  .other-authors { grid-template-columns: 1fr 1fr !important; gap: 14px; }
  .oa-portrait { aspect-ratio: 1 / 1; }

  /* Book detail */
  .book-hero-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .book-cover-col { max-width: 220px !important; margin: 0 auto; }
  .book-meta-row { flex-wrap: wrap; gap: 12px; }
  .meta-divider { display: none; }
  .format-toggle { grid-template-columns: 1fr !important; }
  .panel { padding: 24px 18px; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .rating-summary { flex-direction: column; gap: 24px; align-items: flex-start; }
  .player-sheet { width: 100% !important; max-width: 100% !important; max-height: none !important; }
  .player-body { padding: 24px 20px !important; }

  /* Reader */
  .reader-page-body { padding: 24px 18px; }
  .reader-content { font-size: 16px; }
  .reader-h1 { font-size: 32px !important; }
  .drawer { width: 92% !important; max-width: 360px; }
  .reader-header { padding: 8px 12px; gap: 6px; }
  .reader-title { display: none; }

  /* Account */
  .account-hero { padding: 48px 0 24px; }
  .account-hero-grid { gap: 24px !important; }
  .account-stats { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .lib-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; }
  .lib-tabs::-webkit-scrollbar { display: none; }
  .lib-tab { flex-shrink: 0; }
  .lib-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .continue-row { grid-template-columns: 1fr !important; gap: 14px; }
  .continue-card { grid-template-columns: 100px 1fr !important; gap: 16px !important; padding: 14px; }
  .continue-cover { width: 100px; }
  .settings-grid { gap: 14px; }
  .settings-row { padding: 14px 0; flex-wrap: wrap; gap: 10px; }

  /* Cart / checkout */
  .cart-line { grid-template-columns: 80px 1fr !important; gap: 14px !important; padding: 16px; }
  .cart-line-actions { grid-column: 1 / -1; }
  .checkout-progress { gap: 18px; padding: 0 16px; }
  .checkout-step .step-label { display: none; }

  /* Footer */
  .site-footer { padding: 56px 0 32px; margin-top: 64px; }
  .site-footer .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .site-footer .bottom { flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; padding: 24px 16px 0; }

  /* Toast at safe-area */
  .toast-host { bottom: 88px; left: 16px; right: 16px; transform: none; }
  .toast { font-size: 13px; }
}

/* ------------------------------------ TINY (≤ 380px) */
@media (max-width: 380px) {
  .cat-grid { grid-template-columns: 1fr !important; }
  .picks-grid { grid-template-columns: 1fr !important; }
  .lib-grid { grid-template-columns: 1fr !important; }
  .account-stats { grid-template-columns: 1fr !important; }
  .sub-stat-strip { grid-template-columns: 1fr !important; }
  .compare-row { grid-template-columns: 1fr !important; }
  .compare-row > div { border-left: 0; border-top: 1px solid var(--line); text-align: left !important; }
  .compare-row.head { display: none; }

  /* Compress brand wordmark, hide user icon — cart + hamburger remain */
  .site-header .brand span:last-child { display: none; }
  .site-header .header-actions a[aria-label="Compte"],
  .site-header .header-actions a[aria-label="Account"] { display: none; }
}

/* ============================================================
   Mobile menu drawer
   ============================================================ */
.mobile-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.mobile-menu-btn:hover { background: var(--surface); color: var(--ink); }

.mobile-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(27,22,16,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  animation: mobile-fade .25s var(--ease);
}
@keyframes mobile-fade { from { opacity: 0; } to { opacity: 1; } }

.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 86%; max-width: 380px;
  background: var(--bg);
  z-index: 201;
  display: flex; flex-direction: column;
  box-shadow: 0 0 60px rgba(0,0,0,.3);
  animation: mobile-slide .35s var(--ease-out);
}
@keyframes mobile-slide {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.mobile-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.mobile-drawer-nav {
  flex: 1; overflow-y: auto;
  padding: 16px 0;
}
.mobile-drawer-nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  transition: background var(--dur) var(--ease);
}
.mobile-drawer-nav a:hover,
.mobile-drawer-nav a.active {
  background: var(--surface);
  color: var(--ink);
}
.mobile-drawer-nav a.active { color: var(--accent); }
.mobile-drawer-nav a .chev { color: var(--ink-4); }
.mobile-drawer-foot {
  padding: 20px 22px 28px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.mobile-drawer-foot .lang-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-3);
}

/* Force show hamburger only at mobile */
@media (max-width: 900px) {
  .mobile-menu-btn { display: inline-grid; }
}
@media (min-width: 901px) {
  .mobile-drawer-backdrop, .mobile-drawer { display: none !important; }
}

/* ============================================================
   Misc small-screen tweaks
   ============================================================ */
@media (max-width: 600px) {
  /* Player sheet on mobile = full-bleed */
  .player-backdrop { padding: 0 !important; }
  /* Drawer overflow */
  .drawer { width: 92% !important; max-width: 360px; }
  /* Tweaks panel — should not block content */
  .twk-panel { right: 12px !important; bottom: 12px !important; width: calc(100vw - 24px) !important; max-width: 320px; }
}

/* Catalogue header — mobile search row */
.cat-mobile-search { display: none; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
@media (max-width: 900px) {
  .cat-mobile-search { display: block; }
}

/* Hide things only on mobile vs desktop */
@media (max-width: 900px) {
  .desktop-only { display: none !important; }
}

/* Prevent body scroll when drawer open */
body.is-mobile-open { overflow: hidden; touch-action: none; }

/* ============================================================
   Scroll-reveal (used across pages via reveal.js)
   ============================================================ */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 720ms cubic-bezier(.16,1,.3,1),
    transform 720ms cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-on-scroll[data-reveal-delay="1"] { transition-delay: 80ms; }
.reveal-on-scroll[data-reveal-delay="2"] { transition-delay: 160ms; }
.reveal-on-scroll[data-reveal-delay="3"] { transition-delay: 240ms; }
.reveal-on-scroll[data-reveal-delay="4"] { transition-delay: 320ms; }
.reveal-on-scroll[data-reveal-delay="5"] { transition-delay: 400ms; }
.reveal-on-scroll[data-reveal-delay="6"] { transition-delay: 480ms; }

/* Variant: scale-in instead of translateY */
.reveal-on-scroll[data-reveal-kind="scale"] {
  transform: scale(0.96);
}
.reveal-on-scroll[data-reveal-kind="scale"].is-revealed {
  transform: scale(1);
}

/* Variant: subtle slide from left */
.reveal-on-scroll[data-reveal-kind="left"] {
  transform: translateX(-24px);
}
.reveal-on-scroll[data-reveal-kind="left"].is-revealed {
  transform: translateX(0);
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
