/* ── THE POLYGLOT DBA — RESPONSIVE STYLES ── */

*, *::before, *::after {
  box-sizing: border-box !important;
}



/* ═══════════════════════════════════════════
   GLOBAL OVERFLOW FIX
═══════════════════════════════════════════ */
html, body {
  max-width: 100% !important;
  overflow-x: clip !important;
}

/* ═══════════════════════════════════════════
   CODE BAR — wrap SQL for all viewports < 2000px
═══════════════════════════════════════════ */
@media (max-width: 1999px) {
  .code-bar {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    height: auto !important;
    min-height: 52px !important;
    padding: 10px 48px 14px !important;
    justify-content: unset !important;
  }
  .code-prompt { position: absolute !important; left: 48px !important; top: 10px !important; }
  .code-status  { position: absolute !important; right: 48px !important; top: 10px !important; }
  .code-text {
    display: table !important;
    margin: 26px auto 0 !important;
    white-space: pre-wrap !important;
    font-size: 11px !important;
    text-align: left !important;
    line-height: 1.8 !important;
  }
}

/* ═══════════════════════════════════════════
   WIDE-TABLET / SMALL-LAPTOP  (≤ 1200px)
   Keeps desktop two-column layout but removes
   the 88vh min-height and fixes illustration.
═══════════════════════════════════════════ */
@media (max-width: 1200px) {
  .hero {
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
    min-height: auto !important;
    padding: 60px 48px !important;
  }
  .hero-illus {
    min-width: 0 !important;
    overflow: hidden !important;
    align-items: flex-end !important;
  }

  .hero-char-img {
    height: 440px !important;
    width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center bottom !important;
  }
}

/* ═══════════════════════════════════════════
   TABLET  (≤ 900px)
═══════════════════════════════════════════ */
@media (max-width: 900px) {

  /* Nav */
  nav { padding: 0 24px !important; }

  /* Homepage hero */
  .hero {
    grid-template-columns: 1fr !important;
    min-height: auto !important;
    padding: 48px 24px 40px !important;
    gap: 40px !important;
    text-align: center !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  .hero-left {
    min-width: 0 !important;
    overflow: hidden !important;
    max-width: 100% !important;
  }
  /* Show illustration but smaller */
  .hero-illus { display: flex !important; justify-content: center !important; min-width: 0 !important; overflow: hidden !important; }
  .hero-char-img { width: 100% !important; height: auto !important; max-height: 280px !important; object-fit: contain !important; object-position: center bottom !important; }
  .hero-code-card { display: none !important; }
  .hero-code-wrap { display: none !important; }
  .hero-actions { justify-content: center !important; }
  .hero-stats { justify-content: center !important; gap: 32px !important; }
  .hero-sub { white-space: normal !important; font-size: 16px !important; }
  .hero-badge {
    margin-left: auto !important;
    margin-right: auto !important;
    white-space: normal !important;
    text-align: center !important;
    max-width: 100% !important;
  }

  /* Article grids */
  .featured-grid { grid-template-columns: 1fr !important; }
  .post-card.featured { grid-row: auto !important; }
  .latest-grid { grid-template-columns: 1fr 1fr !important; }

  /* Topics */
  .topics-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Section spacing */
  .section-wrap { padding: 0 24px !important; }

  /* Footer */
  .footer-inner {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px !important;
    padding: 40px 24px 24px !important;
  }
  .footer-brand { grid-column: 1 / -1 !important; }

  /* About hero — keep two columns on tablet, shrink card column */
  .about-hero {
    grid-template-columns: 1fr 300px !important;
    gap: 32px !important;
    padding: 48px 0 40px !important;
  }
}

/* ═══════════════════════════════════════════
   MOBILE  (≤ 600px)
═══════════════════════════════════════════ */
@media (max-width: 600px) {

  /* Nav */
  nav { padding: 0 16px !important; display: flex !important; justify-content: space-between !important; align-items: center !important; }
  .nav-logo-text { font-size: 16px !important; white-space: nowrap !important; }
  .nav-logo { flex-shrink: 0 !important; }
  .btn-subscribe { padding: 7px 12px !important; font-size: 12px !important; }

  /* Hero */
  .hero { padding: 32px 16px 28px !important; gap: 28px !important; overflow: hidden !important; }
  .hero-left { min-width: 0 !important; overflow: hidden !important; max-width: 100% !important; }
  .hero h1 { font-size: 32px !important; margin-bottom: 20px !important; word-break: break-word !important; }
  .hero-sub { font-size: 15px !important; margin-bottom: 32px !important; white-space: normal !important; }

  /* Badge — allow wrapping and clip to viewport */
  .hero-badge {
    white-space: normal !important;
    max-width: calc(100vw - 32px) !important;
    text-align: center !important;
    line-height: 1.6 !important;
    letter-spacing: 0.02em !important;
  }

  /* Stats — tighter, clipped labels */
  .hero-stats { gap: 12px !important; flex-wrap: nowrap !important; width: 100% !important; justify-content: space-around !important; }
  .stat { flex: 1 !important; min-width: 0 !important; }
  .stat-num { font-size: 22px !important; }
  .stat-label { font-size: 10px !important; white-space: normal !important; line-height: 1.3 !important; }

  .hero-actions { gap: 10px !important; }
  .btn-primary, .btn-ghost { font-size: 13px !important; padding: 10px 18px !important; }

  /* Section */
  .section-wrap { padding: 0 16px !important; }

  /* Section header */
  .section-title { font-size: 18px !important; }

  /* Article grids */
  .latest-grid { grid-template-columns: 1fr !important; }
  .featured-grid { grid-template-columns: 1fr !important; }
  .topics-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }

  /* Topic cards */
  .topic-card { padding: 16px !important; }
  .topic-icon { font-size: 22px !important; }
  .topic-name { font-size: 13px !important; }

  /* Newsletter (shared component) */
  #newsletter { padding: 48px 16px !important; }
  .newsletter { padding: 36px 24px !important; }
  .newsletter h2 { font-size: 24px !important; }
  .newsletter-form { flex-direction: column !important; }
  .newsletter-form button { width: 100% !important; }

  /* Footer */
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 32px 16px 20px !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    gap: 12px !important;
    text-align: center !important;
    padding: 16px !important;
  }

  /* About */
  .about-hero {
    grid-template-columns: 1fr !important;
    padding: 32px 0 24px !important;
    gap: 32px !important;
  }
  .about-stats { justify-content: center !important; }
  .about-eyebrow { font-size: 11px !important; }
  .about-title { font-size: 32px !important; }
  .about-role { font-size: 13px !important; }
  .about-bio p { font-size: 15px !important; }

  /* Article page */
  .article-wrap { padding: 32px 16px 48px !important; }
  .article-header { padding: 32px 16px 24px !important; }

  /* Categories/filter pills — scrollable row on mobile */
  .categories {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
    padding-bottom: 8px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .categories::-webkit-scrollbar { display: none !important; }
  .cat-pill { white-space: nowrap !important; flex-shrink: 0 !important; }

  /* Section divider spacing */
  #section-divider { margin: 40px 0 40px !important; }

  /* Code bar — prompt top-left, results top-right, SQL centered below */
  .code-bar {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    height: auto !important;
    min-height: 52px !important;
    padding: 10px 16px 14px !important;
    overflow: hidden !important;
    justify-content: unset !important;
  }
  .code-prompt {
    position: absolute !important;
    left: 16px !important;
    top: 10px !important;
  }
  .code-status {
    position: absolute !important;
    right: 16px !important;
    top: 10px !important;
  }
  .code-text {
    display: table !important;
    margin: 26px auto 0 !important;
    white-space: pre-wrap !important;
    font-size: 11px !important;
    text-align: left !important;
    line-height: 1.8 !important;
  }
}

/* ── FORCE NAV-LINKS VISIBLE ABOVE HAMBURGER BREAKPOINT ── */
/* Overrides the inline max-width:900px rules in each page's <style> block */
@media (min-width: 701px) {
  .nav-links { display: flex !important; }
}

/* ── SEARCH BAR (below pills, all viewports) ── */
.mobile-search-bar {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 16px 0 24px !important;
  padding: 0 14px !important;
  height: 42px;
  background: var(--bg2, #0d0d1a);
  border: 1px solid var(--border, rgba(255,255,255,0.07));
  border-radius: 10px;
  transition: border-color 0.2s;
}
.mobile-search-bar:focus-within { border-color: var(--border-hi, rgba(0,210,255,0.3)) !important; }
.mobile-search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text, #e2e8f0);
  font: inherit;
  font-size: 14px;
  width: 100%;
}
.mobile-search-bar input::placeholder { color: var(--muted, #64748b); }
[data-theme="light"] .mobile-search-bar { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.12); }

/* ═══════════════════════════════════════════
   HAMBURGER MENU
═══════════════════════════════════════════ */

/* Hide hamburger and mobile menu on desktop */
.hamburger { display: none !important; }
.mobile-menu { display: none !important; }

@media (max-width: 700px) {
  /* At phone/small-tablet widths, hide nav links and show hamburger */
  .nav-links { display: none !important; }
  .nav-right { margin-left: auto !important; gap: 10px !important; }

  .hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  .hamburger span {
    display: block;
    height: 2px;
    width: 22px;
    background: var(--text, #e2e8f0);
    border-radius: 2px;
    transition: all 0.2s;
  }

  /* Mobile menu overlay + panel */
  .mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
  }
  .mobile-menu { display: none; }
  .mobile-menu.open { display: block !important; }

  .mobile-menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
  }

  .mobile-menu-panel {
    position: absolute;
    top: 0; right: 0;
    width: 260px;
    height: 100%;
    background: var(--bg2, #0d0d1a);
    border-left: 1px solid rgba(0,210,255,0.15);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .mobile-menu-close {
    align-self: flex-end;
    background: none;
    border: none;
    color: var(--muted, #94a3b8);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    margin-bottom: 36px;
    line-height: 1;
  }
  .mobile-menu-close:hover { color: var(--cyan, #00d2ff); }

  .mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .mobile-nav-links a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent;
    color: var(--muted2, #94a3b8);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
  }
  .mobile-nav-links a:hover {
    color: var(--cyan, #00d2ff);
    border-color: rgba(0,210,255,0.4);
    background: rgba(0,210,255,0.06);
  }
  .mobile-nav-links a.active {
    color: var(--cyan, #00d2ff);
    border-color: rgba(0,210,255,0.5);
    background: rgba(0,210,255,0.08);
  }
}
