/* ==========================================================================
   7151 Johnston Road — page layout & responsive system.
   The Established Estate design tokens come from the bound DS stylesheets;
   this sheet only adds responsive layout, the media-slot frames, the
   interactive map, lightbox, modal, contact form, sticky CTA, and motion.
   Mobile-first: base rules target small screens, media queries scale up.
   ========================================================================== */

html { scroll-behavior: smooth; overflow-x: hidden; }
body { margin: 0; background: var(--surface-page); }
img { max-width: 100%; display: block; }

/* --- Containers --------------------------------------------------------- */
.ee-container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-inline: var(--gutter);          /* 2rem mobile */
}
.ee-container--wide { max-width: var(--container-wide); }
@media (min-width: 768px) {
  .ee-container { padding-inline: var(--gutter-lg); } /* 4rem desktop */
}

/* --- Sections — calm vertical rhythm ------------------------------------ */
.ee-section {
  padding-block: clamp(4.5rem, 9vw, 8rem);  /* ~72px mobile → 128px desktop */
}
.ee-section--tight { padding-block: clamp(3.5rem, 7vw, 6rem); }
.ee-section--page  { background: var(--surface-page); }
.ee-section--alt   { background: var(--surface-alt); }
.ee-section--deep  { background: var(--surface-deep); }

/* --- Split (two-column editorial) — stacks on mobile -------------------- */
.ee-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 5vw, var(--space-9));
  align-items: center;
}
/* Let grid children shrink below their intrinsic content width (prevents the
   column — and the whole page — from overflowing on narrow screens). */
.ee-split > * { min-width: 0; }
@media (min-width: 900px) {
  .ee-split { grid-template-columns: 1fr 1fr; }
  .ee-split--media-lead    { grid-template-columns: 1.1fr 1fr; }
  .ee-split--text-lead     { grid-template-columns: 1fr 1.1fr; }
  .ee-split--map           { grid-template-columns: 1fr 320px; align-items: start; }
}
/* On mobile, force a media-first or text-first source order where needed */
@media (max-width: 899px) {
  .ee-split--flip-mobile > :first-child { order: 2; }
  .ee-split--flip-mobile > :last-child  { order: 1; }
}

/* --- Card grids --------------------------------------------------------- */
.ee-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 600px) { .ee-grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 600px) { .ee-grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .ee-grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 600px) { .ee-grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .ee-grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* --- Media slots (photo + swappable placeholder) ------------------------ */
.ee-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--rule-strong);
}
/* Fill the frame absolutely so in-flow siblings (caption/scrim) can't shrink it. */
.ee-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* The swappable-asset label chip */
.ee-slot-chip {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 6px 11px;
  background: var(--color-leather);
  color: var(--color-white);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(33,26,20,0.28);
}
.ee-slot-chip--quiet {
  background: rgba(33,26,20,0.5);
  backdrop-filter: blur(2px);
}
.ee-slot-chip--ondeep { background: var(--color-hay); color: var(--color-text); }

/* dashed swap frame for unfinished assets */
.ee-swap {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--rule-strong);
  background:
    repeating-linear-gradient(135deg, rgba(122,78,45,0.035) 0 14px, transparent 14px 28px),
    var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ee-swap--ondeep {
  border-color: var(--color-line-on-dark);
  background:
    repeating-linear-gradient(135deg, rgba(198,161,91,0.05) 0 14px, transparent 14px 28px),
    rgba(255,253,248,0.02);
}
.ee-swap__note {
  font-family: var(--font-body);
  font-size: var(--type-detail);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  max-width: 34ch;
  text-align: center;
}

/* --- Navigation --------------------------------------------------------- */
.ee-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(242,233,220,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.ee-nav__row {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 13px;
}
.ee-nav__links { display: none; align-items: center; gap: var(--space-7); }
.ee-nav__link {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); text-decoration: none;
  transition: color var(--dur-fast) var(--ease-estate);
}
.ee-nav__link:hover { color: var(--text-accent); }
.ee-nav__cta--desktop { display: none; }
.ee-nav__cta--mobile  { display: inline-flex; }
@media (min-width: 1024px) {
  .ee-nav__links { display: flex; }
  .ee-nav__cta--desktop { display: inline-flex; }
  .ee-nav__cta--mobile  { display: none; }
}

/* --- Sticky mobile CTA -------------------------------------------------- */
.ee-sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: rgba(242,233,220,0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
  transform: translateY(110%);
  transition: transform var(--dur-base) var(--ease-estate);
}
.ee-sticky-cta.is-visible { transform: translateY(0); }
.ee-sticky-cta a { width: 100%; }
@media (min-width: 1024px) { .ee-sticky-cta { display: none; } }

/* --- Lived-moments gallery --------------------------------------------- */
.ee-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 46vw;
  gap: var(--space-3);
}
.ee-gallery__cell { cursor: pointer; }
.ee-gallery__cell.span-2 { grid-column: span 2; }
@media (min-width: 720px) {
  .ee-gallery { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 210px; }
  .ee-gallery__cell.tall { grid-row: span 2; }
  .ee-gallery__cell.wide { grid-column: span 2; }
  .ee-gallery__cell.big  { grid-column: span 2; grid-row: span 2; }
  .ee-gallery__cell.span-2 { grid-column: span 2; }
}

/* --- Estate map --------------------------------------------------------- */
.ee-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  background: linear-gradient(160deg, #d8cdb8, #c2b095);
}
.ee-map__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ee-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;            /* large tap target */
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; cursor: pointer;
  z-index: 2;
}
.ee-pin__dot {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--color-leather); color: var(--color-white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  box-shadow: 0 1px 4px rgba(33,26,20,0.32);
  transition: transform var(--dur-fast) var(--ease-estate),
              background var(--dur-fast) var(--ease-estate);
}
.ee-pin:hover .ee-pin__dot,
.ee-pin:focus-visible .ee-pin__dot,
.ee-pin.is-active .ee-pin__dot {
  transform: scale(1.18);
  background: var(--accent-hover);
}
.ee-pin.is-active .ee-pin__dot { box-shadow: 0 0 0 4px rgba(122,78,45,0.22); }
.ee-pin__card {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  width: max-content; max-width: 200px;
  background: var(--color-white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 10px 12px;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-estate);
  z-index: 5;
}
.ee-pin.is-active .ee-pin__card { opacity: 1; visibility: visible; }
.ee-pin__card-label {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-primary);
}
.ee-pin__card-detail {
  font-family: var(--font-body); font-size: 12.5px;
  color: var(--text-muted); margin-top: 3px; line-height: 1.4;
}
.ee-legend-item {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; background: none; border: 0; width: 100%; text-align: left;
  transition: background var(--dur-fast) var(--ease-estate);
}
.ee-legend-item:hover, .ee-legend-item.is-active { background: var(--accent-tint); }
.ee-legend-item__num {
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  color: var(--color-leather); min-width: 1.6em;
}
.ee-legend-item__label {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Modal & lightbox --------------------------------------------------- */
.ee-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(33,26,20,0.78);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--gutter);
  opacity: 0; animation: ee-fade var(--dur-base) var(--ease-estate) forwards;
}
@keyframes ee-fade { to { opacity: 1; } }
.ee-modal {
  position: relative;
  width: 100%; max-width: 980px;
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.ee-overlay__close {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(33,26,20,0.55); color: var(--color-white);
  border: 0; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-estate);
}
.ee-overlay__close:hover { background: rgba(33,26,20,0.8); }
.ee-lightbox__img {
  width: 100%; max-height: 84vh; object-fit: contain; border-radius: var(--radius-md);
}
.ee-lightbox__caption {
  margin-top: var(--space-4); text-align: center;
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: rgba(255,253,248,0.78);
}
.ee-lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 999px;
  background: rgba(255,253,248,0.12); color: var(--color-white);
  border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease-estate);
}
.ee-lightbox__nav:hover { background: rgba(255,253,248,0.24); }

/* --- Contact form ------------------------------------------------------- */
.ee-field { display: flex; flex-direction: column; gap: 7px; }
.ee-field label {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: rgba(255,253,248,0.66);
}
.ee-input, .ee-textarea {
  font-family: var(--font-body); font-size: 15px;
  color: var(--color-white);
  background: rgba(255,253,248,0.05);
  border: 1px solid var(--rule-on-deep);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-estate),
              background var(--dur-fast) var(--ease-estate);
}
.ee-textarea { resize: vertical; min-height: 104px; line-height: 1.5; }
.ee-input::placeholder, .ee-textarea::placeholder { color: rgba(255,253,248,0.34); }
.ee-input:focus, .ee-textarea:focus {
  outline: none; border-color: var(--color-hay);
  background: rgba(255,253,248,0.08);
}
.ee-input.is-error, .ee-textarea.is-error { border-color: #b9744f; }
.ee-field__error {
  font-family: var(--font-body); font-size: 12px; color: #d79a78;
}

/* --- Scroll reveal ------------------------------------------------------ */
.ee-reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-estate),
              transform var(--dur-slow) var(--ease-estate);
  will-change: opacity, transform;
}
.ee-reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .ee-reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* --- Footer ------------------------------------------------------------- */
@media (min-width: 760px) {
  .ee-footer-grid { grid-template-columns: 1.4fr 1fr 1fr !important; }
}

/* --- small utilities ---------------------------------------------------- */
.ee-stack-sm > * + * { margin-top: var(--space-4); }
.ee-note {
  font-family: var(--font-body); font-size: var(--type-detail);
  color: var(--text-muted); letter-spacing: 0.01em;
}

/* --- Estate System Map (interactive, src/estate-map.jsx) ---------------- */
/* The framed watercolor map. Aspect ratio is set inline from the image's
   native px so markers (left:x% top:y%) track the illustration at any width. */
.ee-emap { width: 100%; background: linear-gradient(160deg, #e6dcc8, #d2c2a6); }
.ee-emap > img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* gentle pulse so the legend↔marker link reads when a row is active */
.ee-emap .ee-pin.is-active .ee-pin__dot { box-shadow: 0 0 0 4px rgba(122,78,45,0.24); }

/* legend rhythm */
.ee-emap-legend { margin-top: var(--space-2); }
.ee-emap-legend li + li { margin-top: 2px; }

/* Hover / focus preview card — one at a time, fades in, anchored to trigger. */
.ee-emap-preview {
  position: fixed; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  animation: ee-preview-in var(--dur-base) var(--ease-estate) forwards;
}
@keyframes ee-preview-in { to { opacity: 1; transform: none; } }
.ee-emap-preview__media { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--surface-alt); }
.ee-emap-preview__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ee-emap-preview__meta {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding: 10px 12px 11px;
}
.ee-emap-preview__num {
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  color: var(--color-leather);
}
.ee-emap-preview__label {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--text-primary);
}
/* on touch the card pins to the bottom of the viewport, full-ish width */
.ee-emap-preview--touch {
  left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); top: auto;
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(4px);
  flex-direction: row; align-items: stretch;
}
.ee-emap-preview--touch .ee-emap-preview__media { width: 96px; aspect-ratio: 1 / 1; flex: 0 0 auto; }
.ee-emap-preview--touch .ee-emap-preview__meta { align-items: center; }

/* Deep scrim variant for the gallery lightbox (warm charred-walnut ~88%). */
.ee-overlay--deep { background: rgba(33,26,20,0.88); }
.ee-emap-lightbox {
  position: relative;
  width: 100%; max-width: 1040px;
  display: flex; flex-direction: column; align-items: center;
}
.ee-emap-lightbox__figure { margin: 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
.ee-emap-lightbox__count { color: rgba(255,253,248,0.5); }

@media (prefers-reduced-motion: reduce) {
  .ee-emap-preview { animation: none; opacity: 1; transform: none; }
}

/* --- Lived-Moments cell as a real button ------------------------------- */
.ee-gallery__cell {
  padding: 0; border: 0; background: none; display: block;
  width: 100%; height: 100%; text-align: inherit;
}
.ee-gallery__cell > .ee-frame { height: 100%; }

/* --- Interiors gallery (src/sections-b.jsx) ---------------------------- */
.ee-igrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
@media (min-width: 720px)  { .ee-igrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1080px) { .ee-igrid { grid-template-columns: repeat(4, 1fr); } }
.ee-igrid__cell {
  position: relative; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--radius-md); overflow: hidden;
  aspect-ratio: 4 / 3; background: var(--surface-page);
  box-shadow: inset 0 0 0 1px var(--rule);
  transition: box-shadow var(--dur-base) var(--ease-estate);
}
.ee-igrid__cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform var(--dur-slow) var(--ease-estate);
}
.ee-igrid__cell:hover img, .ee-igrid__cell:focus-visible img { transform: scale(1.04); }
.ee-igrid__cell:hover, .ee-igrid__cell:focus-visible { box-shadow: var(--shadow-md); }
@media (prefers-reduced-motion: reduce) { .ee-igrid__cell img { transition: none; } }

/* --- Floor-plan slider (deep panel, src/sections-a.jsx) ---------------- */
.ee-fpg { display: flex; flex-direction: column; gap: var(--space-4); }
.ee-fpg__viewport { position: relative; overflow: hidden; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.ee-fpg__track { display: flex; transition: transform var(--dur-slow) var(--ease-estate); }
@media (prefers-reduced-motion: reduce) { .ee-fpg__track { transition: none; } }
.ee-fpg__slide {
  flex: 0 0 100%; padding: 0; border: 0; cursor: zoom-in;
  background: var(--surface-card); aspect-ratio: 4 / 3;
  position: relative; display: block;
}
.ee-fpg__slide img { width: 100%; height: 100%; object-fit: contain; display: block; padding: clamp(8px, 2.5%, 22px); }
.ee-fpg__zoom {
  position: absolute; bottom: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(33,26,20,0.55); color: var(--color-white);
  opacity: 0; transition: opacity var(--dur-fast) var(--ease-estate);
}
.ee-fpg__slide:hover .ee-fpg__zoom, .ee-fpg__slide:focus-visible .ee-fpg__zoom { opacity: 1; }
.ee-fpg__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-leather); color: var(--color-white);
  border: 1px solid rgba(255,253,248,0.3); cursor: pointer; z-index: 2;
  box-shadow: var(--shadow-md);
  transition: background var(--dur-fast) var(--ease-estate);
}
.ee-fpg__arrow:hover { background: var(--accent-hover); }
.ee-fpg__arrow--prev { left: 10px; }
.ee-fpg__arrow--next { right: 10px; }
.ee-fpg__foot { display: flex; align-items: center; justify-content: space-between; }
.ee-fpg__label {
  font-family: var(--font-body); font-size: 11px; font-weight: 600;
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--color-hay);
}
.ee-fpg__dots { display: flex; gap: 8px; }
.ee-fpg__dot {
  width: 8px; height: 8px; border-radius: 999px; padding: 0; cursor: pointer;
  background: rgba(255,253,248,0.28); border: 0;
  transition: background var(--dur-fast) var(--ease-estate), transform var(--dur-fast) var(--ease-estate);
}
.ee-fpg__dot.is-active { background: var(--color-hay); transform: scale(1.25); }

/* --- Shared gallery lightbox (generic, src/common.jsx) ----------------- */
.ee-lightbox {
  position: relative; width: 100%; max-width: 1040px;
  display: flex; flex-direction: column; align-items: center;
}
.ee-lightbox__figure { margin: 0; width: 100%; display: flex; flex-direction: column; align-items: center; }
.ee-lightbox__figure--card { background: var(--surface-card); border-radius: var(--radius-md); padding: clamp(10px, 2vw, 22px); }
.ee-lightbox__figure--card .ee-lightbox__caption,
.ee-lightbox__figure--card .ee-lightbox__count { color: var(--text-muted); }
.ee-lightbox__count { color: rgba(255,253,248,0.5); }
.ee-note--deep { color: var(--text-on-deep-muted); }
