/* ---------- Design tokens ----------
   Palette anchored to user-specified Astra theme colors:
     --bg #E8F1F7   --text #393C40   --accent #578C9F (also link hover)
*/
:root {
  --bg:        #e8f1f7;   /* user-specified: page background */
  --surface:   #ffffff;
  --surface-2: #d6e4ee;   /* slightly deeper blue for accent bands */
  --text:      #393c40;   /* user-specified: body text */
  --muted:     #6b7785;
  --border:    #c9d5df;
  --accent:    #578c9f;   /* user-specified: link & text hover, kicker, CTA bg */
  --accent-dk: #3d6b7d;   /* darker teal for CTA hover */
  --highlight: #a4e8f6;   /* Astra aqua, used sparingly (kicker over photo, footer links) */
  --warm:      #dec5be;   /* Astra rose-blush, held in reserve */

  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --max-w: 1200px;
  --max-w-narrow: 720px;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent); text-decoration: underline; }
p { margin: 0 0 1em; }

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0 0 0.5em;
  color: var(--text);
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 1.05; }
h2 { font-size: clamp(1.875rem, 4vw, 2.75rem); line-height: 1.15; }
h3 { font-size: 1.4rem; line-height: 1.25; }

.kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}
.muted { color: var(--muted); }
.lede {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.45;
  color: var(--text);
  font-weight: 400;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem var(--gutter);
  background: rgba(232, 241, 247, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.primary-nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;   /* push nav to the right (phone pill removed) */
}
.primary-nav a {
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}
.primary-nav a[aria-current="page"] {
  color: var(--accent);
}
.primary-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.phone {
  margin-left: auto;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
}
.phone:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

@media (max-width: 600px) {
  /* Stack the header on mobile: brand on top, nav centered below */
  .site-header {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem var(--gutter);
  }
  .primary-nav {
    margin-left: 0;       /* override the desktop auto-push-to-right */
    gap: 1.5rem;
    font-size: 0.9rem;
  }
}

/* ---------- Hero ---------- */
/* Home hero: text-above + uncropped 3:2 photo (editorial, like the original draft) */
.hero-text-block {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(2.5rem, 5.8vw, 4.25rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
  text-align: right;
}
.hero-text-block h1 { margin: 0; }

.hero-photo { margin: 0; padding: 0; }
.hero-photo img { width: 100%; height: auto; display: block; }

/* Page hero (used by /house.html only): full-bleed cropped band with overlay text */
.page-hero {
  position: relative;
  height: clamp(280px, 45vh, 420px);
  overflow: hidden;
  background: #1c2b35;
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3rem var(--gutter) 4rem;
  color: #fff;
  background: linear-gradient(to top, rgba(20, 35, 50, 0.7) 0%, rgba(20, 35, 50, 0) 80%);
}
.hero-text .kicker { color: var(--highlight); }
.hero-text h1 {
  color: #fff;
  max-width: 14ch;
  margin-bottom: 1.25rem;
  text-shadow: 0 1px 30px rgba(0,0,0,0.25);
}
.page-hero .hero-text h1 { margin-bottom: 0; }

/* ---------- CTA ---------- */
.cta {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-radius: 4px;
  border: 1px solid var(--accent);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.cta:hover { background: var(--accent-dk); border-color: var(--accent-dk); color: #fff; text-decoration: none; }
.cta-light {
  background: rgba(255,255,255,0.95);
  color: var(--text);
  border-color: rgba(255,255,255,0.95);
}
.cta-light:hover { background: #fff; color: var(--accent); }
.cta-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.cta-ghost:hover { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- Sections ---------- */
section {
  padding: clamp(3rem, 8vw, 6rem) var(--gutter);
}
.intro {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  text-align: center;
}
.intro-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.lifestyle {
  padding: 0;
}
.lifestyle img {
  width: 100%;
  /* Crop 10% off top + 10% off bottom of the 3:2 source = 15:8 visible frame */
  aspect-ratio: 15 / 8;
  object-fit: cover;
  object-position: center;
  display: block;
}

.availability {
  max-width: var(--max-w-narrow);
  margin: 0 auto;
  text-align: center;
}
.availability h2 { margin-bottom: 1rem; }

/* ---------- Calendar (placeholder until Airbnb iCal sync) ---------- */
.cal-row {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  justify-content: center;
  margin-top: clamp(2rem, 4vw, 3rem);
}
/* Let the calendar break out of the .pool-band > * narrow-width constraint */
.pool-band > .cal-row { max-width: 1000px; }

.cal-head {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  text-align: center;
  margin: 0 0 0.85rem;
  color: var(--text);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 40px);
  gap: 3px;
}
.cal-dow {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  padding: 4px 0 10px;
}
.cal-day {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.cal-day.cal-empty { visibility: hidden; }
.cal-day.is-booked {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* On narrower viewports, scale cells down a touch so 3 months still fit */
@media (max-width: 900px) {
  .cal-grid { grid-template-columns: repeat(7, 34px); }
  .cal-day { font-size: 0.85rem; }
  .cal-head { font-size: 1.15rem; }
}

/* white card-band — used to break up the page bg around .availability */
.pool-band {
  max-width: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.pool-band > * { max-width: var(--max-w-narrow); margin-left: auto; margin-right: auto; }

/* Subtle secondary link (e.g. "Or view the listing on Airbnb →") */
.aux {
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.aux a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
.aux a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Stat row — Sleeps / Bedrooms / Pool */
.stat-row {
  display: flex; justify-content: center; gap: 3rem;
  margin-top: 3rem; padding-top: 2rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.stat { text-align: center; }
.stat .num {
  font-family: var(--serif); font-size: 1.6rem; color: var(--accent);
}
.stat small {
  display: block; font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted); margin-top: 0.4rem;
}

/* ---------- Floor plan section ---------- */
.floor-plan-section {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
}
.fp-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.fp-image-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}
.fp-image {
  width: 100%;
  height: auto;
  display: block;
}
.fp-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fp-overlay a {
  pointer-events: auto;
}
.fp-hot {
  fill: rgba(87, 140, 159, 0);
  stroke: rgba(87, 140, 159, 0.22);
  stroke-width: 4;
  stroke-linejoin: round;
  transition: fill 0.18s ease, stroke 0.18s ease, stroke-width 0.18s ease;
  cursor: pointer;
}
.fp-overlay a:hover .fp-hot,
.fp-overlay a:focus .fp-hot {
  fill: rgba(87, 140, 159, 0.16);
  stroke: var(--accent);
  stroke-width: 5;
}

.fp-text { padding-top: 0.5rem; }
.fp-text h2 { margin-bottom: 1rem; }
.fp-text .stat-row {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1.5rem;
  justify-content: center;
  gap: 2rem;
}
.fp-text .aux {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Amenities folded into the right column of the floor plan section */
.fp-amenities {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.fp-amenities .kicker { margin-bottom: 0.75rem; }
.fp-amenities .amenity-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem 1.5rem;
  max-width: none;
}
.fp-amenities .amenity-grid li {
  padding: 0.55rem 0;
  font-size: 0.92rem;
}
@media (max-width: 800px) {
  /* on mobile the floor-plan section stacks, but the 2-col amenities can stay */
  .fp-amenities .amenity-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 440px) {
  .fp-amenities .amenity-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .fp-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .fp-image-wrap { max-width: 500px; }
}

/* ---------- Tour page ---------- */
.section-nav {
  position: sticky;
  /* JS sets --header-h on <html> from the actual rendered header.
     Fallback 64px covers the brief window before JS runs / if JS is disabled. */
  top: var(--header-h, 64px);
  z-index: 40;
  background: rgba(232, 241, 247, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem var(--gutter);
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  font-size: 0.9rem;
}
.section-nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.25rem 0;
}
.section-nav a:hover { color: var(--accent); }
/* Larger gap after the first link ("Map") to set it apart from the room nav */
.section-nav > a:first-child { margin-right: 1.5rem; }

.tour { padding-top: clamp(3rem, 6vw, 5rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.tour-head {
  max-width: var(--max-w-narrow);
  margin: 0 auto clamp(2rem, 4vw, 3.5rem);
  text-align: center;
}
.tour-intro {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Galleries use flex (not grid) so an incomplete final row centers automatically.
   The 4-photo case is special-cased via :has() so 3+1 becomes a 2+2 square.
   See style.css block comment below "Gallery layout rules" for the design intent. */
.gallery {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.gallery figure {
  margin: 0;
  overflow: hidden;
  background: #eee;
  border-radius: 2px;
  aspect-ratio: 3 / 2;
  cursor: zoom-in;
  /* default: 3 per row.  (100% - 2 gaps) / 3 = 33.333% - (2/3)gap.  */
  flex: 0 0 calc(33.3333% - (2rem / 3));
}
.gallery figure:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.gallery figure:hover img { transform: scale(1.03); }

/* --- Gallery layout rules ---
   Rule A (free with flexbox): any incomplete last row centers — 3+2, 3+3+1, etc.
   Rule B (:has): when there are exactly 4 figures, lay out as 2+2 instead of 3+1.
*/
.gallery:has(figure:nth-child(4):last-child) figure {
  flex-basis: calc(50% - 0.5rem);
}

@media (max-width: 900px) {
  .gallery figure { flex-basis: calc(50% - 0.5rem); }   /* 2 per row */
}
@media (max-width: 560px) {
  .gallery { gap: 0.75rem; }
  .gallery figure,
  .gallery:has(figure:nth-child(4):last-child) figure { flex-basis: 100%; }  /* 1 per row */
}

/* alternate section background for visual rhythm */
.tour:nth-of-type(even) {
  background: var(--surface);
}

/* ---------- Lightbox (full-screen viewer for galleries) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 43, 53, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4rem) clamp(3.5rem, 8vw, 6rem);
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.45);
  background: #1c2b35;
  user-select: none;
  cursor: zoom-out;
}

.lb-close, .lb-nav {
  position: absolute;
  z-index: 1001;
  background: transparent;
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.18s ease, background 0.18s ease;
}
.lb-close:hover, .lb-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
.lb-close:focus-visible, .lb-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  opacity: 1;
}

.lb-close { top: 1rem; right: 1rem; }
.lb-prev  { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 0.75rem; top: 50%; transform: translateY(-50%); }

.lb-counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: #d6dde3;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
  .lb-stage { padding: 3rem 0.5rem; }
  .lb-prev  { left: 0; }
  .lb-next  { right: 0; }
}

/* ---------- Amenities ---------- */
.amenities {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.amenity-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem 2rem;
}
.amenity-grid li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}
@media (max-width: 720px) {
  .amenity-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 440px) {
  .amenity-grid { grid-template-columns: 1fr; }
}

/* ---------- Contact methods grid (on /contact.html) ---------- */
.contact {
  padding: clamp(3rem, 8vw, 6rem) var(--gutter);
}
.contact-methods {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.contact-method {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.contact-method:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(87, 140, 159, 0.12);
  text-decoration: none;
}
.cm-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 0.85rem;
  color: var(--accent);
  fill: currentColor;
}
.method-label {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.method-value {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Contact CTA ---------- */
.contact-cta {
  text-align: center;
  background: var(--surface-2);
}
.contact-cta p { color: var(--muted); margin-bottom: 1.5rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: #1c2b35;
  color: #c4d2db;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 2rem;
}
.site-footer .brand { color: #fff; }
.site-footer a { color: var(--highlight); }
.site-footer a:hover { color: #fff; }
.site-footer .muted { color: #7e919e; }
.footer-grid {
  max-width: var(--max-w);
  margin: 0 auto 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.footer-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9bb1bd;
  margin-bottom: 0.75rem;
}
.copyright {
  max-width: var(--max-w);
  margin: 0 auto;
  font-size: 0.8rem;
  color: #7e919e;
  border-top: 1px solid #2c3e4a;
  padding-top: 1.5rem;
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
