/* ============================================================
   CASA AMARA — Design tokens
   Palette: warm limestone / deep espresso ink / olive / brass
   Type: Fraunces (display, used with restraint) + Work Sans (body/UI)
   ============================================================ */
:root {
  --color-bg: #F3EEE3;
  --color-bg-alt: #EAE1CE;
  --color-surface: #FFFFFF;
  --color-ink: #2A2620;
  --color-ink-soft: #5C5548;
  --color-ink-faint: #8A8271;
  --color-accent: #6E7A5B;
  --color-accent-deep: #4A5240;
  --color-gold: #B08D57;
  --color-line: rgba(42, 38, 32, 0.14);
  --color-error: #A6432F;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 2px;
  --radius-md: 3px;
  --container-max: 1180px;
  --space-section: 7rem;

  --shadow-card: 0 1px 2px rgba(42,38,32,0.06), 0 8px 24px rgba(42,38,32,0.08);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  margin: 0 0 0.5em;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 500; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; color: var(--color-ink-soft); }

a { color: inherit; text-decoration: none; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent-deep);
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section { padding: var(--space-section) 0; }

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent-deep);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--color-ink);
  color: var(--color-bg);
  padding: 0.8rem 1.2rem;
  z-index: 1000;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ============================= Buttons ============================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.7rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  min-height: 48px;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-ink);
  color: var(--color-bg);
}
.btn-primary:hover { background: var(--color-accent-deep); }

.btn-ghost {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-line);
}
.btn-ghost:hover { border-color: var(--color-ink); }

.btn-small { padding: 0.7rem 1.3rem; font-size: 0.82rem; min-height: 42px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ============================= Header ============================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(243, 238, 227, 0.9);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-ink);
}
.brand-mark { color: var(--color-accent-deep); display: inline-flex; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}
.main-nav a {
  font-size: 0.9rem;
  color: var(--color-ink-soft);
  position: relative;
  padding-bottom: 4px;
}
.main-nav a:hover { color: var(--color-ink); }

.header-actions { display: flex; align-items: center; gap: 0.8rem; }

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--color-line);
  background: transparent;
  border-radius: var(--radius-sm);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}
.menu-toggle span {
  width: 18px;
  height: 2px;
  background: var(--color-ink);
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-menu {
  border-top: 1px solid var(--color-line);
  background: var(--color-bg);
  padding: 1.2rem 1.5rem 1.8rem;
}
.mobile-menu ul {
  list-style: none;
  margin: 0 0 1.2rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.mobile-menu a { font-size: 1.05rem; }

/* ============================= Hero ============================= */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: flex-end;
  color: #fff;
  overflow: hidden;
  padding-bottom: 6.5rem;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,18,14,0.15) 0%, rgba(20,18,14,0.15) 40%, rgba(20,18,14,0.72) 100%);
}
.hero-content {
  position: relative;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}
.hero .eyebrow { color: #E7DFC9; }
.hero h1 { color: #fff; }
.hero-copy { color: rgba(255,255,255,0.86); max-width: 42ch; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 1rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.5); }
.hero .btn-ghost:hover { border-color: #fff; }

/* Signature element: the stay stub / ticket stub */
.stay-stub {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translate(-50%, 50%);
  width: min(920px, calc(100% - 2rem));
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  padding: 1.1rem 1.4rem;
  z-index: 5;
}
.stub-part { display: flex; flex-direction: column; gap: 0.15rem; text-align: center; }
.stub-label { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-ink-faint); }
.stub-value { font-family: var(--font-display); font-size: 1.4rem; color: var(--color-ink); }
.stub-perf {
  width: 1px;
  height: 34px;
  background-image: radial-gradient(circle, var(--color-line) 1.4px, transparent 1.5px);
  background-size: 1px 10px;
  justify-self: center;
}

/* ============================= Intro ============================= */
.intro-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 4rem;
  align-items: center;
  padding-top: 3.5rem;
}
.intro-media img { border-radius: var(--radius-md); }
.fact-strip {
  list-style: none;
  margin: 2rem 0 0;
  padding: 1.6rem 0 0;
  border-top: 1px solid var(--color-line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem 1rem;
}
.fact-strip li { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; color: var(--color-ink-soft); }
.fact-strip svg { width: 20px; height: 20px; color: var(--color-accent-deep); flex-shrink: 0; }

/* ============================= Gallery ============================= */
.gallery-section .container { margin-bottom: 2.4rem; }
.gallery-grid {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  gap: 0.9rem;
}
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 0;
  padding: 0;
  background: var(--color-bg-alt);
}
.gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item.featured { grid-column: span 2; grid-row: span 2; }
.gallery-item .gallery-cat {
  position: absolute; left: 0.7rem; bottom: 0.7rem;
  background: rgba(20,18,14,0.55);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
}

.lightbox {
  position: fixed; inset: 0;
  background: rgba(16,14,10,0.94);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }

/* Graceful placeholder for missing/broken images (dev/staging without real photos yet).
   Pseudo-elements aren't reliably rendered on broken <img>s across browsers, so this
   sticks to properties that are: background, border, and hiding the alt text/icon. */
img.img-fallback {
  color: transparent; /* hide alt text + broken-image icon */
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, var(--color-surface) 100%);
  border: 1px dashed var(--color-line);
  min-height: 160px;
}
.lightbox-figure { max-width: 90vw; max-height: 84vh; text-align: center; }
.lightbox-figure img { max-height: 78vh; max-width: 88vw; margin: 0 auto; border-radius: var(--radius-sm); }
.lightbox-figure figcaption { color: rgba(255,255,255,0.7); margin-top: 0.8rem; font-size: 0.85rem; }
.lightbox-close {
  position: absolute; top: 1.2rem; right: 1.5rem;
  background: transparent; border: 0; color: #fff; font-size: 2.2rem;
  cursor: pointer; line-height: 1;
}
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.1); border: 0; color: #fff;
  width: 52px; height: 52px; border-radius: 50%; font-size: 1.8rem; cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

/* ============================= Amenities ============================= */
.amenities { background: var(--color-bg-alt); }
.amenity-grid {
  list-style: none;
  margin: 2.4rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.amenity-grid-extra { margin-top: 1rem; }
.amenity-grid[hidden] { display: none; }
.amenity-grid li {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--color-surface);
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-md);
  font-size: 0.94rem;
}
.amenity-grid svg { width: 24px; height: 24px; color: var(--color-accent-deep); flex-shrink: 0; }
#view-all-amenities { margin-top: 1.6rem; }

/* ============================= Booking ============================= */
.booking-section { background: var(--color-ink); color: var(--color-bg); }
.booking-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 4rem;
  align-items: start;
}
.booking-section .eyebrow { color: var(--color-gold); }
.booking-section h2 { color: #fff; }
.booking-section p { color: rgba(243,238,227,0.72); }

.booking-widget {
  background: var(--color-surface);
  color: var(--color-ink);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
  color: var(--color-ink-soft);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-ink);
  min-height: 48px;
}
.field textarea { min-height: 110px; resize: vertical; }
.field .optional { font-weight: 400; color: var(--color-ink-faint); }
.field-error { display: block; color: var(--color-error); font-size: 0.8rem; margin-top: 0.35rem; min-height: 1em; }

.booking-status { margin-top: 1rem; font-size: 0.9rem; min-height: 1.2em; }
.booking-status.is-error { color: var(--color-error); }
.booking-status.is-ok { color: var(--color-accent-deep); }

.price-breakdown { margin-top: 1.4rem; border-top: 1px solid var(--color-line); padding-top: 1.2rem; }
.price-row { display: flex; justify-content: space-between; font-size: 0.92rem; padding: 0.35rem 0; color: var(--color-ink-soft); }
.price-total { font-weight: 700; color: var(--color-ink); font-size: 1.05rem; border-top: 1px solid var(--color-line); margin-top: 0.4rem; padding-top: 0.7rem; }
.price-breakdown .btn { margin-top: 1.2rem; }

/* ============================= Location ============================= */
.location-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 4rem; align-items: center; }
.distance-list { list-style: none; margin: 1.6rem 0 0; padding: 0; }
.distance-list li {
  display: flex; justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-line);
  font-size: 0.94rem;
}
.distance-list li span:last-child { color: var(--color-ink-faint); }
.location-map iframe { width: 100%; height: 380px; border: 0; border-radius: var(--radius-md); }
.map-note { font-size: 0.8rem; color: var(--color-ink-faint); margin-top: 0.7rem; }

/* ============================= Contact ============================= */
.contact-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 4rem; }
.contact-form { background: var(--color-surface); padding: 2rem; border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.hp-field { position: absolute; left: -9999px; }
.form-status { margin-top: 1rem; font-size: 0.9rem; min-height: 1.2em; }
.form-status.is-error { color: var(--color-error); }
.form-status.is-ok { color: var(--color-accent-deep); }

/* ============================= Footer ============================= */
.site-footer { background: var(--color-bg-alt); padding-top: 4rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--color-line);
}
.footer-brand { display: flex; flex-direction: column; gap: 0.7rem; max-width: 30ch; }
.footer-brand .brand-mark { color: var(--color-accent-deep); }
.footer-nav, .footer-legal { display: flex; flex-direction: column; gap: 0.7rem; font-size: 0.9rem; color: var(--color-ink-soft); }
.footer-contact { display: flex; flex-direction: column; gap: 0.7rem; font-size: 0.9rem; color: var(--color-ink-soft); }
.social-links { display: flex; gap: 1rem; margin-top: 0.3rem; }
.footer-bottom-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem 1.5rem;
  font-size: 0.82rem;
  color: var(--color-ink-faint);
}

/* ============================================================
   RESPONSIVE — dedicated behavior per breakpoint, not naive scaling
   ============================================================ */

/* Laptop / small desktop */
@media (max-width: 1200px) {
  .stay-stub { grid-template-columns: repeat(4, 1fr); }
}

/* Tablet / iPad */
@media (max-width: 960px) {
  .main-nav { display: none; }
  .menu-toggle { display: flex; }

  .intro-grid,
  .booking-grid,
  .location-grid,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .intro-media { order: -1; }

  .fact-strip { grid-template-columns: repeat(2, 1fr); }

  .gallery-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 180px; }
  .gallery-item.featured { grid-column: span 2; grid-row: span 2; }

  .amenity-grid { grid-template-columns: repeat(2, 1fr); }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  .hero { min-height: 88vh; padding-bottom: 5.5rem; }
  .stay-stub {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 1rem;
  }
  .stub-perf:nth-child(6) { display: none; }
}

/* Mobile */
@media (max-width: 640px) {
  :root { --space-section: 4.2rem; }

  .section { padding: var(--space-section) 0; }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.7rem; }

  .hero { min-height: 100vh; padding-bottom: 7rem; align-items: flex-end; }
  .hero-content { padding-bottom: 0.5rem; }
  .hero-copy { max-width: 100%; font-size: 1rem; }
  .hero-actions .btn { width: 100%; }
  .hero-actions { flex-direction: column; }

  .stay-stub {
    position: static;
    transform: none;
    width: calc(100% - 2rem);
    margin: -3.5rem auto 0;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 0;
  }
  .stub-perf { display: none; }

  .fact-strip { grid-template-columns: 1fr 1fr; }

  .gallery-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; gap: 0.6rem; }
  .gallery-item.featured { grid-column: span 2; grid-row: span 1; aspect-ratio: 16/10; height: auto; }

  .amenity-grid { grid-template-columns: 1fr; }

  .field-row { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer-bottom-inner { flex-direction: column; gap: 1rem; text-align: center; }

  .lightbox-nav { width: 42px; height: 42px; font-size: 1.4rem; }
  .lightbox-figure img { max-height: 62vh; }

  .booking-widget, .contact-form { padding: 1.4rem; }
}

/* Small mobile */
@media (max-width: 380px) {
  .container { padding: 0 1.1rem; }
  .gallery-grid { padding: 0 1.1rem; }
  h1 { font-size: 2.15rem; }
  .stub-value { font-size: 1.15rem; }
}
