/* Girassolli Verón — brand palette from the identity manual: #233447, #00604c, #8cebca. */
:root {
  --bg: #f2f6f4;
  --surface: #ffffff;
  --tint: #e3f1eb;
  --tint-strong: #cfe9de;
  --ink: #1c2b39;
  --navy: #233447;
  --green: #00604c;
  --green-dark: #004a3b;
  --petrol: #033c4e;
  --petrol-deep: #022a39;
  --mint: #8cebca;
  --mint-light: #b2f2db;
  --muted: #4a5b61;
  --line: #d5e1dc;
  --on-dark: #e8f3ef;
  --on-dark-muted: #b4cdd0;

  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-lead: clamp(1.06rem, 1rem + .3vw, 1.2rem);
  --text-h1: clamp(2.5rem, 1.5rem + 4.2vw, 4.75rem);
  --text-h2: clamp(2rem, 1.45rem + 2.3vw, 3.25rem);

  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 10px;
  --shadow: 0 8px 24px rgb(0 0 0 / .06);
  --shadow-sm: 0 2px 8px rgb(0 0 0 / .06);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --max: 1240px;
  --header-h: 76px;

  --z-float: 30;
  --z-header: 40;
  --z-skip: 100;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { color: var(--ink); text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--mint); color: var(--petrol-deep); }
:focus-visible { outline: 2.5px solid var(--green); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(calc(100% - 48px), var(--max)); margin-inline: auto; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  z-index: var(--z-skip);
  top: -80px;
  left: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color .2s, color .2s, border-color .2s;
}
/* One rule for the main button, like the two logo versions in the brand manual:
   green on light backgrounds, mint on the dark panels. Hover only changes the colour. */
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-mint { background: var(--mint); color: var(--petrol-deep); }
.btn-mint:hover { background: var(--mint-light); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-block: 8px;
  color: var(--green);
  font-weight: 600;
  font-size: .95rem;
}
.text-link--light { color: #fff; text-decoration: underline; text-decoration-color: rgb(255 255 255 / .4); text-underline-offset: 6px; text-decoration-thickness: 1.5px; transition: text-decoration-color .25s; }
.text-link--light:hover { text-decoration-color: var(--mint); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgb(242 246 244 / .86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.site-header.is-scrolled { border-color: var(--line); box-shadow: var(--shadow-sm); }
.header-inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; flex: none; text-decoration: none; }
.brand-logo {
  height: clamp(34px, 4vw, 40px);
  width: auto;
  max-width: 220px;
  display: block;
  object-fit: contain;
}
.site-nav { display: flex; align-items: center; gap: 4px; font-size: .95rem; font-weight: 600; }
.site-nav > a:not(.btn) { position: relative; padding: 8px 16px; border-radius: 8px; transition: color .2s, background-color .2s; }
.site-nav > a:not(.btn):hover { background: var(--tint); color: var(--green); }
.site-nav > a[aria-current="location"] { color: var(--green); background: var(--tint); }
.nav-cta { margin-left: 8px; min-height: 44px; padding-inline: 20px; }
.menu-toggle { display: none; }

/* ---------- Hero ---------- */
.hero { padding-top: 12px; }
.hero-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  min-height: clamp(520px, 64vh, 640px);
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--petrol);
  color: var(--on-dark);
}
.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  padding: clamp(40px, 5vw, 72px);
}
.hero h1 { color: #fff; font-size: var(--text-h1); font-weight: 600; line-height: 1.04; letter-spacing: -.03em; max-width: 12ch; }
.hero-lead { max-width: 37ch; margin-top: 24px; color: var(--on-dark-muted); font-size: var(--text-lead); line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 32px; }
.hero-photo { position: relative; min-height: 100%; }
/* The photo is anchored bottom-right and wider than its column, so the whole frame shows;
   its petrol backdrop fades into the panel at the top and left edges. */
.hero-photo img {
  position: absolute;
  right: 0;
  bottom: 0;
  width: calc(100% + 100px);
  max-width: none;
  height: auto;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 4%), linear-gradient(to bottom, transparent 0, #000 14%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 4%), linear-gradient(to bottom, transparent 0, #000 14%);
  mask-composite: intersect;
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(72px, 8vw, 112px) clamp(80px, 9vw, 128px); }
.section h2 { font-size: var(--text-h2); font-weight: 600; line-height: 1.08; letter-spacing: -.025em; }
.section-head { margin-bottom: clamp(28px, 3.5vw, 44px); }

/* ---------- Services ---------- */
.services { padding-top: clamp(80px, 9vw, 120px); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(24px, 2.6vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.tile-num {
  font-size: .85rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .06em;
}
.tile h3 { font-size: clamp(1.2rem, 1.1rem + .4vw, 1.4rem); font-weight: 600; line-height: 1.25; }
.tile p { max-width: 42ch; color: var(--muted); }

/* ---------- Studies ---------- */
.studies-layout {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: clamp(40px, 6vw, 96px);
}
.studies-intro { position: sticky; top: calc(var(--header-h) + 28px); }
.studies-intro > p { margin-top: 16px; color: var(--muted); font-size: var(--text-lead); }
.studies-intro .studies-note { margin-top: 24px; color: var(--muted); font-size: .95rem; line-height: 1.55; }
.study-list { display: grid; gap: 12px; }
.study { border-radius: var(--r-md); background: var(--surface); box-shadow: 0 1px 0 var(--line); transition: box-shadow .35s var(--ease); }
.study[open] { box-shadow: var(--shadow); }
.study summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 16px 24px;
  border-radius: var(--r-md);
  cursor: pointer;
  list-style: none;
}
.study summary::-webkit-details-marker { display: none; }
.study h3 { min-width: 0; overflow-wrap: anywhere; font-size: clamp(1.12rem, 1rem + .5vw, 1.35rem); font-weight: 600; transition: color .2s; }
.study summary:hover h3, .study[open] h3 { color: var(--green); }
.study-time {
  color: var(--green);
  background: var(--tint);
  font-size: .85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.study-toggle { position: relative; width: 32px; height: 32px; border: 1.5px solid var(--line); border-radius: 50%; transition: transform .35s var(--ease), background-color .25s, border-color .25s; }
.study-toggle::before, .study-toggle::after { content: ''; position: absolute; top: 50%; left: 50%; width: 12px; height: 1.8px; border-radius: 2px; background: var(--green); transform: translate(-50%, -50%); }
.study-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.study[open] .study-toggle { transform: rotate(45deg); border-color: var(--green); background: var(--green); }
.study[open] .study-toggle::before, .study[open] .study-toggle::after { background: #fff; }
.study-body { max-width: 64ch; padding: 0 24px 24px; animation: study-enter .3s var(--ease); }
.study-body > p { color: var(--muted); }
.study-body > .study-label { margin: 20px 0 8px; color: var(--ink); font-size: .95rem; font-weight: 600; }
.study-body ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.study-body li { position: relative; padding-left: 22px; line-height: 1.5; }
.study-body li::before { content: ''; position: absolute; top: .62em; left: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
@keyframes study-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Team ---------- */
.team { padding-top: clamp(48px, 6vw, 80px); }
.doctors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 64px); align-items: start; }
.doctor-photo { overflow: hidden; aspect-ratio: 5 / 5.6; border-radius: var(--r-xl); background: var(--tint); box-shadow: var(--shadow-sm); }
.doctor-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.doctor h3 { margin-top: 24px; font-size: clamp(1.35rem, 1.2rem + .6vw, 1.7rem); font-weight: 600; }
.doctor p { margin-top: 4px; color: var(--muted); }
.doctor .doctor-license { margin-top: 6px; color: var(--muted); font-size: .88rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Consultorio ---------- */
.place-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: center; gap: clamp(40px, 6vw, 88px); }
.place-copy > p { margin-top: 16px; color: var(--muted); font-size: var(--text-lead); }
.place address { margin: 24px 0 16px; font-style: normal; font-size: 1.05rem; font-weight: 500; line-height: 1.55; color: var(--ink); }
.place-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 16px;
  height: clamp(440px, 46vw, 600px);
}
.place-gallery figure { overflow: hidden; border-radius: var(--r-lg); background: var(--tint); }
.place-gallery img { width: 100%; height: 100%; object-fit: cover; }
.photo-open { position: relative; grid-row: span 2; overflow: hidden; padding: 0; border: 0; border-radius: var(--r-lg); background: var(--tint); cursor: zoom-in; }
.photo-expand {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: rgb(255 255 255 / .92);
  color: var(--green);
  font-size: .85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: background-color .2s;
}
.photo-open:hover .photo-expand { background: #fff; }

/* ---------- Contact CTA (100% width) ---------- */
.section.cta {
  width: 100%;
  padding-block: clamp(60px, 7vw, 92px);
  background: var(--petrol);
  color: var(--on-dark);
  border-top: 1px solid rgb(255 255 255 / .08);
}
.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px clamp(40px, 6vw, 96px);
}
.cta h2 { color: #fff; }
.cta-copy > p { max-width: 52ch; margin-top: 16px; color: var(--on-dark-muted); font-size: var(--text-lead); }
.cta-btn { flex-shrink: 0; padding-inline: 28px; font-size: 1rem; }
.cta :focus-visible, .hero-panel :focus-visible { outline-color: var(--mint); }

/* ---------- Footer ---------- */
.site-footer { overflow: hidden; padding-top: 24px; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, 1.2fr); gap: 32px 48px; padding-bottom: 36px; border-bottom: 1px solid var(--line); }
.footer-brand img { width: 220px; }
.footer-nav { display: grid; align-content: start; gap: 2px; }
.footer-nav a { justify-self: start; padding-block: 4px; font-weight: 600; transition: color .2s; }
.footer-nav a:hover { color: var(--green); }
.footer-contact p { color: var(--muted); font-size: .95rem; }
.footer-contact .text-link { margin-top: 10px; }
.footer-bottom { padding-block: 24px; color: var(--muted); font-size: .88rem; }

/* ---------- Floating mobile CTA & dialog ---------- */
.mobile-appointment { display: none; }
.photo-dialog { width: min(94vw, 720px); max-height: 94dvh; padding: 16px; border: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); overflow: auto; }
.photo-dialog::backdrop { background: rgb(2 42 57 / .78); backdrop-filter: blur(6px); }
.photo-dialog[open] { animation: dialog-enter .3s var(--ease); }
.photo-dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; font-weight: 600; }
.photo-close { min-height: 40px; padding: 8px 16px; border: 0; border-radius: var(--r-sm); background: var(--green); color: #fff; font-weight: 600; cursor: pointer; transition: background-color .2s; }
.photo-close:hover { background: var(--green-dark); }
.photo-dialog > img { width: 100%; height: min(70dvh, 760px); object-fit: contain; border-radius: var(--r-md); background: var(--tint); }
body.photo-is-open { overflow: hidden; }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Motion (only when JS enables it and the user allows motion) ----------
   One entrance on load for the hero, and a short fade for section titles on scroll. */
.motion-enabled .hero-copy, .motion-enabled .hero-photo { animation: fade .5s var(--ease) both; }
.will-reveal { opacity: 0; transform: translateY(8px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.will-reveal.is-revealed { opacity: 1; transform: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
/* Below the container's full width (1240px + gutters) the bleeding photo would slide under the
   hero copy, so it stays inside its own column. */
@media (max-width: 1299px) and (min-width: 761px) {
  .hero-photo img { width: 100%; }
}

/* Tablets: a side-by-side hero would crop one of the doctors, so it stacks like on mobile. */
@media (max-width: 1100px) and (min-width: 761px) {
  .hero-panel { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 48px 48px 28px; }
  .hero h1 { max-width: none; }
  .hero-photo { aspect-ratio: 16 / 9; min-height: 0; }
  .hero-photo img {
    inset: 0;
    height: 100%;
    object-fit: cover;
    object-position: 50% 35%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 18%);
  }
}

@media (max-width: 900px) and (min-width: 761px) {
  .site-nav { gap: 2px; font-size: .9rem; }
  .site-nav > a:not(.btn) { padding-inline: 12px; }
  .nav-cta { margin-left: 4px; padding-inline: 16px; }
}

@media (max-width: 760px) {
  :root { --header-h: 66px; }
  /* h2 drops below 40px here, so no negative tracking. */
  .section h2 { letter-spacing: 0; }
  .wrap { width: min(calc(100% - 32px), var(--max)); }
  .brand-logo { height: 30px; max-width: 170px; }

  .menu-toggle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
  .menu-toggle span { display: block; width: 22px; height: 2px; border-radius: 2px; background: var(--navy); transition: transform .25s var(--ease); }
  .menu-toggle.is-open span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-toggle.is-open span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .site-nav {
    position: absolute;
    top: calc(var(--header-h) - 4px);
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity .25s, transform .35s var(--ease), visibility .25s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
  .site-nav > a:not(.btn) { padding: 12px 16px; border-radius: 8px; }
  .nav-cta { margin: 8px 0 0; }

  .hero { padding-top: 6px; }
  .hero-panel { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 36px 24px 28px; }
  .hero-photo { aspect-ratio: 4 / 3; min-height: 0; }
  .hero-photo img { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%); }

  .studies-layout, .place-layout { grid-template-columns: 1fr; }
  .studies-intro { position: static; }
  .study-body { padding-inline: 20px; }
  .study summary { padding-left: 20px; }

  .place-gallery { height: clamp(360px, 100vw, 480px); }
  .cta-inner { flex-direction: column; align-items: stretch; gap: 24px; }
  .cta-btn { width: 100%; justify-content: center; }
  .footer-top { grid-template-columns: 1fr; }

  .mobile-appointment {
    position: fixed;
    z-index: var(--z-float);
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity .3s, transform .3s var(--ease), visibility .3s, background-color .2s;
  }
  .mobile-appointment.is-visible { opacity: 1; visibility: visible; transform: none; }
}

@media (max-width: 560px) {
  .doctors { grid-template-columns: 1fr; gap: 48px; }
  .doctor:nth-child(2) { margin-top: 0; }
  .study summary { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .study-time { grid-row: 2; justify-self: start; }
  .study-toggle { grid-row: 1 / 3; grid-column: 2; }
  .place-gallery { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr); }
  .photo-open { grid-row: auto; grid-column: 1 / -1; }
}

@media (hover: none) {
  .study:not([open]) summary:hover h3 { color: inherit; }
}

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