/* Mobile-first refinements: concise, touch-friendly, and easy to scan. */

@media (max-width: 760px) {
  html {
    scroll-padding-top: 76px;
  }

  body {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
  }

  .site-header {
    min-height: 68px;
    gap: 0.6rem;
    padding: max(0.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
  }

  .site-header .icon-action,
  .site-header .menu-toggle,
  .mobile-menu .menu-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .mobile-menu {
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .mobile-menu nav {
    gap: 0.25rem;
    margin-top: 2.5rem;
  }

  .mobile-menu nav a {
    display: flex;
    align-items: center;
    min-height: 54px;
    border-bottom: 1px solid var(--line);
    font-size: 1.35rem;
  }

  .hero {
    height: auto;
    min-height: min(40svh, 330px);
  }

  .hero h1 {
    max-width: calc(100vw - 2rem);
    margin-top: 2rem;
    font-size: clamp(2.6rem, 13vw, 3.75rem);
    line-height: 0.96;
    text-wrap: balance;
  }

  .breadcrumbs {
    width: 100%;
    margin: 0.9rem 0 0.7rem;
    padding-inline: 1rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .breadcrumbs::-webkit-scrollbar,
  .jump-nav::-webkit-scrollbar {
    display: none;
  }

  /* Province section navigation becomes a compact swipe row instead of a tall stack. */
  .jump-wrap {
    width: 100%;
    margin: 0.35rem 0 1.25rem;
    overflow: hidden;
  }

  .jump-nav {
    display: flex !important;
    width: 100%;
    gap: 0.5rem;
    padding: 0.65rem 1rem 0.85rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
  }

  .jump-nav a {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px;
    padding: 0.68rem 0.95rem !important;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.78rem !important;
    line-height: 1.15;
    letter-spacing: 0.04em;
    scroll-snap-align: start;
  }

  .guide-column,
  .lesson-wrap,
  .provider-guide,
  .provider-practice-shell {
    width: 100%;
    padding-inline: 1rem;
  }

  .guide-column h2,
  .lesson-wrap h2,
  .provider-guide h2 {
    font-size: clamp(1.8rem, 8vw, 2.35rem);
    line-height: 1.06;
    text-wrap: balance;
  }

  .guide-column p,
  .lesson-body,
  .lesson-body p,
  .lesson-body li {
    font-size: 1rem;
    line-height: 1.68;
  }

  .lesson-body table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lesson-body img,
  .lesson-image img {
    max-height: 68svh;
    object-fit: contain;
  }

  .lesson-body pre,
  .lesson-body code {
    max-width: 100%;
    overflow-x: auto;
  }

  /* Province clue groups and cards. */
  .province-curated-guide {
    gap: 1rem;
  }

  .province-curated-overview {
    margin: 0 0 1rem;
  }

  .province-curated-category {
    border-radius: 12px;
    overflow: clip;
  }

  .province-category-summary {
    min-height: 58px;
    padding: 0.85rem 0.95rem;
  }

  .province-category-summary h2,
  .province-category-summary h3 {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .province-category-content {
    padding: 0.7rem;
  }

  .province-curated-card {
    gap: 0.85rem;
    margin: 0 0 0.8rem;
    padding: 0.72rem;
    border-radius: 10px;
  }

  .province-curated-gallery {
    gap: 0.55rem;
  }

  .province-curated-figure,
  .province-curated-figure button {
    width: 100%;
  }

  .province-curated-figure button {
    min-height: 44px;
  }

  .province-curated-figure img {
    width: 100%;
    max-height: 60svh;
    object-fit: contain;
  }

  .province-curated-figure figcaption {
    padding-top: 0.5rem;
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .province-curated-copy h3 {
    margin-bottom: 0.45rem;
    font-size: 1.35rem;
    line-height: 1.12;
    text-wrap: balance;
  }

  .province-curated-location {
    margin-bottom: 0.55rem;
    font-size: 0.78rem;
  }

  .province-curated-copy p,
  .province-curated-observations p,
  .province-curated-observations li {
    font-size: 0.98rem;
    line-height: 1.58;
  }

  .clue-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .clue-actions button,
  .clue-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding-inline: 0.65rem;
    font-size: 0.76rem;
    text-align: center;
  }

  /* Practice categories are all visible without a hidden horizontal scroller. */
  .practice-map-game-page .practice-game-tabs,
  .practice-hub-page .practice-game-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
    max-width: none;
    gap: 0.5rem;
    margin: 0 0 1rem !important;
    padding: 0 !important;
    overflow: visible !important;
    scroll-snap-type: none;
  }

  .practice-map-game-page .practice-game-tabs a,
  .practice-hub-page .practice-game-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0 !important;
    min-height: 46px;
    padding: 0.65rem 0.5rem;
    font-size: 0.78rem;
    line-height: 1.2;
    text-align: center;
  }

  .practice-map-game-page,
  .practice-hub-page {
    width: 100%;
    padding-inline: 1rem;
  }

  .province-game-play {
    padding: 1rem 0.85rem;
  }

  .province-game-prompt h2 {
    font-size: clamp(1.35rem, 6.6vw, 1.75rem);
    line-height: 1.14;
  }

  .province-game-media {
    max-height: 54svh;
  }

  .province-game-media img {
    width: 100%;
    max-height: 54svh;
    object-fit: contain;
  }

  .province-game-map {
    min-height: 290px;
  }

  .province-game-controls button,
  .province-game-controls a {
    min-height: 46px;
  }

  /* Provider guides: compact data, large evidence images, readable maps. */
  .provider-car-hero {
    min-height: min(66svh, 560px);
    padding: 6rem 1rem 2.25rem;
  }

  .provider-car-hero h1 {
    font-size: clamp(2.8rem, 14vw, 4.2rem);
    line-height: 0.95;
  }

  .provider-car-hero p {
    max-width: 32rem;
    font-size: 1rem;
    line-height: 1.55;
  }

  .provider-stat-strip {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100%;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
  }

  .provider-stat-strip > * {
    min-width: 0;
    padding: 0.75rem 0.25rem;
    text-align: center;
  }

  .provider-stat-strip strong {
    font-size: 1.3rem;
  }

  .provider-stat-strip span {
    font-size: 0.62rem;
    line-height: 1.25;
  }

  .provider-toolbar {
    position: static;
    display: grid;
    gap: 0.65rem;
    padding: 0.8rem;
  }

  .provider-toolbar input,
  .provider-toolbar select,
  .provider-toolbar button,
  .provider-toolbar a {
    width: 100%;
    min-height: 46px;
  }

  .provider-rule {
    border-radius: 12px;
    overflow: clip;
  }

  .provider-rule-media img {
    width: 100%;
    max-height: 58svh;
    object-fit: contain;
  }

  .provider-rule-copy {
    padding: 1rem;
  }

  .provider-rule-copy h2,
  .provider-rule-copy h3 {
    font-size: 1.45rem;
    line-height: 1.1;
  }

  .provider-rule-copy p,
  .provider-rule-copy li {
    font-size: 0.98rem;
    line-height: 1.56;
  }

  .provider-map {
    min-height: 220px;
  }

  .provider-practice-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .provider-practice-toolbar button,
  .provider-practice-toolbar a {
    width: 100%;
    min-height: 46px;
  }

  .provider-practice-progress {
    grid-column: 1 / -1;
  }

  .provider-flashcard-front,
  .provider-flashcard-back {
    padding: 1rem;
  }

  /* Dialogs and enlarged images stay usable around notches and browser chrome. */
  #site-search,
  .search-dialog,
  .image-viewer {
    max-width: 100vw;
    max-height: 100svh;
  }

  #site-search input,
  .search-dialog input {
    min-height: 48px;
    font-size: 1rem;
  }

  .image-viewer button,
  .image-viewer a {
    min-width: 44px;
    min-height: 44px;
  }

  button,
  [role="button"],
  input,
  select,
  textarea {
    touch-action: manipulation;
  }
}

@media (max-width: 420px) {
  .plonk-logo-name,
  .site-title {
    font-size: 0.78rem;
    letter-spacing: 0.1em;
  }

  .provider-stat-strip span {
    font-size: 0.56rem;
    letter-spacing: 0.02em;
  }

  .practice-map-game-page .practice-game-tabs,
  .practice-hub-page .practice-game-tabs {
    gap: 0.42rem;
  }

  .practice-map-game-page .practice-game-tabs a,
  .practice-hub-page .practice-game-tabs a {
    padding-inline: 0.35rem;
    font-size: 0.73rem;
  }

  .clue-actions {
    grid-template-columns: 1fr;
  }
}
