/* ==========================================================================
   hi INDiA ePaper – responsive overrides
   ≥1600  large desktop (1920)
   ≤1199  laptop
   ≤1023  tablet  – secondary tools move into the dock's "more" menu
   ≤767   mobile  – compact header, icon-only controls, no side arrows
   ≤400   small phones
   ========================================================================== */

/* ---------- Large desktop ---------- */
@media (min-width: 1600px) {
  .topbar { padding: 0 28px; }
  .section-bar { padding-left: 16px; }
  .search input { width: 220px; }
  .thumb { width: 116px; }
}

/* ---------- Laptop ---------- */
@media (max-width: 1199px) {
  .site-link { display: none; }
  .search input { width: 150px; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1023px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .brand-logo img { height: 40px; }

  .paper-wrap { --side-pad: 60px; }
  .nav-arrow { width: 42px; height: 42px; margin-top: -21px; }
  .nav-prev { left: 10px; }
  .nav-next { right: 20px; }

  /* Secondary tools collapse into a menu that opens above the dock */
  .more-btn { display: inline-flex; }
  .dock-divider-more { display: none; }
  .dock-more {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: none;
    flex-direction: column;
    align-items: stretch;
    min-width: 210px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
  }
  .dock-more.is-open { display: flex; animation: pop-in .16s var(--ease); }
  .dock-more .icon-btn {
    justify-content: flex-start;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
  }
  .dock-more .icon-btn[hidden] { display: none; }
  .dock-more .menu-label { display: inline; }
  .dock-more [data-tip]::after { display: none; }
  .more-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
  body { font-size: 14px; }

  .topbar { gap: 8px; height: 56px; padding: 0 12px; }
  .brand-logo img { height: 32px; }
  .header-actions { gap: 4px; }

  .date-btn { height: 40px; gap: 6px; padding: 0 9px; }
  .date-btn .icon:first-child { width: 18px; height: 18px; }
  .date-btn-kicker { display: none; }
  .date-btn .caret { display: none; }
  #dateBtnLabel { font-size: 13.5px; }

  /* Search collapses to an icon and expands over the top bar */
  .search {
    height: 40px;
    padding-left: 0;
    border-color: transparent;
    background: transparent;
    transition: none;
  }
  .search input { width: 0; padding: 0; }
  .search.is-open {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    z-index: 5;
    padding-left: 14px;
    border-color: var(--brand);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }
  .search.is-open input { flex: 1; width: auto; }

  .calendar {
    position: fixed;
    top: auto;
    left: 50%;
    right: auto;
    width: min(340px, calc(100vw - 24px));
    transform: translateX(-50%);
    animation: none;
  }

  .section-bar { height: 44px; padding-left: 0; }
  .tabs-arrow { display: none; }
  .tab { padding: 0 10px; font-size: 13.5px; }
  .pages-toggle { padding: 0 14px; }
  .pages-toggle span { display: none; }
  .thumb-list { gap: 10px; padding: 12px; }
  .thumb { width: 76px; }
  .thumb-title { display: none; }

  /* Paper uses (almost) the full width; swipe or use the dock to turn pages */
  .paper-wrap { --side-pad: 8px; padding-top: 8px; padding-bottom: 84px; }
  .nav-arrow { display: none; }

  .dock { bottom: 12px; gap: 2px; padding: 4px; border-radius: 12px; }
  .dock .icon-btn { width: 36px; height: 36px; }
  .dock .dock-more .icon-btn { width: 100%; height: 42px; }
  .dock-divider { margin: 0 2px; }
  .page-select select { max-width: 64px; height: 32px; padding: 0 4px; font-size: 13px; }
  .page-total { font-size: 13px; }

  .share-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  .viewer-hint { bottom: 70px; font-size: 12px; }
  .viewer-empty h2 { font-size: 20px; }

  .article-bar { gap: 6px; height: 52px; padding: 0 8px; }
  .article-back span { display: none; }
  .article-back { width: 38px; padding: 0; }
  .article-scroll { padding: 12px 8px 32px; }
  .article-card { padding: 18px 14px 20px; border-radius: 10px; }
  .article-title { font-size: 22px; }
  .article-deck { font-size: 17px; }
  .article-body { font-size: 17.5px; line-height: 1.65; margin: 16px 0 22px; padding-top: 16px; }
  .article-clip { margin: 14px -6px 18px; padding: 4px; }
  .article-actions .btn { flex: 1 1 100%; }

  .footer-inner { flex-direction: column; text-align: center; padding: 16px 12px 20px; }
  .footer-links { justify-content: center; gap: 6px 14px; }
}

/* ---------- Small phones ---------- */
@media (max-width: 400px) {
  .topbar { padding: 0 10px; }
  .brand-logo img { height: 28px; }
  .zoom-level { display: none; }
}

/* ---------- Short landscape screens (phones turned sideways) ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  .topbar { height: 50px; }
  .brand-logo img { height: 30px; }
  .date-btn, .search, .site-link { height: 38px; }
  .date-btn-kicker { display: none; }
  .section-bar { height: 40px; }
  .reader { min-height: 0; }
  .dock { bottom: 8px; }
}
