/* Motion is progressive: content stays visible until the script is ready. */
:root {
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
}

html {
  scroll-padding-top: 104px;
}

.skip-link {
  z-index: 100;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  isolation: isolate;
  background: rgb(246 245 239 / 97%);
  transition: background-color 350ms ease, box-shadow 350ms ease,
    border-color 350ms ease;
}

.header.is-scrolled {
  background: rgb(246 245 239 / 91%);
  border-bottom-color: rgb(38 60 50 / 13%);
  box-shadow: 0 8px 26px rgb(26 45 32 / 5%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.scroll-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.header .brand img {
  transition: transform 450ms var(--motion-ease);
}

.header .brand:focus-visible img {
  transform: rotate(-7deg);
}

.desktop-nav a::after {
  transition: transform 350ms var(--motion-ease);
}

.desktop-nav a:focus-visible::after {
  transform: scaleX(1);
}

.mobile-navigation a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.header-contact {
  transition: color 250ms ease, border-color 250ms ease;
}

.header-contact span,
.button span,
.text-link span,
.mobile-navigation a > span {
  display: inline-block;
  transition: transform 350ms var(--motion-ease);
}

.header-contact:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.header-contact:focus-visible span,
.button:focus-visible span,
.text-link:focus-visible span {
  transform: translate(3px, -3px);
}

.text-link[href^="#"]:focus-visible span {
  transform: translateY(4px);
}

.circle-arrow {
  transition: background-color 300ms ease, color 300ms ease,
    border-color 300ms ease, transform 400ms var(--motion-ease);
}

.focus-row:focus-visible .circle-arrow {
  background: var(--forest);
  color: var(--paper);
  border-color: var(--forest);
  transform: rotate(45deg);
}

.motion-ready [data-motion] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 650ms var(--motion-ease) var(--motion-delay, 0ms),
    transform 650ms var(--motion-ease) var(--motion-delay, 0ms);
}

.motion-ready [data-motion].is-visible,
.motion-ready [data-motion]:focus-within {
  opacity: 1;
  transform: none;
}

.motion-ready [data-motion]:focus-within {
  transition-delay: 0ms;
  transition-duration: 0ms;
}

.motion-ready .status-dot {
  animation: status-arrive 2200ms ease-out 400ms 2;
}

.contact-phone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 29px;
}

.contact-phone .phone-number {
  font: 35px/1.2 var(--serif);
  letter-spacing: -.025em;
}

.phone-actions {
  display: flex;
  gap: 12px;
}

.phone-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--forest);
  font-size: 15px;
  transition: background 200ms ease, color 200ms ease;
}

.phone-actions a:first-child {
  background: var(--forest);
  color: var(--paper);
}

.phone-actions a:hover {
  background: #34533d;
  color: var(--paper);
}

.footer-address .footer-phone {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 17px;
  width: fit-content;
  margin-top: 9px;
}

.footer-address .footer-text {
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mobile-navigation .mobile-call {
  color: var(--accent);
}

/* A quiet compass back to the start; the ring follows reading progress. */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: max(26px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: var(--forest);
  color: var(--paper);
  box-shadow: 0 4px 18px rgb(20 39 28 / 17%);
  animation: top-arrive 400ms var(--motion-ease) both;
  transition: background 200ms ease, box-shadow 250ms ease;
}

.back-to-top svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.back-to-top circle,
.top-arrow {
  fill: none;
  stroke-width: 1.5;
}

.top-track {
  stroke: rgb(246 245 239 / 22%);
}

.top-progress {
  stroke: #e3a583;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 28px 28px;
}

.top-arrow {
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 350ms var(--motion-ease);
}

.back-to-top-label {
  position: absolute;
  right: calc(100% + 12px);
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
  border-radius: 3px;
  box-shadow: 0 3px 12px rgb(20 39 28 / 6%);
  opacity: 0;
  transform: translateX(5px);
  transition: opacity 180ms ease, transform 250ms var(--motion-ease);
  pointer-events: none;
}

.back-to-top:is(:hover, :focus-visible) {
  background: #34533d;
  box-shadow: 0 5px 22px rgb(20 39 28 / 24%);
}

.back-to-top:is(:hover, :focus-visible) .top-arrow {
  transform: translateY(-3px);
}

.back-to-top:is(:hover, :focus-visible) .back-to-top-label {
  opacity: 1;
  transform: none;
}

.footer-bottom {
  padding-bottom: 95px;
}

@keyframes top-arrive {
  from { opacity: 0; transform: translateY(12px) scale(.94); }
  to { opacity: 1; transform: none; }
}

@keyframes status-arrive {
  0% { box-shadow: 0 0 0 0 rgb(196 84 45 / 28%); }
  65%, 100% { box-shadow: 0 0 0 7px rgb(196 84 45 / 0%); }
}

@keyframes menu-arrive {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) and (pointer: fine) {
  .header .brand:hover img {
    transform: rotate(-7deg);
  }

  .header-contact:hover {
    color: var(--accent);
    border-color: var(--accent);
  }

  .header-contact:hover span,
  .button:hover span,
  .text-link:hover span,
  .mobile-navigation a:hover > span {
    transform: translate(3px, -3px);
  }

  .text-link[href^="#"]:hover span {
    transform: translateY(4px);
  }

  .focus-row:hover .circle-arrow {
    border-color: var(--forest);
    transform: rotate(45deg);
  }
}

@media (max-width: 900px) {
  html {
    scroll-padding-top: 94px;
  }

  .menu-lines {
    position: relative;
    border: 0;
  }

  .menu-lines::before,
  .menu-lines::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 1px;
    background: currentColor;
    transform-origin: center;
    transition: transform 300ms var(--motion-ease);
  }

  .menu-lines::before {
    top: 0;
  }

  .menu-lines::after {
    bottom: 0;
  }

  .menu-toggle[aria-expanded="true"] .menu-lines::before {
    transform: translateY(5px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .menu-lines::after {
    transform: translateY(-5px) rotate(-45deg);
  }

  .motion-ready .mobile-navigation:not([hidden]) {
    animation: menu-arrive 300ms var(--motion-ease) both;
  }

  .mobile-navigation {
    max-height: calc(100dvh - 73px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 600px) {
  html {
    scroll-padding-top: 90px;
  }

  .contact-phone {
    font-size: 18px;
  }

  .mobile-navigation {
    max-height: calc(100dvh - 69px);
  }

  .back-to-top {
    width: 51px;
    height: 51px;
    right: 17px;
    bottom: max(19px, env(safe-area-inset-bottom));
  }

  .footer-bottom {
    padding-bottom: 28px;
    padding-right: 64px;
  }

  .footer-bottom > a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  .footer-address .footer-phone {
    gap: 6px 8px;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .motion-ready [data-motion],
  .motion-ready [data-motion].is-visible {
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-progress {
    display: none;
  }

  .header .brand img,
  .header-contact span,
  .button,
  .button span,
  .text-link span,
  .circle-arrow,
  .mobile-navigation,
  .mobile-navigation a > span,
  .image-frame img {
    transform: none !important;
  }

  .back-to-top,
  .top-arrow,
  .back-to-top-label {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}
