/*
 * base.css — shared layout primitives + behaviors used by every skin.
 * Personality (fonts, exact colors, gallery feel) lives in each skin's CSS.
 */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
/* Tighten the long gap between the About block and the gallery (was 2× --section-y). */
.section--about { padding-bottom: clamp(1rem, 3vw, 2rem); }
#gallery { padding-top: clamp(2rem, 4vw, 3rem); }
.eyebrow { font-family: var(--font-body); text-transform: uppercase; letter-spacing: .22em; font-size: .72rem; color: var(--c-accent); font-weight: 600; }
.section-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.8rem, 4vw, 2.9rem); line-height: 1.1; margin: .4rem 0 2rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.5rem; border: 1px solid var(--c-accent); border-radius: var(--radius); background: var(--c-accent); color: var(--c-accent-ink); font-weight: 600; letter-spacing: .02em; text-decoration: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.btn:hover { opacity: .9; }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: var(--c-line); }
.btn--light { background: #fff; color: var(--c-ink); border-color: #fff; }

/* ---------- Nav ---------- */
.nav { position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 50; display: flex; align-items: center; transition: background .35s var(--ease), box-shadow .35s var(--ease), color .35s var(--ease); color: #fff; }
.nav::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.45), rgba(0,0,0,0)); pointer-events: none; transition: opacity .35s var(--ease); }
.nav.is-stuck { background: var(--c-surface); color: var(--c-ink); box-shadow: 0 1px 0 var(--c-line), 0 8px 30px rgba(0,0,0,.06); }
.nav.is-stuck::before { opacity: 0; }
.nav .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; }
.nav__brand { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .01em; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
.nav__links { display: flex; align-items: center; gap: 1.6rem; }
.nav__links a { text-decoration: none; font-size: .9rem; letter-spacing: .03em; opacity: .92; }
.nav__links a:hover { opacity: 1; }
.nav__toggle { display: none; background: none; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; }
/* Collapse to the hamburger earlier — with a long address brand + 4-5 links + the
   "Schedule a showing" button, the inline nav crushed/overflowed on mid widths. */
@media (max-width: 980px) {
  /* Hidden state must clear the top offset too: the menu sits at top:var(--nav-h),
     so translating by only its own height left a white sliver poking out at the top
     (the "white bar above the hero"). Subtract the nav height as well. */
  .nav__links { position: fixed; inset: var(--nav-h) 0 auto 0; flex-direction: column; align-items: flex-start; gap: 0; background: var(--c-surface); color: var(--c-ink); padding: 1rem var(--gutter); box-shadow: 0 12px 30px rgba(0,0,0,.12); transform: translateY(calc(-100% - var(--nav-h))); transition: transform .35s var(--ease); }
  .nav__links.is-open { transform: translateY(0); }
  .nav__links a { width: 100%; padding: .9rem 0; border-bottom: 1px solid var(--c-line); }
  .nav__toggle { display: inline-flex; }
}

/* ---------- Hero ---------- */
.hero { position: relative; height: 100svh; min-height: 560px; display: flex; align-items: flex-end; overflow: hidden; color: #fff; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--c-scrim), rgba(0,0,0,.05) 45%, rgba(0,0,0,.25)); }
/* Ken Burns runs continuously on EVERY hero image (decoupled from visibility),
   so every carousel cover keeps the slow zoom. .is-shown controls opacity only —
   never the transform — so swapping slides can't snap the zoom and "pop". The
   infinite alternate means there's no start/end frame to jump to either. */
.hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.2s var(--ease); animation: kenburns 18s ease-in-out infinite alternate; will-change: opacity, transform; }
.hero__img.is-shown { opacity: 1; }
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@keyframes kenburns { from { transform: scale(1.06); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .hero__img { animation: none; } }
.hero__inner { position: relative; z-index: 2; width: 100%; padding-bottom: clamp(2.5rem, 6vw, 5rem); }
.hero__ribbon { display: inline-block; background: var(--c-ribbon); color: #fff; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; padding: .4rem .7rem; margin-bottom: 1rem; }
.hero__addr { font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 6vw, 4.2rem); line-height: 1.02; margin: 0; text-shadow: 0 2px 30px rgba(0,0,0,.35); }
.hero__sub { font-size: clamp(1rem, 2.5vw, 1.35rem); opacity: .95; margin-top: .5rem; }
.hero__cue { position: absolute; left: 50%; bottom: 1.5rem; translate: -50% 0; z-index: 2; opacity: .85; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.hero__twilight { position: absolute; z-index: 3; top: calc(var(--nav-h) + 1rem); right: var(--gutter); display: inline-flex; gap: .25rem; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: .25rem; }
.hero__twilight button { background: none; border: 0; color: #fff; font-size: .78rem; padding: .35rem .7rem; border-radius: 999px; opacity: .8; }
.hero__twilight button.is-active { background: #fff; color: var(--c-ink); opacity: 1; }

/* ---------- Stat bar ---------- */
.statbar { background: var(--c-surface); border-bottom: 1px solid var(--c-line); }
.statbar .container { display: flex; flex-wrap: wrap; gap: clamp(1rem, 4vw, 3rem); padding-block: 1.25rem; }
.stat { display: flex; flex-direction: column; }
.stat__n { font-family: var(--font-display); font-size: 1.5rem; line-height: 1; }
.stat__l { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--c-ink-soft); margin-top: .35rem; }
.stat--price .stat__n { color: var(--c-accent); }
.stat__was { font-size: .85rem; color: var(--c-ink-soft); text-decoration: line-through; margin-left: .5rem; }

/* ---------- Description + features ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 6vw, 5rem); }
.about__text { font-size: 1.08rem; color: var(--c-ink-soft); }
.about__mls { margin: 1.1rem 0 0; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-soft); }
.features { list-style: none; padding: 0; margin: 0; columns: 1; }
.features li { padding: .65rem 0; border-bottom: 1px solid var(--c-line); font-size: .95rem; }
.features li::before { content: "—"; color: var(--c-accent); margin-right: .6rem; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }

/* ---------- Gallery (justified rows) ---------- */
.gallery__group + .gallery__group { margin-top: 2.5rem; }
.gallery__label { font-size: .8rem; text-transform: uppercase; letter-spacing: .16em; color: var(--c-ink-soft); margin-bottom: .9rem; }
.gallery__rows { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery__rows figure { margin: 0; position: relative; flex: 1 1 320px; aspect-ratio: 3/2; overflow: hidden; background: var(--c-line); cursor: zoom-in; }
.gallery__rows figure.is-wide { flex-basis: 520px; }
.gallery__rows img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.gallery__rows figure:hover img { transform: scale(1.04); }
.gallery__more-wrap { text-align: center; margin-top: 2rem; }
.gallery__hidden { display: none; }
.gallery__hidden.is-shown { display: contents; }

/* Flat gallery layouts (alternatives to grouped-by-room) */
.gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.gallery__grid figure { margin: 0; position: relative; aspect-ratio: 3/2; overflow: hidden; background: var(--c-line); cursor: zoom-in; }
.gallery__grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.gallery__grid figure:hover img { transform: scale(1.04); }
.gallery__masonry { column-width: 300px; column-gap: 10px; }
.gallery__masonry figure { margin: 0 0 10px; position: relative; break-inside: avoid; overflow: hidden; background: var(--c-line); cursor: zoom-in; }
.gallery__masonry img { width: 100%; height: auto; display: block; transition: transform .6s var(--ease); }
.gallery__masonry figure:hover img { transform: scale(1.04); }
/* reveal for flat tiles overrides the grouped display:contents */
.gallery__grid figure.gallery__hidden.is-shown, .gallery__masonry figure.gallery__hidden.is-shown { display: block; }

/* ---------- Generic media sections ---------- */
.embed { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Before/After staging slider ---------- */
.ba { position: relative; aspect-ratio: 3/2; overflow: hidden; user-select: none; border-radius: var(--radius); }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba__after { clip-path: inset(0 0 0 50%); }
.ba__line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.ba__handle { position: absolute; top: 50%; left: 50%; translate: -50% -50%; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); font-size: .9rem; color: var(--c-ink); }
.ba__tag { position: absolute; bottom: .8rem; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; background: rgba(0,0,0,.55); color: #fff; padding: .3rem .6rem; }
.ba__tag--b { left: .8rem; } .ba__tag--a { right: .8rem; }

/* ---------- Map ---------- */
.map { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem,5vw,3rem); align-items: center; }
.map__frame { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--c-line); }
.map__frame iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 760px) { .map { grid-template-columns: 1fr; } }

/* ---------- Agent ---------- */
.agent { display: grid; grid-template-columns: auto 1fr auto; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; background: var(--c-surface); border: 1px solid var(--c-line); padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: var(--radius); }
.agent__photo { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; }
.agent__name { font-family: var(--font-display); font-size: 1.6rem; margin: 0; }
.agent__meta { color: var(--c-ink-soft); font-size: .92rem; }
.agent__bio { margin-top: .6rem; color: var(--c-ink-soft); max-width: 46ch; }
.agent__actions { display: flex; flex-direction: column; gap: .6rem; min-width: 200px; }
@media (max-width: 820px) { .agent { grid-template-columns: 1fr; text-align: left; } .agent__actions { min-width: 0; } }

/* ---------- Footer ---------- */
.foot { padding: 3rem 0; border-top: 1px solid var(--c-line); color: var(--c-ink-soft); font-size: .85rem; }
.foot .container { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.foot__klm { display: flex; gap: 1rem; align-items: center; }
.foot__attr { flex-basis: 100%; order: 3; font-size: .72rem; opacity: .7; } /* MLS source/brokerage attribution line (§I) */

/* ---------- Lead-capture form ---------- */
.leadform { margin-top: 1.5rem; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: clamp(1.25rem, 3vw, 2rem); }
.leadform__title { font-family: var(--font-display); font-weight: 500; font-size: 1.35rem; margin: 0 0 1rem; }
#klm-lead-form { display: grid; gap: .7rem; max-width: 540px; }
#klm-lead-form input, #klm-lead-form textarea { width: 100%; padding: .7rem .85rem; border: 1px solid var(--c-line); border-radius: var(--radius); font: inherit; background: var(--c-bg); color: var(--c-ink); }
#klm-lead-form input:focus, #klm-lead-form textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 0; border-color: var(--c-accent); }
.leadform__consent { display: flex; gap: .5rem; align-items: flex-start; font-size: .82rem; color: var(--c-ink-soft); }
/* Higher specificity than "#klm-lead-form input { width:100% }" — without this the
   checkbox stretches to full width and squeezes the label into one word per line. */
#klm-lead-form .leadform__consent input { flex: 0 0 auto; width: auto; padding: 0; border: 0; background: none; margin-top: .2rem; }
.leadform__hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0; } /* honeypot */
.leadform__msg { margin: .2rem 0 0; font-size: .9rem; min-height: 1.2em; }
.leadform__msg.is-ok { color: var(--c-accent); }
.leadform__msg.is-err { color: var(--c-ribbon); }
/* iOS: 16px inputs prevent focus-zoom (see feedback-ios-input-zoom). */
@media (max-width: 767px) { #klm-lead-form input, #klm-lead-form textarea { font-size: 16px; } }

/* ---------- Sticky / floating CTA ---------- */
.fab { position: fixed; right: clamp(1rem, 4vw, 2rem); bottom: clamp(1rem, 4vw, 2rem); z-index: 40; box-shadow: 0 10px 30px rgba(0,0,0,.22); opacity: 0; transform: translateY(20px); transition: opacity .4s var(--ease), transform .4s var(--ease); }
.fab.is-shown { opacity: 1; transform: translateY(0); }

/* ---------- Lightbox (prototype: minimal; swap for PhotoSwipe when wiring) ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(8,8,7,.94); display: none; align-items: center; justify-content: center; }
.lb.is-open { display: flex; }
.lb img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lb__btn { position: absolute; background: none; border: 0; color: #fff; font-size: 2.2rem; padding: 1rem; opacity: .8; }
.lb__btn:hover { opacity: 1; }
.lb__close { top: .5rem; right: 1rem; }
.lb__prev { left: .5rem; top: 50%; translate: 0 -50%; }
.lb__next { right: .5rem; top: 50%; translate: 0 -50%; }
.lb__cap { position: absolute; bottom: 1.2rem; left: 0; right: 0; text-align: center; color: #fff; font-size: .85rem; opacity: .85; }

/* ---------- Portfolio + agent pages (§C2) ---------- */
.portfolio-head { border-bottom: 1px solid var(--c-line); padding: 1.1rem 0; }
.portfolio-head .container { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.portfolio-head__tag { text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; color: var(--c-ink-soft); }
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: clamp(1rem, 2.5vw, 1.75rem); }
.pcard { display: block; text-decoration: none; color: inherit; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.pcard:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(0,0,0,.10); }
/* Inert card: sold/off-market listing on an agent page — visible but not clickable. */
.pcard--inactive { opacity: .58; cursor: default; filter: grayscale(.35); }
.pcard--inactive:hover { transform: none; box-shadow: none; }
.pcard__img { position: relative; aspect-ratio: 3/2; background: var(--c-line); overflow: hidden; }
.pcard__img img { width: 100%; height: 100%; object-fit: cover; }
.pcard__ribbon { position: absolute; top: .7rem; left: .7rem; background: var(--c-ribbon); color: #fff; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; padding: .3rem .6rem; }
.pcard__body { padding: 1rem 1.1rem 1.2rem; }
.pcard__price { font-family: var(--font-display); font-size: 1.4rem; color: var(--c-accent); line-height: 1; }
.pcard__addr { font-weight: 600; margin-top: .35rem; }
.pcard__meta { color: var(--c-ink-soft); font-size: .85rem; margin-top: .2rem; }
.klm-cta { background: var(--c-surface); border-top: 1px solid var(--c-line); text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.klm-cta h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.5rem, 4vw, 2.4rem); margin: 0 0 1.25rem; }

.agenthero { background: var(--c-accent); background-size: cover; background-position: center; color: #fff; padding: clamp(3rem, 8vw, 6rem) 0; }
.agenthero__inner { display: flex; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; flex-wrap: wrap; }
.agenthero__photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid rgba(255,255,255,.6); }
.agenthero__name { font-family: var(--font-display); font-weight: 500; font-size: clamp(2rem, 5vw, 3.4rem); margin: 0; }
.agenthero__meta { opacity: .9; margin-top: .3rem; }
.agenthero__tagline { font-size: 1.15rem; margin: .7rem 0 0; }
.agenthero__bio { opacity: .92; margin: .6rem 0 0; max-width: 60ch; }
.agent-stats { display: flex; gap: 2rem; margin-top: 1.4rem; }
.agent-stats .stat__n { font-family: var(--font-display); font-size: 1.7rem; line-height: 1; }
.agent-stats .stat__l { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; opacity: .85; margin-top: .3rem; display: block; }
.leadwrap { max-width: 600px; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Dev toolbar (prototype only — not part of any template) ---------- */
.devbar { position: fixed; left: 50%; bottom: 1rem; translate: -50% 0; z-index: 200; display: flex; gap: .4rem; align-items: center; background: #111; color: #fff; padding: .45rem .6rem; border-radius: 999px; font: 600 .75rem var(--font-body); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.devbar span { opacity: .6; margin-right: .2rem; }
.devbar button { background: #2a2a2a; color: #fff; border: 0; border-radius: 999px; padding: .35rem .7rem; }
.devbar button.is-active { background: #fff; color: #111; }
