/*
 * Shared responsive layer.
 * Loaded after each page's original styles so mobile behavior stays consistent.
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  overflow-x: clip;
}

img,
picture,
video,
canvas,
svg {
  max-width: 100%;
}

button,
a,
summary {
  -webkit-tap-highlight-color: rgba(173, 138, 88, 0.18);
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
blockquote,
figcaption {
  overflow-wrap: break-word;
}

@media (max-width: 820px) {
  :root {
    --mobile-gutter: 18px;
  }

  /* Fixed navigation remains readable and tappable on phones. */
  .memory-header {
    height: 64px;
  }

  .memory-header__inner {
    width: calc(100% - 24px);
  }

  .memory-header__brand {
    gap: 8px;
    flex: 0 0 auto;
  }

  .memory-header__brand-mark {
    width: 27px;
  }

  .memory-header__brand-mark::before {
    width: 27px;
  }

  .memory-header__brand-mark::after {
    width: 18px;
  }

  .memory-header__brand-copy {
    display: none;
  }

  .memory-nav {
    gap: clamp(10px, 3vw, 20px);
  }

  .memory-nav__link,
  .memory-nav__trigger {
    min-height: 44px;
    padding: 14px 0 13px;
    font-size: clamp(8px, 2.35vw, 11px);
    letter-spacing: 0.045em;
    white-space: nowrap;
  }

  .memory-nav__link::after,
  .memory-nav__trigger::after {
    bottom: 8px;
  }

  .memory-nav__dropdown {
    top: 64px;
    right: 12px;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100svh - 76px);
    overflow-y: auto;
  }

  .memory-nav__person {
    min-height: 50px;
    font-size: 13px;
  }

  /* Home: shorter first scene and comfortable single-column reading. */
  .hc-hero__wrapper {
    height: 165svh !important;
  }

  .hc-hero__scene {
    min-height: 100svh;
  }

  .hc-hero__intro,
  .hc-hero__main {
    padding-inline: var(--mobile-gutter);
  }

  .hc-hero__intro {
    gap: 14px;
    padding-top: 52px;
  }

  .hc-hero__intro-label {
    font-size: 11px;
    letter-spacing: 3px;
  }

  .hc-hero__intro-line {
    font-size: clamp(34px, 11vw, 52px);
  }

  .hc-hero__main {
    gap: 24px;
    max-width: 560px;
    padding-top: 62px;
  }

  .hc-hero__lead {
    font-size: clamp(20px, 5.9vw, 27px);
    line-height: 1.35;
  }

  .hc-hero__sub {
    font-size: clamp(15px, 4.2vw, 18px);
  }

  .hc-hero__crew {
    gap: 4px;
    padding: 16px 0;
  }

  .hc-hero__name {
    min-height: 38px;
    padding: 8px 10px;
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.45;
  }

  .hc-hero__btn {
    min-height: 48px;
    width: min(100%, 310px);
    padding: 13px 22px;
    font-size: 12px;
  }

  .hc-hero__plane {
    width: 116px;
    top: 30%;
  }

  .hp-crew {
    padding-inline: var(--mobile-gutter);
  }

  .hp-crew__inner {
    padding-top: 250px !important;
  }

  .hp-crew__title {
    font-size: clamp(30px, 8.5vw, 40px);
  }

  .hp-crew__text {
    font-size: 16px;
    line-height: 1.72;
  }

  .hp-chrono,
  .hp-timeline,
  .hp-card,
  .hp-memorial-story,
  .hp-memorial-crew,
  .hp-memorial-quote {
    overflow: clip;
  }

  .hp-chrono__title,
  .hp-timeline__title,
  .hp-card__title,
  .hp-card__conclusion-title {
    text-wrap: balance;
  }

  .hp-chrono__subtitle,
  .hp-c__text,
  .hp-timeline__intro,
  .hp-timeline__event,
  .hp-card__intro,
  .hp-card__crew-desc,
  .hp-card__conclusion-text {
    font-size: 16px;
    line-height: 1.65;
  }

  .hp-c__title {
    font-size: 20px;
  }

  .hp-card__crews {
    grid-template-columns: minmax(0, 1fr);
  }

  .hp-card__crew {
    min-width: 0;
  }

  .hp-card__crew-meta-item {
    align-items: flex-start;
    font-size: 14px;
  }

  .hp-card__map-section {
    overflow: hidden;
  }

  .hp-card__map-frame {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .hp-card__map-svg {
    width: 760px;
    max-width: none;
  }

  .hp-card__map-caption {
    min-width: 100%;
    white-space: normal;
    font-size: 13px;
    line-height: 1.55;
  }

  .hp-memorial-hero {
    min-height: 82svh;
    padding: 84px var(--mobile-gutter) 52px;
  }

  .hp-memorial-hero__eyebrow {
    font-size: 13px;
    letter-spacing: 3px;
  }

  .hp-memorial-hero__title {
    font-size: clamp(30px, 9vw, 44px);
  }

  .hp-memorial-story__inner,
  .hp-memorial-quote__inner {
    width: 100%;
  }

  .hp-memorial-story__line,
  .hp-memorial-story__line:first-child {
    font-size: 18px;
    line-height: 1.68;
  }

  .hp-memorial-story__line--accent {
    font-size: 24px;
  }

  .hp-memorial-crew__photo {
    width: min(100%, 300px);
    height: auto;
    aspect-ratio: 7 / 9;
  }

  .hp-memorial-quote__line,
  .hp-memorial-quote__line:first-child,
  .hp-memorial-quote__line:last-child {
    font-size: clamp(23px, 7vw, 31px);
    line-height: 1.45;
  }

  /* Biography pages. */
  .bio-hero {
    min-height: 760px;
    padding-top: 112px;
    padding-bottom: 54px;
  }

  .bio-hero__portrait {
    top: 64px;
    height: 60%;
  }

  .bio-back {
    top: 82px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .bio-title {
    font-size: clamp(42px, 14vw, 68px);
    line-height: 0.98;
  }

  .bio-hero__role {
    margin-top: 24px;
    font-size: 16px;
    line-height: 1.62;
  }

  .bio-meta {
    gap: 7px;
    margin-top: 26px;
  }

  .bio-meta span {
    padding: 9px 10px;
    font-size: 9px;
    line-height: 1.4;
  }

  .bio-section {
    padding: 72px 0;
  }

  .bio-section__grid,
  .bio-section__copy {
    grid-template-columns: minmax(0, 1fr);
  }

  .bio-section__grid {
    gap: 32px;
  }

  .bio-section__content h2 {
    margin-bottom: 30px;
    font-size: clamp(31px, 9vw, 46px);
    line-height: 1.1;
  }

  .bio-section__copy {
    gap: 22px;
  }

  .bio-section__copy p {
    font-size: 16px;
    line-height: 1.72;
  }

  .bio-quote {
    margin-top: 38px;
    padding: 22px 0 0 20px;
    font-size: 21px;
  }

  .bio-crew-links {
    padding: 62px 0 72px;
  }

  .bio-crew-link {
    min-height: 104px;
    padding: 22px 18px;
  }

  /* Complex biography blocks from the original pages. */
  .hp-bio__container,
  .hp-cadet__inner,
  .hp-math__inner,
  .hp-nav__inner,
  .hp-scene__inner,
  .hp-school__inner,
  .hp-card__inner,
  .hp-text-section__inner,
  .hp-finale__inner {
    width: min(100% - 36px, 1180px) !important;
    max-width: 100% !important;
  }

  .hp-bio__content,
  .hp-cadet__content,
  .hp-math__grid,
  .hp-nav__body,
  .hp-scene__layout,
  .hp-school__hero,
  .hp-school__bottom-row,
  .hp-card__body,
  .hp-card__main,
  .hp-card__images,
  .hp-card__gallery {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .hp-bio__portrait,
  .hp-scene__visual,
  .hp-nav__visual,
  .hp-math__visual,
  .hp-card__photo-wrap,
  .hp-card__images,
  .hp-school__gallery {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .hp-bio__portrait-img,
  .hp-scene__photo-main,
  .hp-nav__image,
  .hp-image-panel__img,
  .hp-card__photo-frame img,
  .hp-school img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
  }

  .hp-bio__title,
  .hp-cadet__title,
  .hp-math__title,
  .hp-nav__title,
  .hp-scene__title,
  .hp-school__title,
  .hp-card__heading,
  .hp-card__title {
    font-size: clamp(30px, 9vw, 46px) !important;
    line-height: 1.12 !important;
  }

  .hp-bio__text,
  .hp-cadet__text,
  .hp-math__text,
  .hp-nav__text,
  .hp-scene__text,
  .hp-school__text,
  .hp-card__text,
  .hp-text-section__paragraph {
    font-size: 16px !important;
    line-height: 1.7 !important;
  }

  /* News. */
  .news-shell {
    width: calc(100% - 36px);
  }

  .news-hero {
    min-height: 430px;
    padding-top: 64px;
  }

  .news-hero__inner {
    min-height: 366px;
    padding: 54px 0;
  }

  .news-hero h1 {
    font-size: clamp(48px, 16vw, 72px);
    line-height: 0.96;
  }

  .news-hero__lead {
    margin-top: 26px;
    font-size: 16px;
  }

  .news-feed {
    padding: 64px 0 76px;
  }

  .news-feed__header h2 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .news-card__body {
    padding: 28px 20px;
  }

  .news-card h3 {
    font-size: clamp(28px, 8.5vw, 38px);
    line-height: 1.12;
  }

  .news-card__summary,
  .news-details__content {
    font-size: 15px;
    line-height: 1.72;
  }

  .news-details summary {
    min-height: 44px;
  }
}

@media (max-width: 540px) {
  .memory-header__inner {
    width: calc(100% - 18px);
  }

  .memory-nav {
    gap: 9px;
  }

  .memory-nav__link,
  .memory-nav__trigger {
    font-size: clamp(7.8px, 2.45vw, 10px);
  }

  .hp-crew__grid {
    grid-template-columns: minmax(0, 1fr) !important;
    max-width: 330px;
    margin-inline: auto;
    gap: 44px;
  }

  .hp-crew__portrait {
    margin-bottom: 18px;
  }

  .hp-crew__name {
    font-size: 20px;
  }

  .hp-crew__role {
    font-size: 12px;
  }

  .hp-timeline__inner {
    padding-inline: var(--mobile-gutter);
  }

  .hp-timeline__track {
    padding-left: 34px;
  }

  .hp-timeline__line,
  .hp-timeline__line-fill {
    left: 7px;
  }

  .hp-timeline__dot {
    left: -34px;
  }

  .hp-timeline__quote {
    padding-left: 18px;
  }

  .hp-card__map-svg {
    width: 680px;
  }

  .hp-card__crew-badge,
  .hp-card__eyebrow,
  .hp-card__conclusion-eyebrow {
    letter-spacing: 0.12em;
  }

  .bio-crew-links__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .bio-crew-link,
  .bio-crew-link:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--bio-line);
  }

  .bio-crew-link:last-child {
    border-bottom: 0;
  }

  .news-card__visual {
    aspect-ratio: 4 / 3;
  }

  .news-card__visual-note {
    right: 16px;
    bottom: 14px;
    left: 16px;
    font-size: 8px;
  }
}

@media (max-width: 360px) {
  .memory-header__brand-mark {
    width: 20px;
  }

  .memory-header__brand-mark::before {
    width: 20px;
  }

  .memory-header__brand-mark::after {
    width: 14px;
  }

  .memory-nav {
    gap: 7px;
  }

  .memory-nav__link,
  .memory-nav__trigger {
    font-size: 7.5px;
    letter-spacing: 0.02em;
  }

  .hc-hero__main {
    gap: 18px;
  }

  .hc-hero__name {
    font-size: 10px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .hc-hero__wrapper {
    height: 210svh !important;
  }

  .hc-hero__scene {
    min-height: 100svh;
  }

  .hc-hero__main {
    gap: 12px;
    transform: scale(0.86);
    transform-origin: center;
  }

  .bio-hero {
    min-height: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
