/* ── Touch devices or narrow screens: hamburger + off-canvas menu ── */

@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  /* ── Hamburger button ── */
  #menuToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 0 9999px 9999px 0;
    align-self: stretch;
    padding: 0 1.25rem;
    font-size: 1.75rem;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 300;
  }

  #menuToggle:focus-visible {
    outline: 2px solid #4a6741;
    outline-offset: 2px;
  }

  /* ── Off-canvas sidebar ── */
  .sideBar {
    position: fixed;
    right: -100vw;
    top: 0;
    height: 100%;
    width: 85vw;
    min-height: 100%;
    padding-top: 11rem;
    z-index: 250;
    transition: right 0.28s ease;
  }

  .sideBar.open {
    right: 0;
  }

  /* ── Overlay behind open sidebar ── */
  .menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
  }

  .menu-overlay.open {
    display: block;
  }
}

/* ── Narrow screens or touch devices: layout adjustments ── */

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .vitsi-arrow {
    display: none;
  }

  html {
    overflow-x: hidden;
  }

  /* ── Header ── */
  #header {
    height: 14rem;
    margin-bottom: -5rem;
    padding-bottom: 0;
  }

  #headerContent {
    flex: 1;
    min-width: 0;
    align-self: flex-start;
    font-size: clamp(1.5rem, 5vw, 2.25rem);
    justify-content: space-between;
  }

  .header-title {
    white-space: normal;
    word-break: break-word;
  }

  /* ── Page layout ── */
  #page {
    display: block;
    flex: 1;
  }

  /* Push content down to clear the overlapping header */
  #content {
    padding: 12rem 5vw 3rem;
  }

  /* ── Paper ── */
  #paperFrame {
    max-width: 100%;
    min-height: unset;
    padding: 2rem 6vw;
  }

/* ── Yhteystiedot ── */
  .yhteystiedot-grid {
    grid-template-columns: 1fr;
  }

  /* ── Vitsi ── */
  .vitsi-grid {
    grid-template-columns: 1fr;
  }

  /* ── Map ── */
  .map-wrapper iframe {
    aspect-ratio: 1 / 1;
  }

  /* ── Footer CTA ── */
  .footer-cta {
    flex-direction: column;
    align-items: flex-start;
  }
}
