:root {
  --edge-sage: #cddfd6;
  --elevated: 0 6px 14px rgb(23 59 59 / 7%), 0 24px 46px -26px rgb(23 59 59 / 46%);
  --settle: cubic-bezier(.22, 1, .36, 1);
}

.mobile-menu-button,
.mobile-booking-dock,
.agenda-days {
  display: none;
}

.hero {
  background: radial-gradient(ellipse at 78% 64%, #d1e5db 0%, transparent 62%),
    linear-gradient(160deg, #fbfdfc, #edf5f0);
}

.original-hero {
  position: relative;
  perspective: 800px;
  width: 100%;
}

.edape-hero-scene {
  --depth-progress: .28;
  --depth-aim-x: 0;
  --depth-aim-y: 0;
  position: relative;
}

.edape-hero-scene::before,
.edape-hero-scene::after {
  content: "";
  position: absolute;
  inset: 5% 2% 3%;
  border-radius: 28px;
  pointer-events: none;
}

.edape-hero-scene::before {
  z-index: 0;
  background: linear-gradient(145deg, #71a695, #315f54);
  border: 1px solid #417b69;
  box-shadow: 0 25px 42px -21px rgb(19 60 49 / 65%);
  transform: translate(12px, 18px) rotate(-5deg);
}

.edape-hero-scene::after {
  z-index: 1;
  background: linear-gradient(140deg, #f4faf6, #a9cbbb);
  border: 1px solid #d4e8de;
  transform: translate(-9px, 10px) rotate(4deg);
}

.original-hero img {
  position: relative;
  z-index: 2;
  width: 100%;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 24px;
  box-shadow: 0 28px 42px -23px rgb(23 59 59 / 42%);
}

.bookingpanel,
.edape-site-card {
  box-shadow: var(--elevated);
}

.edape-carousel-position {
  flex: 0 0 auto;
  color: #345a50;
  font-size: .8rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.edape-carousel-button[aria-disabled="true"] {
  background: #f2f6f3;
  border-color: #e1ebe5;
  color: #687e73;
  cursor: default;
}

.edape-photo-carousel > .edape-photo {
  scroll-snap-align: start;
}

.publicslot[aria-pressed="true"]::after {
  content: "✓";
  margin-inline-start: .3em;
}

.edape-request-result:focus-visible,
#publicresult:focus-visible {
  outline: 3px solid #8eb4a7;
  outline-offset: 4px;
}

@media (max-width: 700px) {
  html {
    scroll-padding-top: calc(76px + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgb(253 255 253 / 96%);
    border-bottom: 1px solid #dce8e1;
    box-shadow: 0 4px 18px rgb(23 59 59 / 5%);
  }

  .topinner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "brand menu account";
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding-block: calc(9px + env(safe-area-inset-top, 0px)) 9px;
    padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  }

  .topinner > .brand {
    grid-area: brand;
    gap: 7px;
    min-height: 44px;
    min-width: 0;
  }

  .topinner .brandlogo {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  .topinner .brand small {
    letter-spacing: .16em;
  }

  .topinner .top-actions {
    grid-area: account;
    justify-content: end;
  }

  .topinner .top-actions [data-action="book"] {
    display: none;
  }

  .topinner .top-actions [data-action="login"] {
    min-height: 44px;
    padding: 8px 11px;
    border-radius: 12px;
  }

  .mobile-menu-button {
    grid-area: menu;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: #eef5f0;
    color: #173b3b;
    border: 1px solid #d5e5dc;
    border-radius: 12px;
    cursor: pointer;
  }

  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }

  .mobile-menu-icon {
    position: relative;
  }

  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .mobile-menu-icon::before {
    top: -5px;
  }

  .mobile-menu-icon::after {
    top: 5px;
  }

  .mobile-menu-button[aria-expanded="true"] .mobile-menu-icon {
    background: transparent;
  }

  .mobile-menu-button[aria-expanded="true"] .mobile-menu-icon::before {
    top: 0;
    transform: rotate(45deg);
  }

  .mobile-menu-button[aria-expanded="true"] .mobile-menu-icon::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .topinner .navlinks {
    display: none;
    grid-row: 2;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 8px 0 3px;
    border-top: 1px solid #e2ece6;
  }

  .topinner[data-menu-open] .navlinks {
    display: grid;
  }

  .topinner .navlinks a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f0f6f2;
    color: #214f44;
  }

  .hero {
    padding-block: clamp(29px, 9vw, 47px) clamp(54px, 15vw, 88px);
  }

  .herogrid {
    gap: 28px;
  }

  .hero h1 {
    max-width: 13ch;
    margin-top: 8px;
    font-size: clamp(2.3rem, 10.8vw, 3.65rem);
    line-height: 1.04;
    text-wrap: balance;
  }

  .hero .lead {
    margin-block: 18px 0;
    font-size: clamp(1rem, 4.3vw, 1.15rem);
    line-height: 1.55;
  }

  .hero .actions {
    margin-top: 22px;
    gap: 9px;
  }

  .hero .actions .btn {
    min-height: 46px;
    padding-inline: 13px;
    font-size: .85rem;
  }

  .hero .original-hero {
    justify-self: center;
    width: min(100% - 14px, 450px);
  }

  .bookingsection,
  .section.contact {
    padding-block: 54px;
  }

  .bookingpanel {
    padding: clamp(15px, 4.9vw, 22px);
  }

  .bookingpanel .slotgrid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 76px), 1fr));
  }

  .bookingpanel .slot,
  .bookingpanel .btn[type="submit"],
  .edape-contact-phones a,
  .portal .btn,
  .portal .sidebtn,
  #modal .btn,
  #modal .close {
    min-height: 44px;
  }

  .bookingpanel .field,
  .bookingpanel .selectfield,
  .portal .field,
  .portal .selectfield,
  #modal .field,
  #modal .selectfield {
    min-height: 44px;
    font-size: 16px;
  }

  .bookingpanel .btn[type="submit"] {
    width: 100%;
  }

  .loginbody {
    min-height: calc(100dvh - 66px);
    padding: 30px 16px max(36px, env(safe-area-inset-bottom, 0px));
  }

  .loginbox {
    padding: clamp(20px, 6vw, 30px);
    box-shadow: var(--elevated);
  }

  .rolecard {
    min-height: 64px;
  }

  #modal.modalwrap[open] {
    align-items: flex-end;
    padding: 12px max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  }

  #modal .modalbox {
    max-height: min(720px, calc(100dvh - 36px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    padding: 18px;
  }

  .edape-carousel-button,
  #modal .close {
    width: 44px;
    height: 44px;
  }

  .edape-carousel-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  .edape-carousel-hint {
    flex: 1;
    min-width: 105px;
  }

  .mobile-booking-dock:not([hidden]) {
    position: fixed;
    z-index: 18;
    inset-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px));
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    display: grid;
    max-width: 420px;
    margin-inline: auto;
    padding: 6px;
    background: rgb(249 253 250 / 96%);
    border: 1px solid #d9e7de;
    border-radius: 19px;
    box-shadow: 0 12px 34px -10px rgb(23 59 59 / 45%);
  }

  .mobile-booking-dock .btn {
    min-height: 48px;
    border-radius: 13px;
  }

  .edape-public + .footer {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .agenda-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(44px, 1fr));
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 4px 4px 8px;
    margin-block: 10px;
  }

  .agenda-day-button {
    display: grid;
    gap: 2px;
    place-content: center;
    min-height: 48px;
    padding: 3px;
    border: 1px solid #cdded6;
    border-radius: 10px;
    background: #f6faf7;
    color: #244c43;
    text-align: center;
    cursor: pointer;
  }

  .agenda-day-button span {
    font-size: .76rem;
  }

  .agenda-day-button[aria-current="date"] {
    background: #173b3b;
    color: #fff;
    border-color: #173b3b;
  }
}

@media screen and (prefers-reduced-motion: no-preference) {
  .hero .herogrid > :first-child > :is(.eyebrow, h1, .lead, .actions) {
    animation: edape-hero-copy 590ms var(--settle) var(--entry-delay, 0ms) backwards;
  }

  .hero h1 {
    --entry-delay: 65ms;
  }

  .hero .lead {
    --entry-delay: 135ms;
  }

  .hero .actions {
    --entry-delay: 205ms;
  }

  .hero .herogrid > :first-child > .actions:focus-within {
    animation: none;
  }

  .edape-hero-scene {
    transform-style: preserve-3d;
    transform:
      translateY(calc(9px - 30px * var(--depth-progress)))
      rotateX(calc(11deg - 24deg * var(--depth-progress) - 6deg * var(--depth-aim-y)))
      rotateY(calc(-13deg + 27deg * var(--depth-progress) + 8deg * var(--depth-aim-x)))
      rotateZ(calc(-2deg + 4deg * var(--depth-progress)));
  }

  .edape-hero-scene::before {
    transform:
      translate3d(calc(11px - 31px * var(--depth-progress)), calc(16px + 15px * var(--depth-progress)), -32px)
      rotate(calc(-6deg - 3deg * var(--depth-progress)));
  }

  .edape-hero-scene::after {
    transform:
      translate3d(calc(-10px + 26px * var(--depth-progress)), calc(8px + 9px * var(--depth-progress)), -13px)
      rotate(calc(4deg + 3deg * var(--depth-progress)));
  }

  .edape-hero-scene img {
    transform: translateZ(12px);
    transform-origin: center 72%;
    animation: edape-depth 980ms var(--settle) 110ms backwards;
  }

  #equipo .clinic-portrait img {
    transform: translateY(calc(10px - 20px * var(--depth-progress, .5))) scale(1.1);
  }

  .edape-content-enter {
    animation: edape-section-rise 560ms var(--settle);
  }

  .edape-content-enter.aboutvisual {
    transform-origin: center 75%;
    animation: edape-section-depth 680ms var(--settle);
  }

  .modalwrap[open] .modalbox,
  .edape-request-result {
    animation: edape-rise 240ms var(--settle) both;
  }

  @media (max-width: 700px) {
    .topinner[data-menu-open] .navlinks,
    .mobile-booking-dock:not([hidden]) {
      animation: edape-rise 210ms var(--settle) both;
    }

    .mobile-menu-icon::before,
    .mobile-menu-icon::after {
      transition: transform 190ms var(--settle), top 190ms var(--settle);
    }

    .mobile-menu-button:active,
    .agenda-day-button:active,
    .slot:active,
    .mobile-booking-dock .btn:active {
      transform: translateY(1px) scale(.98);
    }

  }
}

@media screen and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .service {
    transition: transform 240ms var(--settle), box-shadow 240ms var(--settle);
  }

  .service:hover {
    transform: perspective(680px) translateY(-5px) rotateX(3deg);
    box-shadow: var(--elevated);
  }
}

@media (prefers-reduced-motion: reduce) {
  .service,
  .service:hover,
  .edape-photo img {
    transition: none !important;
  }

  .service:hover,
  .edape-photo:hover img {
    transform: none !important;
  }
}

@media (hover: none) {
  .btn:hover {
    transform: none;
  }
}

@keyframes edape-rise {
  from { opacity: .58; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes edape-hero-copy {
  from { opacity: .46; transform: translateY(21px); }
  to { opacity: 1; transform: none; }
}

@keyframes edape-depth {
  0% { opacity: .82; transform: translate3d(0, 19px, 2px) rotateX(12deg) rotateY(-9deg) scale(.96); }
  74% { opacity: 1; transform: translate3d(0, -3px, 19px) rotateX(-1deg) rotateY(1.5deg); }
  100% { opacity: 1; transform: translateZ(12px); }
}

@keyframes edape-section-rise {
  from { opacity: .72; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes edape-section-depth {
  from { opacity: .8; transform: perspective(900px) translateY(18px) rotateX(6deg) scale(.98); }
  to { opacity: 1; transform: none; }
}
