/* ============================================================
   Heritage Douma — shared styles
   Palette drawn from the brand: terracotta logo, cream paper,
   and the three room hues (Tale sage, Whisper clay, Echo blue).
   Type: Fraunces (display) + Karla (body).
   Signature: the arch — the logo mark, repeated as image masks.
   ============================================================ */

:root {
  --cream: #f6ecdd;
  --cream-soft: #efe2cd;
  --sand: #e6d5ba;
  --ink: #382418;
  --ink-soft: #5c4433;
  --clay: #bf5b34;
  --clay-deep: #94421f;
  --clay-dark: #7a3417;

  --tale: #a3b899;
  --tale-deep: #2f3d2b;
  --whisper: #c4714b;
  --whisper-deep: #4d220a;
  --echo: #8ca9be;
  --echo-deep: #243a47;

  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Karla", "Helvetica Neue", sans-serif;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --radius-arch: 999px 999px 0 0;
  --shadow-soft: 0 2px 8px rgba(56, 36, 24, 0.08), 0 12px 32px rgba(56, 36, 24, 0.12);
  --shadow-float: 0 4px 12px rgba(122, 52, 23, 0.25), 0 16px 40px rgba(122, 52, 23, 0.28);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Removes the ~300ms tap delay / double-tap-zoom on touch devices */
a, button { touch-action: manipulation; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

::selection { background: var(--clay); color: var(--cream); }

/* ---------- Type scale ---------- */

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 480;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
@media (max-width: 800px) {
  /* Tight tracking reads fine on one-line desktop headlines, but the
     same headings wrap to 2-3 lines on phones — loosen both so wrapped
     lines don't crowd each other. */
  h1, h2, h3, .display { line-height: 1.2; letter-spacing: -0.01em; }
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.lede { font-size: 1.25rem; line-height: 1.65; }

/* ---------- Layout ---------- */

.wrap { max-width: 74rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); }

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

/* ---------- Skip link & focus ---------- */

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--cream);
  padding: 0.6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246, 236, 221, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(56, 36, 24, 0.1);
}

.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2);
  padding: 0.9rem clamp(1.25rem, 4vw, 2.5rem);
  max-width: 82rem; margin: 0 auto;
}

.brand {
  display: flex; align-items: center; gap: 0.65rem;
  text-decoration: none;
}
.brand-logo {
  height: 54px; width: auto; display: block;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(122, 52, 23, 0.25);
  transition: transform 0.25s var(--ease-spring);
}
.brand:hover .brand-logo { transform: scale(1.05); }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 520; letter-spacing: -0.01em;
  line-height: 1;
}
.brand-name small {
  display: block; font-family: var(--font-body);
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--clay-deep); margin-top: 2px;
}

.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2rem); list-style: none; }
.nav-links a {
  text-decoration: none; font-weight: 500; font-size: 0.95rem;
  color: var(--ink-soft); padding: 0.35rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.25s var(--ease-spring), border-color 0.25s var(--ease-spring);
}
.nav-links a:hover { color: var(--clay-deep); }
.nav-links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--clay); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  text-decoration: none; cursor: pointer;
  border: 2px solid transparent; border-radius: 999px;
  padding: 0.7rem 1.5rem; min-height: 44px;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-spring),
              background-color 0.25s var(--ease-spring), color 0.25s var(--ease-spring);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-clay { background: var(--clay); color: #fff8ee; box-shadow: 0 2px 6px rgba(122, 52, 23, 0.3); }
.btn-clay:hover { background: var(--clay-deep); box-shadow: var(--shadow-float); }

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

.btn-light { background: var(--cream); color: var(--ink); }
.btn-light:hover { background: #fff; }

/* Mobile nav */
.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 8px; color: var(--ink);
}
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--cream);
    border-bottom: 1px solid rgba(56, 36, 24, 0.12);
    box-shadow: var(--shadow-soft);
    display: none; padding: 0.5rem 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: 0.9rem clamp(1.25rem, 4vw, 2.5rem); border-bottom: 0; }
  .nav-links a[aria-current="page"] { background: var(--cream-soft); }
  .nav-cta-desktop { display: none; }
}
@media (min-width: 801px) {
  .nav-links .nav-cta-mobile { display: none; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative; overflow: clip;
  /* padding-top only: subpages put .hero and .wrap on the same element,
     and a padding shorthand here would zero out .wrap's side padding */
  padding-top: clamp(3rem, 8vh, 6rem);
}

.hero-grid {
  display: grid; grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}

.hero-title {
  font-size: clamp(3rem, 8.5vw, 6.8rem);
  font-weight: 440;
}
.hero-title em {
  font-style: italic; font-weight: 400; color: var(--clay-deep);
}

.hero-copy { max-width: 34rem; margin-top: var(--space-3); color: var(--ink-soft); }

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

.arch-img {
  border-radius: var(--radius-arch);
  overflow: hidden; position: relative;
}
.arch-img img { width: 100%; height: 100%; object-fit: cover; }

.hero .arch-img {
  aspect-ratio: 3 / 4;
  max-height: 78vh;
  box-shadow: var(--shadow-soft);
}

/* Scroll-driven hero: arch image swaps as you scroll (home page) */

.hero-scroll {
  /* px cap keeps tall headless render viewports (search engine
     renderers don't scroll) from pushing content out of reach */
  height: min(340vh, 3300px);
  transition: background-color 0.8s ease;
}
.hero-sticky {
  position: sticky; top: 0;
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 1rem;
}
.hero-swap {
  aspect-ratio: 3 / 4;
  max-height: 76vh;
  box-shadow: var(--shadow-soft);
}
@media (max-width: 800px) {
  .hero-swap { max-width: 24rem; width: 100%; margin: 0 auto; max-height: none; }
}
/* Touch devices: don't scroll-pin the hero — swiping through 3+ screens
   of sticky stage reads as a stuck page. JS auto-cycles the images
   instead, so the hero is one normal screen and scrolling moves on. */
@media (hover: none), (pointer: coarse) {
  .hero-scroll { height: auto; }
  .hero-sticky { position: static; min-height: 0; padding-bottom: var(--space-4); }
  /* Finger-swipe: horizontal drags are ours, vertical stays page scroll */
  .hero-swap { touch-action: pan-y; }
  .hero-swap .swap-img.drag { transition: none; }
  .hero-swap .swap-img.settle {
    transition: transform 0.38s var(--ease-spring), opacity 0.38s ease;
  }
}
.hero-swap .swap-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.65s ease, transform 0.9s var(--ease-spring);
}
.hero-swap .swap-img.is-active { opacity: 1; transform: scale(1); }

.swap-caption {
  position: absolute; left: 50%; bottom: 1.1rem; z-index: 2;
  transform: translateX(-50%);
  background: rgba(246, 236, 221, 0.92);
  color: var(--ink);
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  padding: 0.45rem 1.1rem; border-radius: 999px;
  white-space: nowrap;
}
.swap-caption em { font-style: normal; color: var(--clay-deep); }

.hero-progress {
  display: flex; gap: 0.45rem; margin-top: var(--space-3);
}
.hero-progress span {
  width: 26px; height: 5px; border-radius: 999px;
  background: var(--ink); opacity: 0.15;
  transition: opacity 0.4s, background-color 0.4s;
}
.hero-progress span.on { opacity: 1; background: var(--clay); }

.trust-line {
  list-style: none; display: flex; flex-wrap: wrap;
  margin-top: var(--space-3); padding: 0;
  font-size: 0.9rem; font-weight: 700; color: var(--ink-soft);
}
.trust-line li { display: flex; align-items: center; }
.trust-line li + li::before { content: "·"; margin: 0 0.6rem; color: var(--clay); }

.scroll-hint {
  margin-top: var(--space-3);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.scroll-hint svg { animation: hintDrop 1.8s ease-in-out infinite; }
/* No scroll-pinning on touch devices, so the hint would mislead */
@media (hover: none), (pointer: coarse) {
  .scroll-hint { display: none; }
}
@keyframes hintDrop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* Hero title word-by-word entrance */
.hero-title .w {
  display: inline-block;
  opacity: 0; transform: translateY(0.45em);
  animation: wordUp 0.7s var(--ease-spring) forwards;
  animation-delay: calc(var(--i) * 80ms);
}
@keyframes wordUp {
  to { opacity: 1; transform: none; }
}

/* Parallax images: inner img is over-scaled so drift never shows edges.
   Desktop-only: touch devices deliver scroll events too sparsely during
   momentum scrolling, so the drift visibly jumps instead of gliding. */
@media (hover: hover) and (pointer: fine) {
  .plx img { transform: translateY(var(--plx, 0px)) scale(1.12); will-change: transform; }
}

@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero .arch-img { max-width: 26rem; margin: 0 auto; }
}

/* ---------- Room color worlds ---------- */

.world { color: var(--world-deep, var(--ink)); background: var(--world, var(--cream-soft)); }
.world-tale { --world: var(--tale); --world-deep: var(--tale-deep); }
.world-whisper { --world: var(--whisper); --world-deep: var(--whisper-deep); }
.world-echo { --world: var(--echo); --world-deep: var(--echo-deep); }

.world ::selection { background: var(--world-deep); color: #fff; }

/* Room feature section (rooms page) */

.room {
  padding: var(--space-6) 0;
}
.room-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.room-grid.flip .room-media { order: 2; }

.room-media { display: grid; grid-template-columns: 1fr 0.85fr; gap: var(--space-2); align-items: end; }
.room-media .arch-img:first-child { aspect-ratio: 3 / 4; }
.room-media .arch-img:last-child { aspect-ratio: 3 / 4.6; border-radius: 999px; }

.room-title { font-size: clamp(2.6rem, 5.5vw, 4.2rem); margin: 0.5rem 0 1rem; }
.room-desc { max-width: 32rem; }

.amenities {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: var(--space-3);
}
.amenities li {
  font-size: 0.85rem; font-weight: 700;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 1.5px solid currentColor; opacity: 0.9;
}

.room-meta { margin-top: var(--space-3); font-weight: 700; font-size: 0.95rem; }

.room-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }

@media (max-width: 800px) {
  .room-grid { grid-template-columns: 1fr; }
  .room-grid.flip .room-media { order: 0; }
}

/* Room teaser cards (home page) */

.room-cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2.5vw, 2rem);
}
.room-card {
  display: block; text-decoration: none;
  border-radius: var(--radius-arch);
  padding: clamp(1.25rem, 2.5vw, 2rem) clamp(1.25rem, 2.5vw, 2rem) var(--space-4);
  text-align: center;
  background: var(--world); color: var(--world-deep);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s var(--ease-spring);
}
.room-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-soft); }
.room-card .arch-img { aspect-ratio: 3 / 3.6; margin-bottom: var(--space-3); }
.room-card .arch-img img { transition: transform 0.6s var(--ease-spring); }
.room-card:hover .arch-img img { transform: scale(1.04); }
.room-card h3 { font-size: 2rem; }
.room-card p { font-size: 0.95rem; margin-top: 0.4rem; opacity: 0.85; }
.room-card .card-cta {
  display: inline-block; margin-top: var(--space-2);
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase;
  border-bottom: 2px solid currentColor; padding-bottom: 2px;
}

@media (max-width: 800px) {
  .room-cards { grid-template-columns: 1fr; max-width: 24rem; margin: 0 auto; }
}

/* ---------- Rates table ---------- */

.rates-card {
  background: #fffaf1;
  border: 1.5px solid rgba(56, 36, 24, 0.14);
  border-radius: 20px;
  padding: clamp(1.5rem, 3.5vw, 3rem);
  box-shadow: var(--shadow-soft);
}
.rates-table { width: 100%; border-collapse: collapse; margin-top: var(--space-2); }
.rates-table th, .rates-table td {
  text-align: left; padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(56, 36, 24, 0.12);
}
.rates-table th {
  font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft);
}
.rates-table td:not(:first-child) { font-weight: 700; font-variant-numeric: tabular-nums; }
.rates-table tr:last-child td { border-bottom: 0; }
.rates-note { font-size: 0.9rem; color: var(--ink-soft); margin-top: var(--space-2); }

/* ---------- Story / prose blocks ---------- */

.prose p + p { margin-top: 1.2em; }
.prose .lede { color: var(--ink); }

.two-col {
  display: grid; grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.two-col.flip > .arch-img { order: 2; }
.two-col > .arch-img { aspect-ratio: 3 / 4; box-shadow: var(--shadow-soft); }

@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col.flip > .arch-img { order: 0; }
  .two-col > .arch-img { max-width: 26rem; margin: 0 auto; }
}

/* ---------- Divider motif ---------- */

.arch-divider {
  display: flex; justify-content: center; gap: 0.5rem;
  padding: var(--space-4) 0 0;
}
.arch-divider span {
  width: 14px; height: 20px; border-radius: 999px 999px 0 0;
  background: currentColor; opacity: 0.35;
}
.arch-divider span:nth-child(2) { opacity: 0.7; }
.arch-divider span:nth-child(3) { opacity: 1; }

/* ---------- House rules ---------- */

.rules-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-3); margin-top: var(--space-4);
}
.rule h3 { font-size: 1.25rem; margin-bottom: 0.35rem; }
.rule p { font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- Booking form / modal ---------- */

.booking-fab {
  position: fixed; right: 1.25rem; z-index: 90;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-float);
}

.modal {
  position: fixed; inset: 0; z-index: 150;
  display: none; align-items: flex-end; justify-content: center;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(56, 36, 24, 0.55);
  border: 0; cursor: pointer;
}
.modal-panel {
  position: relative; width: min(30rem, 100%);
  max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cream);
  border-radius: 24px 24px 0 0;
  padding: var(--space-4) var(--space-3)
    calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px) {
  .modal { align-items: center; padding: var(--space-3); }
  .modal-panel { border-radius: 24px; padding: var(--space-4); }
}

.modal-close {
  position: absolute; top: 0.9rem; right: 0.9rem;
  width: 44px; height: 44px; border-radius: 999px;
  border: 0; cursor: pointer; background: var(--cream-soft); color: var(--ink);
  font-size: 1.2rem; line-height: 1;
  transition: background-color 0.2s;
}
.modal-close:hover { background: var(--sand); }

.form-grid { display: grid; gap: var(--space-2); margin-top: var(--space-3); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media (max-width: 420px) { .form-row { grid-template-columns: 1fr; } }

.field label {
  display: block; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 0.35rem; color: var(--ink-soft);
}
.field input, .field select {
  width: 100%; min-height: 48px;
  font: inherit; color: var(--ink);
  background: #fffaf1;
  border: 1.5px solid rgba(56, 36, 24, 0.25);
  border-radius: 12px; padding: 0.6rem 0.9rem;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus { border-color: var(--clay); outline: none; }

.wa-hint { font-size: 0.85rem; color: var(--ink-soft); margin-top: var(--space-2); }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink); color: var(--cream);
  padding: var(--space-5) 0 var(--space-3);
  margin-top: var(--space-6);
}
.footer-grid {
  display: grid; grid-template-columns: 1.2fr 1fr 1fr;
  gap: var(--space-4); align-items: start;
}
.footer-brand img { width: 130px; border-radius: 14px; }
.footer-brand p { margin-top: var(--space-2); font-size: 0.95rem; opacity: 0.8; max-width: 22rem; }

.site-footer h3 {
  font-size: 0.8rem; font-family: var(--font-body); font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  opacity: 0.6; margin-bottom: var(--space-2);
}
.footer-list { list-style: none; display: grid; gap: 0.6rem; }
.footer-list a {
  text-decoration: none; opacity: 0.9;
  border-bottom: 1px solid transparent;
  transition: opacity 0.2s, border-color 0.2s;
}
.footer-list a:hover { opacity: 1; border-bottom-color: var(--clay); }

.footer-bottom {
  margin-top: var(--space-5); padding-top: var(--space-3);
  border-top: 1px solid rgba(246, 236, 221, 0.18);
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  justify-content: space-between;
  font-size: 0.85rem; opacity: 0.7;
}

@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* Very tall viewports (headless renderers, e.g. Googlebot at ~9000px)
   never scroll: collapse the scroll-driven hero so no content hides
   below the sticky stage. No real device is this tall. */
@media (min-height: 2000px) {
  .hero-scroll { height: auto !important; }
  .hero-sticky { position: static; min-height: 0; }
}

/* ---------- Reveal animation ----------
   Hidden state only applies when JS is running (html.js) —
   crawlers and no-JS visitors always see full content. */

html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-spring), transform 0.7s var(--ease-spring);
}
html.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .room-card, .room-card .arch-img img { transition: none; }
  .hero-scroll { height: auto; }
  .hero-swap .swap-img { transition: none; transform: none; }
  .hero-title .w { animation: none; opacity: 1; transform: none; }
  .scroll-hint svg { animation: none; }
  .plx img { transform: none; }
}
