/* Shared sizing: grids may shrink without pushing the viewport sideways. */
:root {
  --header-height: 100px;
}
html {
  scroll-padding-top: calc(var(--header-height) + 20px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
.header { height: var(--header-height); }
.header, .section, .intro-line, .footer {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.hero-copy { padding-left: max(var(--gutter), env(safe-area-inset-left)); }
.header > *, .section > *, .hero > *, .section-heading > *,
.product-grid > *, .combo-list > div > *, .service-row > div {
  min-width: 0;
}
.brand, .header-book, .menu-toggle { flex-shrink: 0; }
.button { white-space: normal; text-align: left; }
.text-link, .footer a, .intro-line a { min-height: 44px; }
.footer a { display: inline-flex; align-items: center; }
.footer .brand { display: flex; align-items: flex-start; }
.product-title, .hours > div { flex-wrap: wrap; }
.product-title { gap: 4px 16px; }
.hours > div { gap: 8px 24px; }
.hours dd { margin-left: auto; }
.service-row > span { flex-shrink: 0; }
.service-row p, .product-title h3, .location address, dialog p {
  overflow-wrap: anywhere;
}
.service-row p, .product > p, .cut-gallery figcaption { font-size: 14px; }
.hero-location, .hero-photo figcaption, .hero-photo figcaption span { font-size: 13px; }
dialog {
  max-height: 85vh;
  max-height: 85dvh;
  overscroll-behavior: contain;
}
/* Keep these fallbacks before dynamic viewport units for older browsers. */
.map { max-width: 100%; }

@media (min-width: 1600px) {
  .header, .intro-line, .footer {
    padding-inline: max(80px, calc((100vw - 1440px) / 2));
  }
}

@media (max-width: 1100px) {
  :root { --header-height: 84px; }
  .header { gap: 20px; }
  .header nav { gap: 18px; }
  .header nav a { font-size: 14px; }
  .header-book { padding: 12px 16px; gap: 16px; }
  .hero { min-height: 590px; }
  .hero h1 { font-size: clamp(64px, 9vw, 100px); }
  .hero-photo figcaption { display: block; }
  .hero-photo figcaption span { display: block; margin-top: 4px; }
  .section { padding-block: 72px; }
  .section-heading, .services, .location, .faq { gap: 48px; }
  .booking { gap: 64px; }
  .service-row { gap: 14px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-title { display: block; }
  .product-title > span { display: block; margin-top: 4px; }
  .combo-list > div { grid-template-columns: .6fr 1.3fr auto; gap: 20px; }
  .footer-top { gap: 24px; }
}

/* Tablets use the same comfortably sized navigation controls as phones. */
@media (max-width: 960px) {
  :root { --header-height: 76px; }
  .header { gap: 16px; }
  .header-book { margin-left: auto; }
  .menu-toggle { display: none; }
  .menu-ready .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    background: transparent;
  }
  .menu-toggle span {
    height: 1px;
    width: 24px;
    background: var(--ink);
    transition: transform .2s;
  }
  .menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(3.5px) rotate(45deg);
  }
  .menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
  }
  .header.menu-ready nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 16px var(--gutter) 24px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    max-height: calc(100vh - var(--header-height));
    max-height: calc(100dvh - var(--header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .header.menu-ready nav.open { display: flex; flex-direction: column; gap: 4px; }
  .header nav a { font-size: 18px; padding-block: 12px; }
  /* Without JavaScript the navigation remains reachable. */
  .header:not(.menu-ready) { height: auto; flex-wrap: wrap; padding-block: 16px; }
  .header:not(.menu-ready) nav { order: 3; width: 100%; flex-wrap: wrap; gap: 4px 24px; }
  .hero-copy { padding-right: 24px; }
  .section-heading { grid-template-columns: 1fr; gap: 24px; }
  .section-heading > p, .section-heading > div { max-width: 620px; }
  .services { grid-template-columns: 1fr; gap: 40px; }
  .service-intro { position: static; }
  .service-intro h2 { max-width: 600px; }
  .service-intro h2 br { display: none; }
  .service-intro > p { margin: 20px 0 8px; }
  .booking { grid-template-columns: 1fr 1fr; gap: 40px; }
  .booking-copy h2 { font-size: clamp(48px, 7.6vw, 72px); }
  .location, .faq { grid-template-columns: 1fr; gap: 36px; }
  .map { height: 380px; }
  .footer-top { flex-wrap: wrap; }
  .footer-top > .brand { width: 30%; }
  .footer-top > p { flex-basis: 55%; }
}

@media (max-width: 760px) {
  .section { padding-block: 64px; }
  h2 { font-size: clamp(36px, 5.5vw, 44px); }
  .hero h1 { font-size: clamp(54px, 9vw, 68px); }
  .hero-location { max-width: 230px; }
  .hero-bottom p { font-size: 14px; }
  .hero-bottom .button { padding: 14px 16px; gap: 16px; }
  .section-heading { margin-bottom: 36px; }
  .section-heading p { font-size: 15px; }
  .cut-gallery { gap: 12px; }
  .cut-gallery figure:nth-child(2) { padding-top: 28px; }
  .cut-gallery figure:nth-child(3) { padding-top: 56px; }
  .cut-gallery img { aspect-ratio: 3 / 4; }
  .cut-gallery figcaption { font-size: 13px; }
  .combo-heading { display: block; margin-bottom: 28px; }
  .combo-heading p { margin-top: 20px; }
  .combo-list > div { grid-template-columns: 1fr auto; gap: 10px 20px; padding: 24px 0; }
  .combo-list p { grid-column: 1; grid-row: 2; }
  .combo-list .text-link { grid-column: 2; grid-row: 1 / 3; gap: 16px; }
  .products { padding-top: 8px; }
  .product-grid { gap: 32px 16px; }
  .product-title h3 { font-size: 15px; }
  .product-title > span { font-size: 14px; }
  .booking { grid-template-columns: 1fr; gap: 48px; }
  .booking-copy h2 { font-size: clamp(60px, 12vw, 80px); }
  .booking-copy > p:last-child { max-width: 420px; }
  .booking-details h3 { font-size: 34px; }
  .faq h2 { font-size: 40px; }
  .footer-top { gap: 20px 32px; padding-bottom: 32px; }
  .footer-top > p { font-size: 14px; }
  .footer-top > a:not(.brand) { font-size: 14px; }
  .footer-bottom { flex-wrap: wrap; font-size: 12px; gap: 12px 24px; align-items: center; }
  .footer-bottom > span { width: 100%; }
}

@media (max-width: 600px) {
  .brand { font-size: 25px; }
  .brand span { font-size: 9px; letter-spacing: 4.7px; }
  .header-book { font-size: 13px; padding: 10px 14px; min-height: 44px; gap: 12px; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 28px var(--gutter) 36px; }
  .hero-location { max-width: none; }
  .hero h1 { font-size: clamp(64px, 18vw, 100px); line-height: 1; letter-spacing: -.04em; margin-block: 24px; }
  .hero-bottom p { margin-bottom: 20px; }
  .hero-photo { height: clamp(360px, 100vw, 520px); min-height: 0; }
  .hero-photo > img { object-position: center 42%; }
  .hero-photo figcaption { left: 24px; right: 24px; bottom: 24px; }
  .intro-line { font-size: 13px; padding-block: 16px; gap: 16px; flex-wrap: wrap; }
  .intro-line a { gap: 20px; }
  .service-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; gap: 12px; }
  .service-row h3 { font-size: 17px; }
  .service-row p { font-size: 14px; }
  .service-price { font-size: 14px; }
  .combo-list > div { grid-template-columns: 1fr; }
  .combo-list p { grid-column: 1; grid-row: 2; }
  .combo-list .text-link { grid-column: 1; grid-row: 3; justify-self: start; }
  .map { height: 320px; }
  .footer { padding-top: 40px; }
  .footer-top > .brand { width: 100%; }
  .footer-top > p { flex-basis: 100%; }
  dialog { padding: 52px 24px 24px; }
  dialog h2 { font-size: 32px; }
}

@media (max-width: 420px) {
  :root { --gutter: 20px; }
  .header { gap: 8px; }
  .header-book { font-size: 12px; gap: 8px; padding-inline: 12px; }
  .cut-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cut-gallery figure:nth-child(3) { padding-top: 0; grid-column: 1 / 3; width: 65%; justify-self: center; margin-top: 20px; }
  .hero-photo figcaption { left: 20px; right: 20px; bottom: 20px; }
  .hero-photo figcaption span { font-size: 12px; }
  .service-row { gap: 10px; }
  .service-row p { font-size: 13px; }
  .service-row > span:last-child { font-size: 20px; }
}

@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .header-book { font-size: 11px; padding-inline: 10px; }
  .product-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Keep the menu usable on a phone held sideways or under browser zoom. */
@media (max-height: 500px) and (max-width: 960px) {
  :root { --header-height: 64px; }
  .header { padding-block: 0; }
  .header.menu-ready nav.open { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; padding-block: 8px; }
  .header nav a { font-size: 16px; }
  .hero { min-height: 0; }
  .hero-copy { padding-block: 28px; }
}

@media (hover: none) {
  .service-row:hover, .barber:hover { padding-left: 0; }
  .product-image:hover img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *:before, *:after { animation: none !important; transition: none !important; }
  .reveal-pending { opacity: 1; transform: none; }
}
