/* YAAZHAI mobile-only typography and overflow polish.
   Intentionally scoped to small screens so the approved desktop layout is unchanged. */
@media (max-width: 800px) {
  html, body { max-width: 100%; }
  body { overflow-wrap: anywhere; }
  /* Let grid/flex children shrink instead of forcing Tamil text outside their frames. */
  body * { min-width: 0; }
  /* Tamil glyphs and long translated strings must wrap inside their own containers. */
  body :is(h1,h2,h3,h4,h5,h6,p,li,dd,dt,label,summary,figcaption,blockquote,
    a,button,span,strong,em,b,i,small,legend,th,td,caption,output,.lead,.eyebrow,
    .label,.section-label,.quote,.badge,.small,.epigraphy-kicker,.epigraphy-title,
    .epigraphy-sub,.epigraphy-foot,.c2-tamil,.c2-panel,.c2-note,.ages-story,
    .ages-flag-meta,.ages-chip,.ages-disclaimer,.timeline,.inscription,.diagram figcaption,
    .yaazhai-source-card,.yaazhai-sources-head,.yaazhai-sources-foot,
    .pass-tagline,.pass-benefits li,.pass-note,.future-note,.purchase-route,
    .terms-content,.buy-instructions,.buy-step,.team-card,.founder-sheet,
    .resume-sheet,.modal-content,.modal-body,.card,.panel,.info-panel) {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
    box-sizing: border-box;
  }
  /* Fixed-height text cards and content panels are a common source of clipping after zoom. */
  body :is(.card,.team-card,.pass-card,.buy-sheet,.terms-content,.inscription,
    .epigraphy-panel,.c2-panel,.yaazhai-source-card,.founder-sheet,.resume-sheet,
    .feature-card,.info-panel,.text-panel,.story-card,.quote,.future-note) {
    height: auto;
    min-height: 0;
  }
  /* Keep buttons and pills elegant while allowing translated labels to wrap. */
  body :is(button,.btn,.pass-cta a,.pass-cta button,.terms-toggle,
    .epigraphy-labels button,.c2-slider-labels button,.cave3-diagram-tabs button,
    .cave1-3d-controls button,.cave2-3d-controls button,.cave3-3d-controls button,
    .topic-audio-btn,.listen-btn) {
    max-width: 100%;
    height: auto;
    min-height: 40px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.45;
    text-align: center;
  }
  /* Remove text clipping from cards/labels without affecting 3D viewer canvases. */
  body :is(.card,.pass-card,.epigraphy-panel,.c2-panel,.inscription,
    .yaazhai-source-card,.terms-content,.buy-instructions,.future-note,
    .purchase-route,.team-card,.founder-sheet,.resume-sheet) {
    overflow: visible;
  }
  /* Preserve intentional horizontal scrolling controls such as period timelines. */
  body :is(.ages-period-strip,.ages-ticks,.navlinks,.links,.cave1-3d-controls,
    .cave2-3d-controls,.cave3-3d-controls) { min-width: 0; }
  body img, body video, body iframe { max-width: 100%; }
  body table { max-width: 100%; }
  body pre, body code { white-space: pre-wrap; overflow-wrap: anywhere; }
}

@media (max-width: 480px) {
  body :is(.card,.pass-card,.epigraphy-wrap,.c2-epigraphy,.inscription,
    .yaazhai-source-card,.terms-content,.buy-sheet,.future-note) {
    padding-left: clamp(12px, 4vw, 20px);
    padding-right: clamp(12px, 4vw, 20px);
  }
  body :is(h1,h2,h3,h4,.epigraphy-title,.c2-epigraphy-title,.yaazhai-sources-head h2) {
    letter-spacing: normal;
    overflow-wrap: anywhere;
  }
  #a11y-panel { box-sizing: border-box; max-width: calc(100vw - 24px); }
  #a11y-panel .a11y-options button { flex: 1 1 auto; min-width: 0; white-space: normal; }
}
