/*
 * AH Digital — Responsive System
 *
 * Cross-component responsive refinements.
 * Component-specific mobile behavior may still live beside the component.
 */

/* -------------------------------------------------------------------------- */
/* Large screens                                                              */
/* -------------------------------------------------------------------------- */

@media (min-width: 1440px) {
  :root {
    --ah-gutter: 48px;
  }
}

/* -------------------------------------------------------------------------- */
/* Desktop                                                                    */
/* -------------------------------------------------------------------------- */

@media (min-width: 1024px) {
  .ah-desktop-only {
    display: initial;
  }

  .ah-mobile-only {
    display: none !important;
  }
}

/* -------------------------------------------------------------------------- */
/* Tablet and below                                                           */
/* -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  :root {
    --ah-gutter: clamp(24px, 4vw, 36px);
  }

  h1 {
    max-width: 17ch;
  }

  h2 {
    max-width: 20ch;
  }

  .ah-desktop-only {
    display: none !important;
  }

  .ah-mobile-only {
    display: initial;
  }

  .ah-nav--desktop {
    display: none;
  }

  .ah-browser-frame {
    box-shadow: var(--ah-shadow-md);
  }
}

/* -------------------------------------------------------------------------- */
/* Mobile                                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 767px) {
  :root {
    --ah-gutter: 20px;
    --ah-section-space: clamp(56px, 16vw, 88px);
  }

  body {
    line-height: 1.6;
  }

  h1 {
    max-width: 100%;
    letter-spacing: -0.04em;
  }

  h2 {
    max-width: 100%;
    letter-spacing: -0.035em;
  }

  .ah-section-heading,
  .ah-section-heading__title,
  .ah-section-heading__copy {
    max-width: 100%;
  }

  .ah-section-heading--center {
    text-align: start;
  }

  .ah-section-heading--center > * {
    margin-inline: 0;
  }

  .ah-container {
    width: calc(100% - (var(--ah-gutter) * 2));
  }

  .ah-cluster--mobile-stack {
    align-items: stretch;
    flex-direction: column;
  }

  .ah-cluster--mobile-stack > * {
    width: 100%;
  }

  .ah-card__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .ah-card__footer .ah-button {
    width: 100%;
  }

  .ah-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-block-end: var(--ah-space-2);
    scrollbar-width: thin;
  }

  .ah-tab {
    flex: 0 0 auto;
  }

  .ah-browser-frame__address {
    display: none;
  }

  .ah-browser-frame__bar {
    justify-content: flex-start;
  }

  .ah-metric__value {
    font-size: clamp(1.65rem, 9vw, 2.4rem);
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* -------------------------------------------------------------------------- */
/* Small mobile                                                               */
/* -------------------------------------------------------------------------- */

@media (max-width: 479px) {
  :root {
    --ah-gutter: 18px;
  }

  .ah-button,
  .ah-button--lg {
    width: 100%;
  }

  .ah-card {
    border-radius: var(--ah-radius-md);
  }

  .ah-browser-frame {
    border-radius: var(--ah-radius-md);
  }

  .ah-badge {
    white-space: normal;
  }
}

/* -------------------------------------------------------------------------- */
/* Pointer capability                                                         */
/* -------------------------------------------------------------------------- */

@media (hover: none) {
  .ah-button:hover,
  .ah-card--interactive:hover,
  .ah-theme-toggle:hover,
  .ah-hover-lift:hover,
  .ah-hover-scale-media:hover img {
    transform: none;
  }

  .ah-button--signal::after,
  .ah-signal-sweep::after {
    display: none;
  }
}

/* -------------------------------------------------------------------------- */
/* High contrast / forced colors                                              */
/* -------------------------------------------------------------------------- */

@media (forced-colors: active) {
  .ah-button,
  .ah-card,
  .ah-badge,
  .ah-browser-frame,
  .ah-tab,
  .ah-theme-toggle,
  input,
  textarea,
  select {
    border: 1px solid CanvasText;
  }

  .ah-nav__link::after,
  .ah-card--signal::before,
  .ah-progress-track__fill,
  .ah-motion-line::after {
    background: CanvasText;
  }
}

/* -------------------------------------------------------------------------- */
/* Reduced transparency                                                       */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-transparency: reduce) {
  .ah-button--signal::after,
  .ah-signal-sweep::after {
    display: none;
  }
}

/* -------------------------------------------------------------------------- */
/* Print                                                                      */
/* -------------------------------------------------------------------------- */

@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .ah-nav,
  .ah-theme-toggle,
  .ah-button,
  .ah-decoration {
    display: none !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  .ah-card,
  .ah-browser-frame {
    break-inside: avoid;
    border-color: #bbb !important;
    background: #fff !important;
  }
}
