/* ══════════════════════════════════════════════════════════════
   Nationalism News — Mobile-First Responsive CSS
   Targets ACTUAL homepage class names used in HTML
   Breakpoints: 375 | 480 | 600 | 768 | 900 | 1024 | 1200
   Load order: after toi.css, homepage.css, ads.css
   ══════════════════════════════════════════════════════════════ */

/* ── 1. Global Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
  display: block;
}

a { touch-action: manipulation; }

/* ── 2. Container ──────────────────────────────────────────── */
.container {
  width: 100%;
  padding-left: 12px;
  padding-right: 12px;
  margin-left: auto;
  margin-right: auto;
}

/* ── 3. Typography — fluid scaling ────────────────────────── */
h1 { font-size: clamp(20px, 5.5vw, 36px); line-height: 1.25; }
h2 { font-size: clamp(17px, 4.5vw, 28px); line-height: 1.3;  }
h3 { font-size: clamp(15px, 3.8vw, 22px); line-height: 1.35; }
p  { font-size: clamp(14px, 3.5vw, 16px); line-height: 1.65; }

/* ── 4. Navigation — sticky, touch-friendly ────────────────── */
.toi-nav { position: sticky; top: 0; z-index: 1000; }

/* Nav category links: horizontal scroll, no wrap */
.toi-nav-list {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
  display: flex;
}
.toi-nav-list::-webkit-scrollbar { display: none; }

/* Touch targets: min 44×44px */
.toi-nav-link,
.mob-nav-link,
.btn,
button,
[role="button"] {
  min-height: 44px;
  min-width: 44px;
}

/* ── 5. Homepage 3-column layout (hp-3col) ─────────────────── */
/* hp-3col already collapses to 1fr at ≤900px via homepage.css */
/* Ensure left and right columns stack below main on mobile */
.hp-3col {
  align-items: start;
}
.hp-right {
  align-self: start;
}

/* ── 6. Section 3-column layout (sec-3col) ─────────────────── */
/* Already collapses at ≤768px via homepage.css */
/* Ensure right sidebar doesn't create empty space */
.sec-3col {
  align-items: start;
}
.sec-right-col {
  align-self: start;
}

/* ── 7. Homepage featured articles (ac-layout) ─────────────── */
/* 2-col grid — already collapses at ≤900px to 1col via homepage.css */
.ac-layout {
  align-items: start;
}

/* ── 8. Six-grid & Trending-grid cards — mobile horizontal ─── */
/* On mobile (≤600px), six-grid collapses to 1 column.
   Cards flip to horizontal: text left, image right. */
.six-grid,
.trending-grid {
  /* Ensure proper wrapping on all screens */
  width: 100%;
}

/* ── 9. Article Cards (art-layout) — actual class names ─────── */
.art-layout {
  display: block;
  width: 100%;
}

.art-body,
.article-body {
  width: 100%;
  max-width: 100%;
  padding: 0 4px;
}

.art-para {
  font-size: clamp(15px, 3.8vw, 17px);
  line-height: 1.75;
  margin-bottom: 18px;
}

.art-headline,
.article-headline,
.article-title {
  font-size: clamp(20px, 5.5vw, 32px);
  line-height: 1.25;
}

/* ── 10. Sidebar — stacks below on mobile ─────────────────── */
.hp-right,
.sec-right-col,
.art-sidebar,
.right-col,
.sidebar {
  width: 100%;
  margin-top: 24px;
}

/* ── 11. Horizontal scroll sections (mobile swipe) ─────────── */
.cat-tabs,
.tab-row,
.tag-row,
.toi-nav-list {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
  display: flex;
}
.cat-tabs::-webkit-scrollbar,
.tab-row::-webkit-scrollbar,
.toi-nav-list::-webkit-scrollbar { display: none; }

/* ── 12. Images ─────────────────────────────────────────────── */
.hero-img,
.art-hero,
.top-img,
.card-img,
.sec-big-img {
  width: 100%;
  overflow: hidden;
}

.hero-img img,
.art-hero img,
.sec-big-img img {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* ── 13. Ads — responsive containment ─────────────────────── */
.ad-728x90,
.ad-970x250 {
  overflow: hidden;
}

/* ── 14. Footer ────────────────────────────────────────────── */
.toi-footer,
.site-footer,
.footer-bottom {
  padding-bottom: 60px; /* space for fixed mobile ad */
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS — using actual homepage class names
   ══════════════════════════════════════════════════════════════ */

/* ── Mobile S: 375px ───────────────────────────────────────── */
@media (min-width: 375px) {
  .container { padding-left: 14px; padding-right: 14px; }
}

/* ── Mobile L: 480px ───────────────────────────────────────── */
@media (min-width: 480px) {
  .container { padding-left: 16px; padding-right: 16px; }
}

/* ── Tablet S: 600px ───────────────────────────────────────── */
@media (min-width: 600px) {
  /* At 600px+, six-card can revert back to vertical card */
  .six-card {
    display: block;
  }
  .six-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    order: 0;
  }
  .six-body {
    order: 0;
  }
}

/* ── Tablet L / iPad: 768px ────────────────────────────────── */
@media (min-width: 768px) {
  .container { max-width: 980px; }

  /* Article page layout: main + sidebar */
  .art-layout,
  .article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
  }

  .hp-right,
  .sec-right-col,
  .art-sidebar,
  .right-col,
  .sidebar {
    width: 300px;
    margin-top: 0;
    position: sticky;
    top: 70px;
    align-self: start;
  }

  .ad-728x90 { display: block; }
}

/* ── Laptop / small desktop: 900px ────────────────────────── */
@media (min-width: 900px) {
  .container { max-width: 1100px; }

  .art-layout,
  .article-layout {
    grid-template-columns: 1fr 320px;
    gap: 32px;
  }
}

/* ── Desktop / MacBook / iMac: 1024px ─────────────────────── */
@media (min-width: 1024px) {
  .container { max-width: 1240px; }

  .art-layout,
  .article-layout {
    grid-template-columns: 1fr 340px;
    gap: 40px;
  }

  .ad-970x250 { display: block; }
}

/* ── Large desktop / iMac 27": 1200px ─────────────────────── */
@media (min-width: 1200px) {
  .container { max-width: 1280px; }
}

/* ══════════════════════════════════════════════════════════════
   PHONE-SPECIFIC OVERRIDES (max-width queries)
   These override homepage.css where needed for phone screens
   ══════════════════════════════════════════════════════════════ */

/* All phones ≤768px */
@media (max-width: 768px) {

  /* Utility bar — compact on mobile */
  .util-bar { padding: 3px 0; font-size: 10px; }
  .util-right { gap: 4px; }

  /* Section blocks — full width */
  .sec-block { padding: 10px 0; }

  /* HP right column — hide on mobile to avoid blank space */
  .hp-right { display: none; }

  /* Masthead */
  .masthead { padding: 10px 0; }
  .masthead-title { font-size: clamp(20px, 5vw, 28px); }

  /* Footer extra bottom padding for sticky ad */
  .footer-bottom { padding-bottom: 60px; }
}

/* Small phones ≤600px */
@media (max-width: 600px) {
  .container { padding-left: 10px; padding-right: 10px; }

  /* Six-grid single column — horizontal card layout */
  .six-grid,
  .trending-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  /* Six card: horizontal layout (text left, image right) */
  .six-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    background: #fff;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    overflow: visible;
  }
  .six-img {
    width: 100px !important;
    height: 70px !important;
    aspect-ratio: unset !important;
    object-fit: cover;
    flex-shrink: 0;
    order: 2;
    border-radius: 2px;
  }
  .six-body {
    flex: 1 !important;
    order: 1;
    padding: 0 !important;
  }
  .six-card-title,
  .six-title {
    font-size: 13px !important;
    line-height: 1.4;
    -webkit-line-clamp: 3;
    margin-top: 0;
  }
  .six-cat,
  .six-meta {
    font-size: 10px;
  }

  /* Trending card: already horizontal, just ensure spacing */
  .trend-card {
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    border-radius: 0;
    background: transparent;
  }
  .trend-num { font-size: 20px; }

  /* sec-3col already single column — improve card appearance */
  .sec-3col { gap: 10px; }
  .sec-big-img img { aspect-ratio: 16/9; height: auto; }

  /* Opinion cards — stack vertically */
  .opinion-3 { gap: 8px; }

  /* Navigation links — smaller on very small screens */
  .toi-nav-link { font-size: 11px; padding: 10px 7px; }
  .toi-nav-inner { padding: 0 10px; }

  /* Videos section */
  .videos-grid { grid-template-columns: 1fr !important; }

  /* Promo sections */
  .promo-3 { grid-template-columns: 1fr !important; }

  /* Section header */
  .sec-title { font-size: 15px; }
}

/* Very small phones ≤480px */
@media (max-width: 480px) {
  /* Ensure six-grid/trending-grid remain single column */
  .six-grid,
  .trending-grid {
    grid-template-columns: 1fr !important;
  }

  /* Hide util bar social icons to save space */
  .util-socials { display: none; }
  .util-edition { display: none; }

  /* Smaller epaper/subscribe buttons */
  .btn-epaper,
  .btn-sub-util { font-size: 10px; padding: 6px 8px; }

  /* Rashi grid — 2 cols is OK for horoscope at 480px */
  .rashi-grid { grid-template-columns: repeat(2, 1fr); }

  /* Article image in list view */
  .art-img { width: 90px; height: 64px; }

  /* Footer */
  .footer-top { flex-direction: column; padding: 20px 12px 12px; }
  .footer-brand { flex: 0 0 100%; margin-bottom: 12px; }
  .footer-grid { grid-template-columns: 1fr !important; }
}

/* Tiny phones ≤375px */
@media (max-width: 375px) {
  /* Keep six-grid single column */
  .six-grid { grid-template-columns: 1fr !important; }

  /* Nav — very compact */
  .toi-nav-link { font-size: 10px; padding: 10px 5px; }
  .btn-epaper, .btn-sub-util { display: none; }

  /* Six card image slightly smaller */
  .six-img { width: 80px !important; height: 60px !important; }
}

/* ══════════════════════════════════════════════════════════════
   DEVICE-SPECIFIC FIXES
   ══════════════════════════════════════════════════════════════ */

/* iOS Safari — prevent font size inflation */
@supports (-webkit-touch-callout: none) {
  body { -webkit-text-size-adjust: none; }
  input, select, textarea { font-size: 16px; } /* prevent zoom on focus */
}

/* Android Chrome — smooth momentum scroll */
@media (hover: none) and (pointer: coarse) {
  .cat-tabs,
  .tab-row,
  .toi-nav-list { -webkit-overflow-scrolling: touch; }
}

/* High-DPI / Retina screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  img { image-rendering: -webkit-optimize-contrast; }
}

/* Print */
@media print {
  .toi-nav, .ad-320x50, .ad-728x90, .ad-970x250,
  .ad-300x250, .ad-300x600, .sidebar-ad { display: none !important; }
  body { padding: 0; font-size: 12pt; }
  a { text-decoration: underline; color: #000; }
}
