/* Screen shapes: loaded last on every page, so it wins over styles.css, site.css and programs.css. */

/* Notched phones held sideways: keep content clear of the camera cut-out */
:root { --gutter: max(clamp(16px, 4vw, 40px), env(safe-area-inset-left), env(safe-area-inset-right)); }
.chat { right: max(16px, env(safe-area-inset-right)); }

/* Comfortable line length and no label under 12px, on any screen */
.credit-line, .table-foot, .yt__cap, .note-box p, .pf-sources p, .pf-help p, .gnote { max-width: 75ch; }
.mpin i, .dest small, .earth .dest small, .lvl { font-size: .75rem; }

/* Global header: the official logo is wider than the old one, so the menu gives up a little space */
@media (min-width: 1200px) {
  .header--wide .header__bar { gap: 16px; }
  .header--wide .nav > a { padding-inline: 8px; }
  .header--wide .nav > a::after { left: 8px; right: 8px; }
}

/* IMAT-side header (seven links) on 1024px tablets */
@media (min-width: 1024px) and (max-width: 1099px) {
  .header:not(.header--wide) .header__bar { gap: 14px; }
  .header:not(.header--wide) .nav > a { padding: 0 5px; }
}

/* Tiny phones and folded screens */
@media (max-width: 340px) { .btn { white-space: normal; max-width: 100%; } .phone input, .phone select { min-width: 0; } }

/* Short laptops: the landing photo fits the window, so the search button stays on the first screen */
@media (min-width: 1024px) and (max-height: 760px) {
  .lp { padding-top: 24px; }
  .lp__grid { align-items: start; }
  .lp__photo { aspect-ratio: auto; height: calc(100svh - var(--header-h) - 130px); min-height: 380px; }
  .lp__visual { padding-bottom: 0; }
  .lp h1 { font-size: clamp(2.2rem, 4vw, 3.2rem); }
  .lp__copy .lead { margin: 14px 0 20px; }
}

/* Touch screens: 44px tap areas, and 16px form text so iPhones don't zoom in when a field is tapped */
@media (pointer: coarse), (max-width: 1023px) {
  .brand, .btn, .btn--sm, .chip, .chat__chips .chip, .quiz__skip, .practice__more, .footer li a, .footer__links a,
  .reels > .link, .map .map__list button, .chips button, .chips a, .contact a, .contact-lines a, .table-card .btn { min-height: 44px; }
  .practice__more, .footer li a, .footer__links a, .reels > .link, .contact a, .contact-lines a { display: inline-flex; align-items: center; }
  .calc__row input { height: 44px; }
  select, input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, .pf-city select, .pf-sort select { font-size: max(1rem, 16px); }
}

/* Phones held sideways: little height, so header, hero and menu get compact */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --header-h: 54px; }
  .brand__logo, header .brand__logo { height: 38px; }
  .announce .wrap, .site-global .announce .wrap { min-height: 34px; padding-block: 2px; }
  body:has(.announce:not([hidden])) { --announce-h: 34px; }
  .earth .intake { display: none; }
  .earth .earth__copy, .site-global .earth .earth__copy { padding-top: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; }
  .earth h1 { font-size: 2.1rem; margin-bottom: 8px; }
  .earth h1 span { margin-top: .1em; }
  .earth .lead { font-size: 1rem; line-height: 1.45; margin-bottom: 0; }
  .earth .btn-row { margin-top: 14px; justify-content: center; }
  .earth .btn-row .btn { flex: 0 1 auto; }
  .hero--photo { min-height: 0; padding: 28px 0 32px; }
  .hero--photo h1 { font-size: 2.5rem; max-width: none; }
  .hero--photo .lead { margin-block: 10px 14px; font-size: 1rem; line-height: 1.45; }
  .hero__place { display: none; }
  .lp { padding-top: 14px; }
  .lp .kicker { display: none; }
  .lp h1 { font-size: 2rem; }
  .lp__copy .lead { margin: 10px 0 14px; max-width: none; font-size: 1rem; line-height: 1.45; }
  .pf-hero .pf-panel { padding-block: 20px; }
  .nav.is-open { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-content: start; }
  .nav.is-open > a, .header--wide .nav.is-open > a { min-height: 50px; font-size: 1.15rem; }
  .nav.is-open .nav__extra { grid-column: 1 / -1; margin-top: 0; padding-top: 14px; grid-template-columns: 1fr 1fr; align-items: center; }
  .chat__panel { position: fixed; top: calc(var(--header-h) + 6px); bottom: 8px; left: auto; right: max(12px, env(safe-area-inset-right)); width: min(440px, calc(100vw - 24px)); max-height: none; }
  .chat__launcher[aria-expanded="true"] { visibility: hidden; } /* the panel has its own close button */
  .chat__head { padding-block: 2px; }
  .chat__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
  .chat__chips .chip { flex: none; }
  .chat__form { padding-block: 6px; }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 767px) {
  .earth { min-height: 0; padding-bottom: 22vw; }
  .earth::after { bottom: -193vw; } /* a lower curve, clear of the text */
}

/* Large monitors: text, page width and spacing grow together instead of leaving a thin column in the middle.
   Limited by height too, so short ultrawide screens don't get oversized text. */
@media (min-width: 1600px) {
  html { font-size: clamp(100%, min(6px + .625vw, 2vh), 150%); }
  :root { --wrap: 75rem; --header-h: 4.2rem; }
  .brand__logo { height: 2.9rem; }
  .footer .brand__logo { height: 3.6rem; }
  .btn:not(.btn--sm) { min-height: 3.1rem; padding-inline: 1.5rem; }
  .btn--sm, .chip, .dest { min-height: 2.75rem; }
  .hero--photo { min-height: min(calc(100svh - var(--header-h)), 54rem); }
}

/* While the IMAT hero fills the screen, Ask Ace waits so it doesn't cover the countdown (same as the homepage) */
html.hero-in-view .chat__launcher[aria-expanded="false"] { opacity: 0; visibility: hidden; }

/* Apurv: photos beside the intro on the homepage, and the teacher strip on the IMAT page */
.mentor__photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.mentor__photos img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sheet); }
.coach { display: grid; gap: 24px; align-items: center; margin-top: clamp(24px, 3vw, 40px); padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); }
.coach img { width: 100%; max-width: 20rem; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-card); }
.coach p { max-width: 34em; margin: 10px 0 16px; color: var(--muted); }
@media (min-width: 768px) { .coach { grid-template-columns: 16rem 1fr; gap: clamp(28px, 4vw, 56px); } }
