/**
 * SEO Landing Page — Responsive Overrides
 * ALL media queries consolidated in one file (per portal-design-guidelines.md §2).
 *
 * Order: mobile → tablet → desktop → large desktop
 *
 * FIXES APPLIED:
 * - Bug1:  .seo-main-content width: 100% on mobile (no calc reduction)
 * - Bug2:  Table breakout uses border-radius: 0 instead of negative margins
 * - Bug3:  Tighter padding on mobile content boxes
 * - Bug5:  Breadcrumb ellipsis on .current only, not flex parent
 * - Bug6:  Sticky CTA text flex-shrink for narrow screens
 */

/* ========================================
   MOBILE (<768px)
   ======================================== */
@media (max-width: 767px) {

  /* --- Layout: FIX(Bug1) full width on mobile --- */
  .seo-main-content {
    width: 100%;
    padding: 1.25rem 0;
    border-radius: 16px 16px 0 0;
  }

  .seo-main-content .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .seo-page-wrapper > .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* --- Hero --- */
  .seo-hero {
    padding: 2.5rem 0 2rem;
  }

  /* FIX(Bug3): Tighter padding on content boxes inside container */
  .seo-hero-intro,
  .seo-section-content,
  .seo-conclusion-text {
    padding: 1rem 0.75rem;
  }

  .seo-quick-stats {
    padding: 0.875rem 1rem;
    gap: 1rem;
  }

  .seo-stat-value {
    font-size: 1.375rem;
  }

  /* --- Podium --- */
  .seo-podium-item {
    padding: 1.25rem 1rem;
  }

  /* --- Stock cards: show/hide toggle --- */
  /* (cards-collapsed rule is in components.css, always active) */

  .seo-card-header {
    flex-wrap: wrap;
  }

  /* --- Section titles --- */
  .seo-section-title {
    font-size: 1.125rem;
  }

  /* --- Mid-CTA --- */
  .seo-mid-cta-inner {
    flex-direction: column;
    padding: 1.25rem;
    gap: 0.75rem;
  }

  .seo-mid-cta-left {
    flex-direction: column;
    gap: 0.75rem;
  }

  .seo-mid-cta-preview {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }

  .seo-mid-cta-icon {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
  }

  .seo-mid-cta-title {
    font-size: 1rem;
  }

  .seo-mid-cta-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .seo-mid-cta-actions .seo-cta-primary {
    text-align: center;
    padding: 0.75rem 1.25rem;
  }

  .seo-mid-cta-sub {
    text-align: center;
  }

  /* --- Action box (conclusion CTA) --- */
  .seo-action-box {
    padding: 1.5rem 1.25rem 1.75rem;
    min-height: auto;
  }

  .seo-action-box .seo-cta-primary,
  .seo-action-box .seo-cta-ghost {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }

  /* --- Unified CTA grid (App + Newsletter) --- */
  .seo-action-grid {
    grid-template-columns: 1fr;
  }

  .seo-action-col--preview {
    padding-top: 1rem;
  }

  .seo-action-preview-img {
    max-width: 320px;
  }

  .seo-action-col--newsletter {
    border-left: none;
    border-top: 1px solid hsla(165 100% 45% / 0.15);
    padding-left: 0;
    padding-top: 1.5rem;
  }

  .seo-action-col .seo-action-title {
    font-size: 1.05rem;
  }

  .seo-action-col .seo-action-list {
    margin-bottom: 1rem;
  }

  .seo-action-col .seo-action-list li {
    font-size: 0.875rem;
    padding: 0.375rem 0;
  }

  .seo-action-col .seo-cta-primary {
    width: 100%;
    text-align: center;
    padding: 0.875rem 1.25rem;
  }

  .seo-action-nl-title {
    font-size: 0.9375rem;
  }

  .seo-action-nl-btn {
    width: 100%;
    text-align: center;
  }

  .seo-action-nl-row {
    flex-direction: column;
  }

  .seo-action-box--nl-only {
    padding: 1.5rem 1.25rem;
  }

  /* --- Inline CTA --- */
  .seo-inline-cta {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }

  /* --- Exit panel: hide (desktop only, no mouse on mobile) --- */
  .seo-exit-panel {
    display: none;
  }

  /* --- Sticky bottom CTA: FIX(Bug6) compact + flex-shrink --- */
  .seo-sticky-cta {
    padding: 0.5rem 0;
  }

  .seo-sticky-cta .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .seo-sticky-cta-text {
    font-size: 0.75rem;
  }

  .seo-sticky-cta .seo-cta-primary {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  .seo-sticky-keywords {
    display: none;
  }

  /* --- Internal links --- */
  .seo-internal-links {
    padding: 1.25rem;
  }

  .seo-internal-links-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* --- FIX(Bug5): Breadcrumb — ellipsis only on .current --- */
  .seo-breadcrumb .current {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  /* --- FIX(Bug2): Comparison table — flush with container, no negative margins --- */
  .seo-table-enhanced-wrapper {
    border-radius: 0;
  }

  .seo-table-enhanced {
    font-size: 0.8125rem;
  }

  .seo-table-enhanced thead th,
  .seo-table-enhanced tbody td {
    padding: 0.625rem 0.5rem;
  }

  .seo-th-name {
    min-width: 140px;
  }

  /* --- Article body: tighter on mobile --- */
  .seo-article-body {
    padding: 1.25rem 1rem;
    font-size: 0.9375rem;
    border-radius: 12px;
  }

  .seo-article-body h2 {
    font-size: 1.25rem;
    margin: 2rem 0 0;
    gap: 0.5rem;
  }

  .seo-article-body h3 {
    font-size: 1.125rem;
    margin: 1.75rem 0 0.625rem;
  }

  .seo-article-body h4 {
    font-size: 1rem;
  }

  .seo-article-body ul,
  .seo-article-body ol {
    padding-left: 1.25rem;
  }

  .seo-article-body blockquote {
    padding: 0.875rem 1rem;
    margin: 1rem 0;
  }

  .seo-article-body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.875rem;
  }

  .seo-article-body th,
  .seo-article-body td {
    padding: 0.625rem 0.75rem;
    white-space: nowrap;
  }

  /* Article TOC: single column on mobile */
  .seo-article-toc {
    padding: 1rem;
  }

  .seo-article-toc ol {
    columns: 1;
  }

  .seo-article-toc a {
    font-size: 0.8125rem;
  }

  /* Article hero */
  .seo-hero--article {
    padding: 1.75rem 0 1.25rem;
  }

  .seo-hero--article .seo-hero-title {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .seo-article-hero-desc {
    font-size: 0.9375rem;
    line-height: 1.55;
  }

  /* Disclaimer */
  .seo-main-column p.investment-disclaimer {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
}

/* ========================================
   TABLET (768px+)
   ======================================== */
@media (min-width: 768px) {
  .seo-hero-title {
    font-size: 2.25rem;
  }

  .seo-hero--has-image {
    min-height: 420px;
  }

  .seo-hero-kpi-bar {
    gap: 0.5rem 1rem;
  }

  .seo-kpi-value {
    font-size: 1.25rem;
  }

  .seo-podium-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 1.5rem;
    max-width: 100%;
    padding: 0;
  }

  .seo-podium-gold {
    order: 2;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    transform: scale(1.05);
    z-index: 1;
  }

  .seo-podium-silver {
    order: 1;
  }

  .seo-podium-bronze {
    order: 3;
  }

  .seo-stock-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .seo-news-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .seo-links-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .seo-mobile-toggle {
    display: none;
  }

  .seo-cards-collapsed .seo-stock-card:nth-child(n + 4) {
    display: block;
  }

  /* Index page hero: 2-column */
  .seo-index-hero-content {
    grid-template-columns: 1fr 280px;
    gap: 3rem;
    align-items: center;
  }

  .seo-index-hero-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }

  .seo-index-cta-box {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 3rem;
  }

  .seo-index-cta-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  /* Editorial duo grid */
  .seo-ed-duo-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Article grid */
  .seo-article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   DESKTOP (992px+)
   ======================================== */
@media (min-width: 992px) {
  .seo-hero-title {
    font-size: 2.75rem;
  }

  .seo-hero--has-image {
    min-height: 480px;
  }

  .seo-hero--has-image .seo-hero-title {
    font-size: 3.25rem;
    max-width: 860px;
  }

  .seo-hero-kpi-bar {
    gap: 0.5rem 1.25rem;
  }

  .seo-kpi-value {
    font-size: 1.375rem;
  }

  .seo-podium-grid {
    gap: 2rem;
    padding: 0 1.5rem;
  }

  .seo-stock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .seo-news-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hero intro grid: metrics sidebar left, text right */
  .seo-hero-intro-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
    align-items: start;
  }

  .seo-hero-sidebar {
    grid-column: 1;
    grid-row: 1;
  }

  .seo-hero-intro-content {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .seo-hero-sidebar .seo-quick-stats {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    width: 100%;
  }

  .seo-hero-sidebar .seo-quick-stats .seo-stat + .seo-stat {
    padding-left: 0;
    border-left: none;
    padding-top: 0.75rem;
    border-top: 1px solid hsla(0 0% 100% / 0.1);
  }

  .seo-hero-sidebar .seo-quick-stats .seo-stat-value {
    font-size: 1.375rem;
  }

  .seo-hero-toc {
    display: block;
    padding: 1rem;
    background: var(--seo-bg-card);
    border: 1px solid var(--seo-border);
    border-radius: var(--seo-radius);
  }

  .seo-hero-toc .seo-toc-title {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--seo-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
  }

  .seo-hero-toc .seo-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .seo-hero-toc .seo-toc-list li {
    margin-bottom: 0.375rem;
  }

  .seo-hero-toc .seo-toc-list a {
    color: var(--seo-text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    display: block;
    padding: 0.375rem 0;
    padding-left: 0.75rem;
    border-left: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
  }

  .seo-hero-toc .seo-toc-list a:hover,
  .seo-hero-toc .seo-toc-list a.active {
    color: var(--seo-accent);
    border-left-color: var(--seo-accent);
  }

  .seo-main-content {
    display: block;
  }

  .seo-toc {
    display: none;
  }

  /* Index page hero wider */
  .seo-index-hero-content {
    grid-template-columns: 1fr 320px;
    gap: 4rem;
  }

  /* Editorial tri grid */
  .seo-ed-tri-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Article grid */
  .seo-article-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   LARGE DESKTOP (1200px+)
   ======================================== */
@media (min-width: 1200px) {
  .seo-podium-grid {
    gap: 2.5rem;
    padding: 0 3rem;
  }

  /* Two-column layout: main + promotional sidebar */
  .seo-content-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
  }

  .seo-content-layout .seo-main-column {
    flex: 1;
    min-width: 0;
  }

  .seo-promo-sidebar {
    display: block;
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 140px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    margin-top: 2rem;
  }
}

/* ========================================
   SMALL BREAKPOINT (480px+)
   ======================================== */
@media (min-width: 480px) {
  .seo-index-cta-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ========================================
   SMALL-TABLET (576px+)
   ======================================== */
@media (min-width: 576px) {
  .seo-ed-tri-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   Correlation table sticky first column
   ======================================== */
.seo-corr-row-label {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.seo-corr-cell {
  font-size: 0.75rem;
  font-weight: 500;
  min-width: 3.5rem;
  transition: background 0.15s;
}

/* Must beat .seo-main-column .seo-table tbody td { background: #fff } */
.seo-main-column .seo-correlation-table tbody td.seo-corr-self {
  background: #f3f4f6;
  color: #9ca3af;
}

.seo-main-column .seo-correlation-table tbody td.seo-corr-high {
  background: #fee2e2;
  color: #991b1b;
}

.seo-main-column .seo-correlation-table tbody td.seo-corr-mid {
  background: #fef3c7;
  color: #92400e;
}

.seo-main-column .seo-correlation-table tbody td.seo-corr-low {
  background: #d1fae5;
  color: #065f46;
}
