html {
  scroll-padding-top: calc(78px + env(safe-area-inset-top));
}

body {
  max-width: 100%;
  overflow-x: clip;
}

img,
input,
select,
textarea,
button {
  max-width: 100%;
}

#contact,
#service-request {
  scroll-margin-top: calc(78px + env(safe-area-inset-top));
  scroll-margin-bottom: calc(100px + env(safe-area-inset-bottom));
}

@media (max-width: 900px), (max-height: 500px) and (orientation: landscape) {
  .nav {
    z-index: 12;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-inner {
    min-height: 66px;
    flex-wrap: nowrap;
    gap: clamp(6px, 1.6vw, 14px);
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: clamp(5px, 1.6vw, 9px);
    white-space: nowrap;
  }

  .brand-mark-img {
    width: clamp(32px, 9vw, 42px);
    height: clamp(32px, 9vw, 42px);
  }

  .brand-name {
    min-width: 0;
    white-space: nowrap;
    font-size: clamp(10px, 2.75vw, 13px);
    letter-spacing: 0.055em;
  }

  .navlinks {
    display: none !important;
  }

  .actions {
    flex: 0 0 auto;
    min-width: 0;
    gap: 6px;
  }

  .nav .actions .btn-outline {
    display: none !important;
  }

  .nav .actions .btn-orange {
    display: inline-flex !important;
    flex: 0 0 auto;
    min-height: 44px;
    padding-inline: clamp(9px, 2.4vw, 13px);
    font-size: clamp(11px, 2.8vw, 13px);
    white-space: nowrap;
  }

  .menu {
    display: inline-flex !important;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    touch-action: manipulation;
  }

  .nav.nav-open .navlinks {
    position: fixed;
    top: var(--mobile-menu-top, calc(env(safe-area-inset-top) + 72px));
    right: max(12px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    z-index: 20;
    display: flex !important;
    width: min(340px, calc(100vw - 24px));
    max-height: calc(
      100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 16px;
    border: 1px solid #45434a;
    border-radius: 14px;
    background: #17181e;
    box-shadow: 0 18px 40px #0009;
    color: #f1ece2;
    text-align: right;
    -webkit-overflow-scrolling: touch;
  }

  .nav.nav-open .navlinks a {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 4px;
    border-bottom: 1px solid #ffffff18;
    color: #f1ece2;
    text-align: right;
    text-decoration: none;
  }

  .nav.nav-open .navlinks a:last-child {
    border-bottom: 0;
  }
}

@media (min-width: 681px) and (max-width: 900px) {
  .services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .service {
    height: auto;
    min-width: 0;
  }

  .service-photo {
    width: 100%;
    height: auto;
    max-height: 320px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center;
    padding: 0;
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(100% - 28px, 540px);
  }

  .topbar-inner {
    height: auto;
    min-height: 36px;
    justify-content: center;
    padding-block: 5px;
  }

  .topbar-inner strong {
    display: block;
    max-width: 100%;
    font-size: clamp(10px, 2.7vw, 11px);
    letter-spacing: -0.025em;
    line-height: 1.25;
    white-space: nowrap;
  }

  .nav-inner {
    min-height: 64px;
  }

  .brand-mark-img {
    width: clamp(30px, 9vw, 38px);
    height: clamp(30px, 9vw, 38px);
  }

  .brand-name {
    font-size: clamp(10px, 3vw, 12px);
    letter-spacing: 0.045em;
  }

  .nav .actions .btn-orange {
    min-height: 44px;
    padding-inline: clamp(7px, 2vw, 12px);
  }

  .hero-actions,
  .cta {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
  }

  .hero-actions > .btn,
  .cta > .button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 54px;
    justify-content: center;
    padding-inline: 7px;
    font-size: clamp(10.5px, 3.2vw, 13px);
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
  }

  .hero-actions > .btn-outline {
    order: 0;
  }

  .hero-actions > .btn-orange {
    order: 1;
    flex-grow: 1.04;
    min-height: 56px;
    padding-inline: 10px;
    font-size: clamp(11px, 3.4vw, 14px);
    font-weight: 850;
  }

  .cta > .button.secondary {
    flex-grow: 1.04;
    min-height: 54px;
    font-size: clamp(12px, 3.4vw, 14px);
    font-weight: 850;
  }

  .hero-inner > *,
  .service-layout > *,
  .form,
  .request,
  .formgrid,
  .fields {
    min-width: 0;
    max-width: 100%;
  }

  .hero h1,
  .service-intro h1 {
    max-width: 100%;
    font-size: clamp(37px, 10vw, 48px);
    line-height: 1.04;
    overflow-wrap: anywhere;
  }

  .service-intro h1 {
    font-size: clamp(34px, 9vw, 43px);
  }

  .fields,
  .formgrid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .fields .wide,
  .formgrid .wide,
  .fields button,
  .formgrid button,
  .formgrid .btn {
    grid-column: 1 / -1;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .fields button[type="submit"],
  .formgrid button[type="submit"] {
    min-height: 54px;
    width: 100%;
  }

  .notice,
  .formnotice {
    overflow-wrap: anywhere;
    scroll-margin-bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .services {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .service {
    height: auto;
    min-width: 0;
    border-color: rgba(197, 164, 109, 0.5);
    border-radius: 20px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
  }

  .service-photo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
    padding: 0;
    background: #15161b;
  }

  .service-copy {
    padding: 19px 20px 21px;
  }

  .service-copy h3 {
    margin: 0 0 8px;
    color: #f3f0e9;
    font-size: 21px;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .service-copy p {
    margin: 0;
    color: #b5b1a8;
    font-size: 15px;
    line-height: 1.6;
  }

  .service-more {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    padding: 0 15px;
    border: 1px solid rgba(225, 197, 143, 0.55);
    border-radius: 999px;
    background: rgba(197, 164, 109, 0.11);
    color: #e1c58f;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.025em;
  }

  .service-link:focus-visible {
    outline: 3px solid #e1c58f;
    outline-offset: 3px;
  }

  .floating-call {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    z-index: 8;
    display: flex;
    box-shadow: 0 10px 25px #0008;
  }

  .floating-call .btn {
    width: 100%;
    min-height: 52px;
  }

  .footer {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  html.form-interacting .floating-call,
  html.form-call-overlap .floating-call {
    display: none !important;
  }
}

@media (max-width: 390px) {
  .topbar-inner strong {
    font-size: 10px;
    letter-spacing: -0.035em;
  }
}

@media (max-width: 360px) {
  .brand-name {
    font-size: 10px;
    letter-spacing: 0.025em;
  }

  .hero-actions > .btn,
  .cta > .button {
    padding-inline: 5px;
    font-size: 10.5px;
  }

  .hero-actions > .btn-orange,
  .cta > .button.secondary {
    padding-inline: 7px;
    font-size: 11px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .services {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .service {
    height: auto;
    min-width: 0;
  }

  .service-photo {
    width: 100%;
    height: auto;
    max-height: 320px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    padding: 0;
  }

  .service-copy {
    padding: 19px 22px 21px;
  }

  .service-copy h3 {
    font-size: 21px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .service-copy p {
    font-size: 15px;
    line-height: 1.6;
  }

  .service-more {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    margin-top: 15px;
    padding: 0 15px;
    border: 1px solid rgba(225, 197, 143, 0.55);
    border-radius: 999px;
    background: rgba(197, 164, 109, 0.11);
    color: #e1c58f;
    font-size: 14px;
    font-weight: 800;
  }

  .floating-call {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    z-index: 8;
    display: flex;
  }

  .floating-call .btn {
    width: 100%;
    min-height: 46px;
  }

  .footer {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  html.form-interacting .floating-call,
  html.form-call-overlap .floating-call {
    display: none !important;
  }
}

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