/* Digital MathLab — tablet & mobile layouts (all pages) */

/* ── Hero: mobile (Figma Frame 169 — 440×821) ── */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
  }

  .hero-inner {
    padding-block: 36px 32px;
    gap: 24px;
  }

  .hero-copy h1 {
    font-size: clamp(1.75rem, 8.5vw, 2.35rem);
    margin-bottom: 14px;
  }

  .hero-line {
    line-height: 1.15;
  }

  .hero-tagline {
    font-size: 16px;
    line-height: 1.45;
    margin-bottom: 22px;
  }

  .btn-hero-cta {
    width: 186px;
    height: 54px;
    padding: 12px 16px;
  }

  .hero-visual {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    border-radius: 18px;
    box-shadow: none;
    border: none;
    background: transparent;
  }

  .hero-visual img {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 640px) {
  .hero {
    width: 100%;
    max-width: 100%;
    margin-top: var(--header-h);
    overflow: hidden;
    min-height: 0;
    height: auto;
    box-sizing: border-box;
  }

  .hero-inner.container {
    width: 100%;
    max-width: 100%;
    padding-inline: 20px;
    box-sizing: border-box;
  }

  .hero-inner {
    padding-block: 28px 32px;
    gap: 20px;
    min-height: 0;
    height: auto;
    justify-content: flex-start;
  }

  .hero-copy {
    align-items: flex-start;
    text-align: left;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .hero-copy h1 {
    width: 100%;
    max-width: 100%;
    font-size: clamp(1.65rem, 7.5vw, 2rem);
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    overflow-wrap: anywhere;
  }

  .hero-tagline {
    font-size: 15px;
    margin-bottom: 18px;
    padding-inline: 0;
    max-width: 22em;
  }

  .btn-hero-cta {
    width: 186px;
    height: 54px;
    padding: 12px 16px;
    align-self: flex-start;
  }

  .hero-visual {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 611 / 360;
    height: auto;
    min-height: 0;
    margin-top: 0;
    flex-shrink: 1;
    border-radius: 16px;
    background: transparent;
    box-shadow: none;
    border: none;
  }

  .hero-visual img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
  }
}

@media (max-width: 380px) {
  .hero-copy h1 {
    font-size: 1.5rem;
  }

  .hero-tagline {
    font-size: 14px;
  }

  .hero-inner {
    padding-inline: 16px;
  }
}

/* ── About intro: “What is Digital MathLab?” ── */
@media (max-width: 768px) {
  .about-intro h2 {
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }

  .about-lead {
    font-size: 17px;
    line-height: 1.55;
  }
}

@media (max-width: 480px) {
  .about-intro h2 {
    font-size: 1.5rem;
  }

  .about-lead {
    font-size: 15px;
    line-height: 1.55;
  }
}

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  .visuals-head {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 20px;
  }

  .visuals-head h2 {
    flex: none;
    max-width: none;
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  }

  .visuals-head p {
    flex: none;
    max-width: none;
  }

  .experience-title-wrap {
    margin-bottom: 40px;
  }

  .experience-title-wrap h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  }

  .how-card-head {
    margin-bottom: 40px;
  }

  .how-card h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  }

  .schools {
    overflow-x: clip;
  }

  .schools .section-title-center.section-title-narrow {
    max-width: 100%;
    font-size: clamp(1.5rem, 6.5vw, 2.25rem);
    line-height: 1.2;
    margin-bottom: 28px;
  }

  .school-cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    margin: 32px 0 28px;
    width: 100%;
    min-width: 0;
  }

  .school-card,
  .school-card.school-card-mint,
  .school-card-mint {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: auto;
    min-height: 0;
    padding: 28px;
    overflow: hidden;
  }

  .school-card-text {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    flex: none;
    overflow-wrap: anywhere;
  }

  .school-card h3,
  .school-card p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .school-card h3 {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    line-height: 1.2;
    margin-bottom: 10px;
  }

  .school-card p {
    font-size: 17px;
    line-height: 1.45;
  }

  .school-card-lime .school-card-media {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: min(48vw, 280px);
    margin: 0 auto;
    transform: none;
    object-fit: contain;
    object-position: center;
  }

  /* Stepped diagram: scale full Figma artboard (560×161) to card width */
  .dashboard-figma-outer {
    --dashboard-design-w: 560.45px;
    --dashboard-design-h: 161.2px;
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: calc(var(--dashboard-design-h) * (100cqw / var(--dashboard-design-w)));
    margin: 12px auto 8px;
    box-sizing: border-box;
    transform: none;
    filter: drop-shadow(0 1px 16px rgba(0, 0, 0, 0.03));
    overflow: visible;
    container-type: inline-size;
  }

  @supports not (width: 100cqw) {
    .dashboard-figma-outer {
      aspect-ratio: 560.45 / 161.2;
      height: auto;
    }
  }

  .dashboard-figma-stage {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--dashboard-design-w);
    height: var(--dashboard-design-h);
    transform-origin: top left;
    transform: scale(calc(100cqw / var(--dashboard-design-w)));
  }

  @supports not (width: 100cqw) {
    .dashboard-figma-stage {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      transform: none;
    }

    .dashboard-figma-inner {
      position: absolute;
      left: 0;
      top: 3.6%;
      width: 76.24%;
      height: auto;
    }

    .dashboard-figma-inner img {
      width: 100%;
      height: auto;
      aspect-ratio: 427.28 / 137.8;
    }

    .dashboard-figma-add {
      left: 71%;
      top: 75.76%;
      width: 28%;
      max-width: calc(100% - 71% - 2px);
      height: 24.24%;
      min-height: 30px;
      font-size: clamp(9px, 2.5vw, 11px);
      padding: 0 8px;
    }
  }

  .dashboard-figma-inner {
    position: absolute;
    left: 0;
    top: 5.81px;
    width: 427.28px;
    height: 137.8px;
  }

  .dashboard-figma-inner img {
    width: 427.28px;
    height: 137.8px;
    max-width: none;
    display: block;
  }

  .dashboard-figma-add {
    position: absolute;
    left: 426.48px;
    top: 122.12px;
    width: 133.69px;
    height: 39.08px;
    padding: 10px;
    box-sizing: border-box;
    font-size: 11px;
    transform: none;
  }

  .dashboard-figma-add-text {
    white-space: nowrap;
  }

  .screen-card {
    gap: 48px;
    padding: 32px 28px;
  }

  .screen-copy h3 {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    line-height: 1.2;
  }
}

/* ── Tablet portrait (≤768px) ── */
@media (max-width: 768px) {
  .classroom .container {
    text-align: center;
  }

  .tab-bar {
    display: flex;
    width: min(100%, 320px);
    max-width: calc(100vw - var(--page-pad) * 2);
    margin-bottom: 32px;
  }

  .tab {
    flex: 1 1 50%;
    width: auto;
    min-width: 0;
    font-size: 15px;
    padding: 10px 8px;
  }

  .classroom {
    padding: 48px 0 64px;
  }

  .classroom .section-title-center {
    margin-bottom: 24px;
  }

  .tab-bar {
    margin-bottom: 20px;
  }

  .classroom-grid {
    gap: 20px;
  }

  .classroom-copy {
    text-align: left;
  }

  .classroom-copy h3 {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    margin-bottom: 12px;
  }

  .classroom-copy > p {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .check-rows li {
    font-size: 15px;
  }

  /* Topic chips flow like words in a centered sentence */
  .topic-pills {
    display: block;
    text-align: center;
    line-height: 2.75;
    margin-bottom: 20px;
    overflow: visible;
  }

  .topic-pills .pill {
    display: inline-flex;
    vertical-align: middle;
    width: auto;
    max-width: calc(100% - 12px);
    height: auto;
    min-height: 38px;
    margin: 4px 5px;
    padding: 8px 14px;
    font-size: 14px;
    white-space: nowrap;
  }

  .visuals {
    padding: 48px 0 56px;
  }

  .visuals-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  .visuals-head h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  .visuals-head p {
    font-size: 16px;
    line-height: 1.5;
  }

  .topic-pills {
    line-height: 2.5;
    margin-bottom: 16px;
  }

  .topic-pills .pill {
    margin: 3px 4px;
    padding: 7px 12px;
    font-size: 13px;
    min-height: 36px;
  }

  .visuals-demo {
    margin-bottom: 0;
  }

  .visuals-demo img {
    aspect-ratio: 16 / 10;
    max-height: min(52vh, 320px);
    object-fit: cover;
  }

  .visuals .btn-demo {
    margin-top: 28px;
    width: fit-content;
    max-width: calc(100% - 8px);
    padding: 12px 20px;
    gap: 12px;
  }

  .screen-copy-stack > p,
  .screen-check-rows li {
    font-size: 16px;
    line-height: 1.45;
  }

  .screen-card .btn-contact-brown {
    width: 100%;
    max-width: 280px;
  }

  .schools {
    padding: 48px 0 64px;
  }

  .school-cards {
    gap: 24px;
  }

  .school-card,
  .school-card-mint {
    padding: 24px;
    gap: 18px;
  }

  .school-card p {
    font-size: 16px;
  }

  .footer-top {
    gap: 28px;
  }

  .footer-links-group {
    width: 100%;
    justify-content: space-between;
  }
}

/* ── Mobile (≤640px) ── */
@media (max-width: 640px) {
  .logo-img {
    height: 42px;
    max-width: 190px;
  }

  .btn-demo {
    width: 100%;
    max-width: none;
    height: 50px;
  }

  .visuals .btn-demo {
    width: fit-content;
    max-width: calc(100% - 8px);
    height: 50px;
    margin-top: 24px;
    padding: 12px 18px;
    gap: 10px;
  }

  .btn-contact-brown {
    width: 100%;
    max-width: none;
  }

  .section-title-center {
    font-size: clamp(1.5rem, 6.5vw, 1.85rem);
    line-height: 1.2;
  }

  .tab-bar {
    width: 100%;
    max-width: none;
  }

  .tab img {
    width: 18px;
    height: 18px;
  }

  .classroom-image {
    width: 100%;
  }

  .classroom-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
  }

  .visuals {
    padding: 40px 0 48px;
  }

  .visuals-head {
    margin-bottom: 12px;
  }

  .visuals-demo {
    border-radius: var(--radius-md);
  }

  .visuals-demo img {
    max-height: min(45vh, 260px);
  }


  .experience {
    padding: 64px 0;
  }

  .exp-card h3 {
    font-size: 18px;
  }

  .exp-card p {
    font-size: 15px;
  }

  .how-it-works {
    padding: 48px 0 64px;
  }

  .how-card {
    padding: 40px 20px;
  }

  .how-card-head {
    margin-bottom: 32px;
  }

  .how-card h2 {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
  }

  .how-badge {
    font-size: 12px;
  }

  .steps-row {
    gap: 28px;
  }

  .step {
    flex: none;
    gap: 10px;
  }

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

  .step p {
    font-size: 15px;
    line-height: 1.45;
  }

  .school-card,
  .school-card-mint {
    padding: 20px;
    gap: 16px;
    min-width: 0;
  }

  .school-card h3 {
    font-size: 1.35rem;
  }

  .school-card p {
    font-size: 15px;
  }

  .school-card-lime .school-card-media {
    max-height: min(48vw, 220px);
  }

  .dashboard-figma-outer {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  @supports (width: 100cqw) {
    .dashboard-figma-add {
      font-size: clamp(9px, 2.8cqw, 11px);
    }
  }

  .screen-card {
    padding: 24px 20px;
    border-radius: var(--radius-md);
  }

  .screen-image {
    order: -1;
  }

  .faq-item summary {
    padding: 18px 16px;
    font-size: 16px;
    min-height: auto;
  }

  .faq-item p {
    padding: 0 16px 20px;
    font-size: 15px;
  }

  .title-highlight::before {
    height: 0.5em;
    width: 100%;
    bottom: 0.08em;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}

/* ── Small mobile (≤480px) ── */
@media (max-width: 480px) {
  .header-inner {
    gap: 12px;
  }

  .nav.open {
    padding: 20px var(--page-pad);
  }

  .nav.open a {
    padding: 14px 0;
    font-size: 17px;
  }

  .whatsapp-float {
    right: 16px;
    bottom: 16px;
  }
}

