/* responsive.css — phone / tablet improvements + light-mode fixes (loaded after theme.css) */

/* ── Detail page: single compact column (no sidebar, no duplicated info) ── */
.detail-single { display: flex; flex-direction: column; gap: var(--sp-4); }
.detail-single .detail-card { margin-bottom: 0; }
.detail-hero { padding-bottom: var(--sp-6); }
.detail-hero .detail-name { margin-bottom: 4px; }
.detail-hero .detail-desc { margin-top: 8px; max-width: 760px; }
.detail-hero .detail-actions { margin-top: var(--sp-4); }
.detail-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); align-items: center; }
.fact-license { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; padding: 3px 9px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.fact-tag { font-size: .75rem; color: var(--text-dim); padding: 3px 4px; }
.deploy-inline { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.deploy-label { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.esn-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--border); border-radius: var(--r-md); font-size: .875rem; color: var(--text-muted); }
.esn-empty-alt { margin-left: auto; font-size: .8125rem; color: var(--text-dim); }
@media (min-width: 769px) { .detail-single .features-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) { .esn-empty-alt { margin-left: 0; } .detail-hero { padding-bottom: var(--sp-4); } }

/* FIX: filter backdrop was always visible on mobile (blurred full-screen overlay) */
.filter-backdrop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
@media (max-width: 900px) {
  .filter-backdrop, .filter-drawer { display: none; }
  body.filters-open .filter-backdrop { display: block; }
  body.filters-open .filter-drawer { display: block; }
}
/* Header solid on phones (backdrop blur looks smeared and is slow on mobile GPUs) */
@media (max-width: 768px) {
  .site-header { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: var(--bg); }
}

html, body { overflow-x: hidden; }
img, svg, video { max-width: 100%; }
.site-header { position: sticky; top: 0; z-index: 50; }

/* Light mode: hero title gradient was white → invisible */
html.theme-light .hero h1 {
  background: linear-gradient(135deg, #1e293b 0%, #1d4ed8 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* Keyboard focus on clickable cards */
.software-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* No sticky hover lift on touch devices */
@media (hover: none) {
  .software-card:hover { transform: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ── Tablet ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ── Phone ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex !important; width: 44px; height: 44px; }

  /* Nav becomes a dropdown panel */
  .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 12px 16px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  html.nav-open .site-nav { display: flex; }
  .site-nav .nav-link,
  .site-nav .nav-link:not(.nav-cta):not(:last-child) {
    display: block !important; padding: 12px 14px; font-size: 1rem; min-height: 44px;
  }
  .site-nav .nav-cta { text-align: center; }
  .site-nav .theme-toggle-btn { width: 100%; height: 44px; gap: 8px; }

  .header-inner { position: relative; }
  .logo-text { font-size: 1rem; }

  /* Hero */
  .hero h1 { font-size: clamp(1.6rem, 8vw, 2.2rem); }
  .hero-sub { font-size: .95rem; }

  /* Inputs: 16px stops iOS zoom-on-focus */
  input, select, textarea { font-size: 16px !important; }
  .search-wrap input, #search-input { min-height: 48px; }

  /* Category pills: single swipeable row */
  .cat-pills {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
    padding: 4px 16px 10px; margin: 0 -16px; scrollbar-width: none;
  }
  .cat-pills::-webkit-scrollbar { display: none; }
  .cat-pill { flex: 0 0 auto; scroll-snap-align: start; min-height: 40px; white-space: nowrap; }

  /* Cards */
  .software-card { padding: var(--sp-4); }
  .card-footer-actions { flex-wrap: wrap; gap: 10px; }
  .card-btn-detail, .card-ext-btn { min-height: 40px; display: inline-flex; align-items: center; }
  .card-ext-btn { padding: 6px 12px; }
  .badge[data-tip]::after { display: none; }  /* tooltips can't hover on touch */

  /* Filter button / drawer */
  .filter-toggle-btn { min-height: 44px; padding: 0 16px; }
  .filter-drawer { width: min(88vw, 340px); }
  .filter-drawer label, .filter-drawer .filter-option { min-height: 44px; }

  /* Detail page */
  .detail-hero { padding-top: var(--sp-6); }
  .detail-actions .btn-primary, .detail-actions .btn-secondary { width: 100%; min-height: 48px; }
  .features-grid { grid-template-columns: 1fr; }
  .meta-row { flex-direction: column; gap: 2px; }

  /* Footer */
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .footer-legal { justify-content: center; flex-wrap: wrap; }

  /* Sponsor / forms */
  .contact-grid, .tier-grid { grid-template-columns: 1fr; }
}

/* ── Detail page: compact on phones ─────────────────────────── */
@media (max-width: 768px) {
  .detail-card { padding: var(--sp-4); margin-bottom: var(--sp-4); border-radius: var(--r-md); }
  .detail-card-title { margin-bottom: var(--sp-3); }

  /* Compliance: 2×2 grid, icon + text side by side */
  .compliance-grid { grid-template-columns: 1fr 1fr !important; gap: var(--sp-2); }
  .compliance-item {
    padding: 10px 12px; gap: 2px;
    display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center;
  }
  .compliance-item .ci-status { grid-row: 1 / span 2; font-size: 1.25rem; }
  .compliance-item .ci-label { font-size: .7rem; line-height: 1.2; }
  .compliance-item .ci-value { font-size: .78rem; line-height: 1.2; }

  /* Info notes and meta rows */
  .notice, .info-box, .compliance-note { padding: 12px; font-size: .8125rem; line-height: 1.5; }
  .meta-row { padding: 8px 0; }
  .features-grid { gap: var(--sp-2); }
  .feature-item { padding: 10px 12px; font-size: .8125rem; }
  .deploy-pills { gap: 6px; }
  .deploy-pill { font-size: .75rem; padding: 5px 10px; }

  /* Related + ESN cards: tighter */
  .esn-card { padding: var(--sp-3); }
  .related-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
}

@media (max-width: 400px) {
  .container { padding-left: 14px; padding-right: 14px; }
  .card-header { flex-wrap: wrap; }
  .card-ext-links { width: 100%; }
}
