/* Device adaptations: keep the approved visual identity at every screen size. */
:root {
  --visual-height: 100vh;
  --visual-top: 0px;
  --header-bottom: 80px;
}
@supports (height: 100dvh) {
  :root { --visual-height: 100dvh; }
}
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: 90px; }
button, a, summary { touch-action: manipulation; }
.hero-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.hero-copy, .hero-visual, .founders-copy, .course-title-cell, .course-time { min-width: 0; }
.day-filters button, .teacher-link, .text-action, .underlined-action,
.header-cta, .menu-toggle, .close-dialog { min-height: 44px; }
.menu-toggle, .close-dialog { min-width: 44px; }
.close-dialog { width: 44px; height: 44px; flex-shrink: 0; }
.teacher-link { font-size: 12px; }
.day-filters button { font-size: 12px; }
body.menu-open { overflow: hidden; }

/* Dialogs track the usable screen, including when a phone keyboard opens. */
dialog {
  position: fixed;
  top: calc(var(--visual-top) + var(--visual-height) / 2);
  bottom: auto;
  margin: 0 auto;
  transform: translateY(-50%);
  max-height: calc(var(--visual-height) - 24px);
  max-width: calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)));
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.request-dialog { padding: 0; }
.request-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.request-top .eyebrow { padding: 0; }
.request-top .close-dialog { position: static; font-size: 27px; }
.request-body { padding: 0 32px 32px; }
.request-dialog h2 { margin-top: 20px; }
.request-dialog select, .request-dialog textarea { font-size: 16px; }
.request-dialog label { font-size: 13px; }
.video-dialog-top { position: sticky; top: 0; z-index: 2; background: var(--forest-deep); }
.video-dialog video { max-height: calc(var(--visual-height) - 130px); }
.dialog-open .mobile-bottom { visibility: hidden; }

@media (min-width: 801px) and (max-width: 1100px) {
  .hero h1 { font-size: clamp(66px, 7.7vw, 85px); }
  .hero-actions { flex-wrap: wrap; }
  .desktop-nav { gap: clamp(12px, 1.8vw, 20px); }
}
@media (min-width: 581px) and (max-width: 800px) {
  .hero h1 { font-size: clamp(48px, 7.8vw, 62px); }
  .hero-visual { height: clamp(390px, 62vw, 465px); }
  .founders { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
  .founders-copy h2 { font-size: clamp(30px, 4.6vw, 36px); }
  .founders-photo { height: auto; aspect-ratio: 2 / 3; }
  .teacher-photo { height: auto; aspect-ratio: 3 / 4; }
}

@media (max-width: 800px), (max-width: 1000px) and (max-height: 520px) and (pointer: coarse) {
  .site-header {
    height: 80px;
    padding: 8px max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left));
    gap: 12px;
  }
  .brand { width: 84px; }
  .brand img { height: 60px; }
  .desktop-nav { display: none; }
  .header-cta { margin-left: auto; min-width: 0; min-height: 44px; gap: 10px; padding: 8px 12px; font-size: 12px; line-height: 1.25; }
  .header-cta span { font-size: 20px; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; padding: 0; width: 44px; min-height: 44px; background: transparent; flex-shrink: 0; }
  .menu-toggle span { width: 24px; height: 1px; background: var(--cream); }
  .menu-toggle[aria-expanded=true] span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-toggle[aria-expanded=true] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .mobile-menu:not([hidden]) {
    display: flex;
    position: fixed;
    top: var(--header-bottom);
    left: 0;
    right: 0;
    z-index: 29;
    flex-direction: column;
    max-height: calc(var(--visual-height) - var(--header-bottom) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
    background: var(--forest-deep);
    border-bottom: 1px solid #ffffff33;
  }
  .mobile-menu a { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; min-height: 60px; padding: 13px 0; border-bottom: 1px solid #ffffff33; font-family: var(--display); font-size: 27px; }
  .mobile-menu a span { font-family: var(--sans); font-size: 11px; color: var(--lime); }
  .course-time { font-size: 13px; line-height: 1.5; }
  .course-intro { font-size: 12px; line-height: 1.5; }
  .course-footnote { font-size: 11px; }
  .course-count { font-size: 12px; }
  .teacher-course { font-size: 10px; }
  .teacher-link { font-size: 12px; }
  .founder-names small { font-size: 11px; }
  .dialog-intro { font-size: 13px; }
  .request-dialog label { font-size: 14px; }
}

@media (max-width: 580px) {
  html { scroll-padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .site-header { height: 76px; }
  .brand { width: 72px; }
  .brand img { height: 52px; }
  .wrap, .welcome, .experiences-section, .faq-section {
    padding-left: max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
  }
  .hero h1 { font-size: clamp(60px, 17vw, 88px); }
  .hero-copy > p { font-size: 15px; }
  .hero-actions { gap: 14px; flex-wrap: wrap; }
  .hero-actions > .text-action { font-size: 13px; }
  .hero-actions > .button { font-size: 13px; }
  .hero-visual { height: auto; aspect-ratio: 2 / 3; width: calc(100% - 29px); }
  .founders-photo { height: auto; aspect-ratio: 2 / 3; }
  .teacher-photo { height: auto; aspect-ratio: 3 / 4; }
  .welcome-copy .muted, .founders-copy > p:not(.lead), .experience p, details > p { font-size: 14px; }
  .day-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; overflow: visible; padding: 0; }
  .day-filters button { min-width: 0; min-height: 44px; padding: 8px 5px; font-size: 12px; }
  .day-filters button:first-child { grid-column: span 2; }
  .course-row { grid-template-columns: 18px minmax(0, 1fr) 72px; column-gap: 8px; }
  .course-name { font-size: clamp(24px, 6.9vw, 30px); }
  .course-open { font-size: 12px; }
  .course-time { overflow-wrap: anywhere; }
  .course-help > p { font-size: 15px; }
  summary { font-size: 14px; }
  .request-body { padding: 0 24px 24px; }
  .request-top { padding: 12px 16px 10px 24px; }
  .request-dialog h2 { font-size: 42px; }
  .request-dialog .eyebrow { font-size: 9px; }
  .mobile-bottom {
    height: auto;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 9px max(16px, env(safe-area-inset-right)) calc(9px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    gap: 12px;
  }
  .mobile-bottom > a, .mobile-bottom > button { min-height: 44px; display: inline-flex; align-items: center; }
  .mobile-bottom > a { font-size: 12px; }
  .mobile-bottom > button { font-size: 13px; gap: 16px; padding: 10px 16px; }
  .site-footer { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
  .site-footer > span, .site-footer small { font-size: 10px; }
  .site-footer > a:last-child { min-height: 44px; }
}

@media (max-height: 520px) and (max-width: 1000px) {
  .video-dialog-top { padding: 8px 16px; }
  .video-dialog h2 { font-size: 22px; }
  .video-dialog video { max-height: calc(var(--visual-height) - 108px); }
  .request-dialog h2 { font-size: 34px; }
  .request-top { padding-top: 8px; padding-bottom: 8px; }
}
@media (hover: none) {
  .button:hover, .teacher:hover img { transform: none; }
  .teacher:hover img { filter: grayscale(1); }
}

/* The primary mobile action also works as a standard link to First Access. */
@media (max-width: 580px) {
  .mobile-bottom > [data-trial-link] { background: var(--lime); color: var(--forest); font-size: 13px; font-weight: 600; gap: 16px; padding: 10px 16px; }
  .mobile-bottom > [data-trial-link] span { font-size: 18px; line-height: 1; }
}
