/* ===========================================
   RESPONSIVE STYLES
   =========================================== */

/* ------------------------------------- TABLET LANDSCAPE (1100px) */
@media (max-width: 1100px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero-col:nth-child(2) {
    order: -1;
    max-width: 400px;
    margin: 0 auto;
  }

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

  .element.featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .element.featured .el-sym {
    font-size: clamp(38px, 5vw, 62px);
  }

  .plans {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .plan.featured {
    transform: none;
    order: -1;
  }

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

  .glossary {
    grid-template-columns: 1fr;
  }

  .founder {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .founder-portrait {
    max-width: 400px;
    margin: 0 auto;
  }

  .mech-wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .ing-intro {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .ing-detail {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .ing-detail .big-sym {
    font-size: 100px;
    text-align: center;
  }

  .refs {
    columns: 1;
  }

  footer .foot-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
  }
}

/* ------------------------------------- TABLET PORTRAIT (900px) */
@media (max-width: 900px) {
  .masthead-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 12px;
    padding: 12px 0;
  }

  .ticker {
    display: none;
  }

  .nav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .hero-kicker {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .hero-title {
    font-size: clamp(36px, 10vw, 72px);
    text-align: center;
  }

  .hero-sub {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .cta-row {
    justify-content: center;
  }

  .hero-trust {
    justify-content: center;
  }

  .section-head {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
  }

  .section-aside {
    text-align: center;
    max-width: none;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-grid > div {
    border-right: 0;
  }

  .compare-grid > div:nth-child(4n+1) {
    background: var(--bg-2);
    font-weight: 600;
    padding: 12px 20px;
  }

  .compare-head {
    padding: 18px 20px !important;
  }

  .proof-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .follicle-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .follicle-container svg {
    max-width: 200px;
    margin: 0 auto;
  }

  .sticky-inner {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px 20px;
  }

  .sb-mark,
  .sb-qty {
    display: none;
  }
}

/* ------------------------------------- LARGE PHONES (680px) */
@media (max-width: 680px) {
  .periodic {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .element {
    padding: 16px 14px 14px;
    aspect-ratio: auto;
    min-height: 180px;
  }

  .element .el-sym {
    font-size: 32px;
  }

  .element .el-mech {
    font-size: 11px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .routine {
    grid-template-columns: 1fr;
  }

  .step-card {
    min-height: auto;
    padding: 24px 20px;
  }

  .step-num {
    font-size: 72px;
  }

  .plans {
    gap: 16px;
  }

  .plan {
    padding: 24px 20px 28px;
  }

  .plan .plan-price {
    font-size: 48px;
  }

  .faq summary {
    grid-template-columns: 32px 1fr auto;
    gap: 12px;
    font-size: 18px;
  }

  .faq .a {
    padding: 12px 0 6px 44px;
    font-size: 15px;
  }

  .ba-slider {
    aspect-ratio: 3/4;
  }

  .ba-slider .ba-label-before,
  .ba-slider .ba-label-after {
    padding: 6px 10px;
    font-size: 9px;
  }

  footer .foot-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  footer .foot-logo {
    font-size: 32px;
  }

  footer .finale {
    flex-direction: column;
    gap: 12px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat .k {
    font-size: 32px;
  }

  .pullquote {
    font-size: 18px;
  }

  .pullquote .mk {
    font-size: 36px;
    vertical-align: -10px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 16px 20px;
  }

  .cta-row {
    flex-direction: column;
  }

  .marquee {
    font-size: 16px;
    gap: 32px;
  }
}

/* ------------------------------------- SMALL PHONES (480px) */
@media (max-width: 480px) {
  /* Safe area for notched phones */
  body {
    font-size: 16px;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .masthead {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .sticky-buy {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .brand {
    font-size: 16px;
  }

  .nav {
    gap: 12px;
    font-size: 12px;
  }

  .nav a:not(.buy) {
    display: none;
  }

  /* Ensure buy button is prominent and tappable */
  .nav .buy {
    padding: 12px 18px;
    font-size: 12px;
  }

  .hero-title {
    font-size: clamp(28px, 12vw, 48px);
  }

  .hero-sub {
    font-size: 16px;
  }

  .section-title {
    font-size: clamp(24px, 7vw, 36px);
  }

  .periodic {
    grid-template-columns: 1fr;
  }

  .element {
    min-height: 140px;
    padding: 14px 12px;
  }

  .element .el-sym {
    font-size: 28px;
    margin-top: 10px;
  }

  .element .el-name {
    font-size: 14px;
  }

  .ing-detail .big-sym {
    font-size: 64px;
  }

  .ing-detail .dt-head {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .ing-detail .dt-head .name {
    font-size: 22px;
  }

  .plan .plan-title {
    font-size: 24px;
  }

  .plan .plan-price {
    font-size: 40px;
  }

  .plan-pick {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .step-num {
    font-size: 56px;
  }

  .step-title {
    font-size: 18px;
  }

  .founder-text .fletter {
    font-size: 17px;
  }

  .founder-text .fletter::first-letter {
    font-size: 56px;
    padding: 4px 8px 0 0;
  }

  .faq summary {
    font-size: 16px;
    grid-template-columns: 1fr auto;
  }

  .faq summary .q-num {
    display: none;
  }

  .faq .a {
    padding-left: 0;
  }

  .ba-slider .ba-instructions {
    font-size: 8px;
    padding: 4px 8px;
  }

  .tweaks-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 70px;
  }

  .stamp {
    width: 80px;
    height: 80px;
    font-size: 9px;
    top: 12px;
    right: 12px;
  }
}

/* ------------------------------------- MOBILE TOUCH ENHANCEMENTS */
@media (max-width: 680px) {
  /* Minimum 44px touch targets */
  .btn,
  .plan-btn,
  .sb-btn,
  .nav .buy {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .plan-pick button {
    min-height: 48px;
    padding: 12px 8px;
  }

  .faq summary {
    min-height: 48px;
    padding: 16px 0;
  }

  /* Sticky bar - full width CTA on mobile */
  .sticky-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
  }

  .sb-meta {
    font-size: 10px;
  }

  .sb-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 13px;
  }

  /* Policies section - stack cards */
  #policies .wrap > div:first-of-type {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Secret weapon callout - stack on mobile */
  #compare .wrap > div[style*="display: flex"] {
    flex-direction: column !important;
    text-align: center;
  }

  #compare .wrap > div[style*="display: flex"] > div:first-child {
    font-size: 36px !important;
  }

  /* Tap feedback for interactive elements */
  .element:active,
  .btn:active,
  .plan-btn:active,
  .sb-btn:active,
  .plan-pick button:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Better testimonial layout */
  .testimonial {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }

  .avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .testimonial .q {
    font-size: 15px;
  }

  /* Ingredient detail - hide big symbol on very small screens for more content space */
  .ing-detail .big-sym {
    display: none;
  }

  .ing-detail {
    grid-template-columns: 1fr;
  }

  .ing-detail .facts {
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding-left: 0;
    padding-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Extra small - tighten everything */
@media (max-width: 380px) {
  .wrap {
    padding: 0 16px;
  }

  .hero-title {
    font-size: 26px;
  }

  .section-title {
    font-size: 22px;
  }

  .plan .plan-price {
    font-size: 36px;
  }

  .step-num {
    font-size: 48px;
  }

  .ba-slider .ba-label-before,
  .ba-slider .ba-label-after {
    padding: 4px 8px;
    font-size: 8px;
    top: 8px;
  }

  .ba-slider .ba-label-before { left: 8px; }
  .ba-slider .ba-label-after { right: 8px; }
}

/* ------------------------------------- HOVER / TOUCH DETECTION */
@media (hover: none) {
  .element:hover {
    background: var(--bg-2);
    color: var(--ink);
    border-color: var(--rule);
    transform: none;
  }

  .element:hover .el-small { color: var(--muted); opacity: 1; }
  .element:hover .el-num { color: var(--muted); }
  .element:hover .el-mech { color: var(--ink-2); }

  .element.featured:hover {
    background: var(--accent);
    color: var(--paper);
    border-color: var(--accent);
  }
}

/* ------------------------------------- REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .marquee {
    animation: none;
  }

  .element,
  .btn,
  .sticky-buy,
  .faq summary .q-mark {
    transition: none;
  }
}

/* ------------------------------------- PRINT */
@media print {
  .masthead,
  .sticky-buy,
  .tweaks-panel,
  .broadside-band {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .hero,
  section,
  footer {
    border-color: #ccc;
    page-break-inside: avoid;
  }
}
