/* Use the stable small viewport so browser toolbars do not resize the layout.
   CSS recalculates it on rotation; content can still grow with text zoom. */
.home-page {
  --hero-gutter: max(clamp(20px, 4vw, 64px), calc((100% - var(--container)) / 2));
}

.home-page .site-header {
  position: fixed;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}

.home-page .brand {
  justify-self: start;
}

.home-page .nav-cta {
  justify-self: end;
}

.hero {
  min-height: 100vh;
  min-height: 100svh;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: clamp(20px, 3svh, 36px);
  padding: max(110px, calc(env(safe-area-inset-top) + 92px)) var(--hero-gutter) max(28px, env(safe-area-inset-bottom));
  overflow: clip;
}

.hero-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  min-width: 0;
}

.hero-copy {
  min-width: 0;
  max-width: none;
}

.hero .eyebrow {
  max-width: 100%;
  margin-bottom: clamp(12px, 2svh, 20px);
  font-size: clamp(10px, 0.85vw, 11px);
}

.hero h1 {
  margin-bottom: clamp(14px, 2.5svh, 26px);
  font-size: clamp(48px, min(7.8vw, 10svh), 108px);
  line-height: 1.05;
}

.hero h1 span {
  white-space: normal;
}

.hero-lead {
  margin-bottom: clamp(18px, 3svh, 30px);
  font-size: clamp(16px, min(1.6vw, 2.5svh), 22px);
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

.hero .button {
  width: auto;
  max-width: 100%;
  min-height: 48px;
  padding: 11px 18px;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.hero-media {
  width: min(100%, 460px, calc((100svh - 300px) * 0.8));
  max-width: none;
  padding: 0;
  justify-self: center;
}

.hero-media::before {
  inset: -3% -6% -2% 8%;
}

.hero-media::after {
  top: -16px;
  right: -12px;
  width: clamp(46px, 7svh, 76px);
  height: clamp(46px, 7svh, 76px);
  font-size: clamp(22px, 3.5svh, 32px);
}

.hero-portrait img {
  height: auto;
  aspect-ratio: 4 / 5;
}

.hero-details {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.35fr) minmax(0, 0.7fr);
  align-items: stretch;
  gap: 18px;
  min-width: 0;
}

.hero .approach-card {
  max-width: none;
  margin: 0;
  padding: 14px 16px;
  align-content: center;
}

.hero .approach-card strong {
  font-size: 14px;
}

.hero .quick-facts {
  grid-template-columns: 0.75fr 1fr 1.45fr;
  gap: 10px;
  max-width: none;
  min-width: 0;
}

.hero .quick-facts div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 72px;
  padding: 12px;
  transform: none;
}

.hero .quick-facts dd {
  font-size: 16px;
  overflow-wrap: normal;
}

.hero .availability {
  position: static;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 14px;
  gap: 10px;
}

.hero .availability p {
  font-size: 13px;
}

/* Cards and long labels must also reflow between the named device sizes. */
.home-page :is(.intro-grid, .fit-layout, .method-grid, .service-grid, .contact, .footer-main) > * {
  min-width: 0;
}

.home-page .tag-cloud {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}

/* Keep short facts intact even on the narrowest phone screens. */
@media (max-width: 350px) {
  .hero .quick-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero .quick-facts div:last-child {
    grid-column: 1 / -1;
  }
}

@media (600px < width <= 1000px) {
  .hero-stage {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
    gap: 28px;
  }

  .hero h1 {
    font-size: clamp(46px, 7.8vw, 72px);
  }

  .hero .button {
    font-size: 14px;
    padding-inline: 14px;
  }

  .hero-details {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 14px;
  }

  .hero .availability {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 10px 14px;
  }
}

/* Give the facts a full row before their labels become too narrow. */
@media (600px < width <= 760px) {
  .hero {
    row-gap: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .hero-details {
    gap: 12px;
  }

  .hero .approach-card {
    grid-column: 1;
    grid-row: 1;
    padding: 12px 14px;
  }

  .hero .quick-facts {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .hero .availability {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
  }
}

/* The first screen stays focused on identity, portrait and actions on phones.
   Supporting information follows in normal flow, with no hidden content. */
@media (max-width: 600px), (max-height: 600px), (max-width: 1000px) and (max-height: 760px) {
  .hero {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .hero-stage {
    min-height: 100vh;
    min-height: 100svh;
    padding: max(94px, calc(env(safe-area-inset-top) + 80px)) var(--hero-gutter) max(26px, env(safe-area-inset-bottom));
  }

  .hero-details {
    padding: 20px var(--hero-gutter) 36px;
  }
}

@media (max-width: 600px) {
  .hero-stage {
    grid-template-columns: minmax(0, 1fr) clamp(80px, 26vw, 145px);
    grid-template-rows: repeat(4, auto);
    align-content: center;
    gap: clamp(16px, 3svh, 28px) 16px;
  }

  .hero-copy {
    display: contents;
  }

  .hero .eyebrow {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: start;
    margin: 0;
    font-size: 10px;
  }

  .hero h1 {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    font-size: clamp(34px, 9.8vw, 58px);
    letter-spacing: -0.065em;
  }

  .hero h1 span:last-child {
    width: max-content;
  }

  .hero-lead {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0;
    font-size: clamp(15px, 4.2vw, 19px);
    line-height: 1.5;
  }

  .hero-actions {
    grid-column: 1 / -1;
    grid-row: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .hero .button {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }

  .hero-media {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .hero-media::after {
    top: -15px;
    right: -5px;
    width: 32px;
    height: 32px;
    font-size: 16px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .hero-portrait::before {
    inset: -6px 6px 6px -6px;
    border-width: 2px;
    border-radius: 20px 36px 20px 20px;
  }

  .hero-portrait img {
    border-width: 2px;
    border-radius: 20px 36px 20px 20px;
    box-shadow: 5px 6px 0 var(--ink);
  }

  .hero-details {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .hero .quick-facts div {
    padding: 10px;
  }

  .hero .quick-facts dd {
    font-size: 14px;
  }
}

@media (max-width: 600px) and (max-height: 650px) {
  .hero-stage {
    gap: 14px 12px;
    padding-top: max(88px, calc(env(safe-area-inset-top) + 76px));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .hero .eyebrow {
    padding-block: 6px;
    font-size: 9px;
  }

  .hero-lead {
    font-size: 15px;
    line-height: 1.45;
  }

  .hero .button {
    min-height: 44px;
    padding-block: 9px;
    font-size: 14px;
  }
}

@media (max-width: 600px) and (max-height: 520px) {
  .hero-stage {
    gap: 10px 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Landscape phones and short laptop windows need less vertical decoration. */
@media (width > 600px) and (max-height: 600px) {
  .hero-stage {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 0.65fr);
    gap: 24px;
    padding-top: max(102px, calc(env(safe-area-inset-top) + 84px));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .hero .eyebrow {
    margin-bottom: 8px;
    padding-block: 5px;
    font-size: 9px;
  }

  .hero h1 {
    display: block;
    margin-bottom: 10px;
    font-size: clamp(30px, min(4.4vw, 8svh), 48px);
  }

  .hero h1 span {
    display: inline;
  }

  .hero h1 span + span {
    margin-left: 0.18em;
  }

  .hero-lead {
    margin-bottom: 14px;
    font-size: 15px;
    line-height: 1.4;
  }

  .hero .button {
    min-height: 44px;
    padding: 9px 12px;
    font-size: 14px;
  }

  .hero-media {
    width: min(100%, calc((100svh - 150px) * 0.8));
  }

  .hero-media::after {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}

@media (480px <= width <= 760px) and (max-height: 500px) {
  .hero-stage {
    grid-template-columns: minmax(0, 1fr) 100px;
    grid-template-rows: repeat(4, auto);
    align-content: center;
    gap: 8px 18px;
    padding-top: max(84px, calc(env(safe-area-inset-top) + 76px));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .hero-copy {
    display: contents;
  }

  .hero .eyebrow {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin: 0;
    padding-block: 4px;
  }

  .hero h1 {
    grid-column: 1;
    grid-row: 2;
    display: block;
    margin: 0;
    font-size: 28px;
  }

  .hero h1 span {
    display: inline;
  }

  .hero-lead {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
  }

  .hero-media {
    grid-column: 2;
    grid-row: 1 / 4;
    width: 100%;
  }

  .hero-actions {
    grid-column: 1 / -1;
    grid-row: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero .button {
    padding-inline: 9px;
    font-size: 13px;
  }
}

/* Browser toolbars can leave less than 360px of height in landscape. */
@media (min-width: 480px) and (max-height: 360px) {
  .home-page .site-header {
    top: max(8px, env(safe-area-inset-top));
    padding: 6px 8px;
    border-radius: 18px;
  }

  .home-page :is(.brand, .mobile-menu summary) {
    width: 44px;
    height: 44px;
  }

  .home-page .nav-cta {
    min-height: 44px;
    padding-inline: 14px;
  }

  .home-page .site-nav a {
    min-height: 44px;
    padding-block: 8px;
  }

  .hero-stage {
    padding-top: max(78px, calc(env(safe-area-inset-top) + 70px));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    row-gap: 6px;
  }
}

@media (width > 760px) and (max-height: 360px) {
  .hero-stage {
    grid-template-columns: minmax(0, 1fr) 90px;
    column-gap: 20px;
  }

  .hero-copy {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 16px;
    align-items: center;
  }

  .hero .eyebrow {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin: 0;
    padding-block: 4px;
  }

  .hero h1 {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-size: 28px;
  }

  .hero-lead {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0;
    font-size: 14px;
  }

  .hero-actions {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .hero-media {
    width: 100%;
  }
}
