/* ═══════════════════════════════════════
   OPEN HOUSE — Floating house button
   Markup is generated by assets/open-house.js
   Mobile-first: base styles = phone, @media = larger screens
═══════════════════════════════════════ */
:root {
  --oh-blue-deep:   var(--blue-deep, #1755A8);
  --oh-blue-sky:    var(--blue-sky, #4AACDF);
  --oh-blue-dark:   var(--blue-dark, #0D3D7A);
  --oh-blue-darker: var(--blue-darker, #082B58);
  --oh-amber:       var(--amber, #FFB347);
  --oh-amber-dark:  var(--amber-dark, #E89A2A);
  --oh-text:        var(--text-dark, #0F2744);
  --oh-muted:       var(--text-muted, #4A6A8A);
  --oh-paper:       #FFFDF7;
  --oh-crease:      #E6DFCC;
  --oh-font-display: var(--font-display, 'Playfair Display', Georgia, serif);
  --oh-font-body:    var(--font-body, 'DM Sans', sans-serif);
  --oh-house-size:  104px;
  --oh-door-time:   0.45s;
  --oh-fold-time:   0.42s;
}

/* Zero-height anchor placed right after the hero banner,
   so the house can hang over the banner's bottom edge
   without touching the banner's overflow: hidden. */
.oh-anchor {
  position: relative;
  height: 0;
  z-index: 150;
}

.oh-widget {
  position: absolute;
  right: 16px;
  top: calc(var(--oh-house-size) * -0.62);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ── House button ── */
.oh-house-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  animation: oh-enter 0.7s 0.4s cubic-bezier(.2,.9,.3,1.3) both;
}
.oh-house-btn:focus-visible { outline: 3px solid var(--oh-amber); outline-offset: 6px; border-radius: 16px; }

.oh-house {
  position: relative;
  width: var(--oh-house-size);
  height: var(--oh-house-size);
  perspective: 320px;
  animation: oh-float 3.6s ease-in-out infinite;
  filter: drop-shadow(0 10px 22px rgba(8, 43, 88, 0.35));
  transition: filter 0.3s ease;
}
.oh-house-btn:hover .oh-house,
.oh-widget.is-open .oh-house {
  animation-play-state: paused;
  filter: drop-shadow(0 14px 30px rgba(232, 154, 42, 0.45));
}

/* Soft halo behind the house */
.oh-halo {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(74, 172, 223, 0.55), rgba(23, 85, 168, 0.15) 70%, transparent 72%);
  animation: oh-pulse 3.6s ease-in-out infinite;
}

.oh-house svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.oh-roof    { fill: var(--oh-blue-deep); }
.oh-trim    { fill: none; stroke: var(--oh-blue-darker); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.oh-chimney { fill: var(--oh-blue-dark); }
.oh-walls   { fill: #FFFFFF; }
.oh-doorway { fill: var(--oh-blue-darker); }
.oh-win     { fill: #DDEEFF; stroke: var(--oh-blue-deep); stroke-width: 2; transition: fill 0.3s ease; }
.oh-shadow  { fill: rgba(8, 43, 88, 0.18); }
.oh-house-btn:hover .oh-win,
.oh-widget.is-open .oh-win { fill: #FFE2B0; }

/* Smoke puffs from the chimney */
.oh-smoke { fill: rgba(255, 255, 255, 0.85); animation: oh-smoke 3s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.oh-smoke--2 { animation-delay: 1.5s; }

/* Light inside the doorway (seen when the door opens) */
.oh-light {
  position: absolute;
  left: 41.667%;
  top: 61.667%;
  width: 16.667%;
  height: 28.333%;
  border-radius: 2px 2px 0 0;
  background: radial-gradient(ellipse at 50% 70%, #FFF3D6 0%, var(--oh-amber) 55%, var(--oh-amber-dark) 100%);
  opacity: 0;
  transition: opacity var(--oh-door-time) ease;
}

/* The door — swings open on a hinge (left edge) */
.oh-door {
  position: absolute;
  left: 41.667%;
  top: 61.667%;
  width: 16.667%;
  height: 28.333%;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--oh-blue-sky), #2F8FC6);
  box-shadow: inset 0 0 0 1.5px var(--oh-blue-dark);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--oh-door-time) cubic-bezier(.3,.7,.3,1.2);
}
.oh-door::after { /* knob */
  content: '';
  position: absolute;
  right: 18%;
  top: 52%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--oh-amber);
}
.oh-house-btn:hover .oh-door { transform: rotateY(-38deg); }
.oh-house-btn:hover .oh-light { opacity: 0.85; }
.oh-widget.is-open .oh-door  { transform: rotateY(-105deg); }
.oh-widget.is-open .oh-light { opacity: 1; }

/* Label under the house */
.oh-label {
  margin-top: -4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--oh-blue-darker);
  color: #FFFFFF;
  font-family: var(--oh-font-body);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(8, 43, 88, 0.3);
  transition: background 0.25s ease, color 0.25s ease;
}
.oh-label strong { color: var(--oh-amber); font-weight: 700; }
.oh-house-btn:hover .oh-label { background: var(--oh-amber); color: var(--oh-blue-darker); }
.oh-house-btn:hover .oh-label strong { color: var(--oh-blue-darker); }

/* ── Folded paper ── */
.oh-paper {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  perspective: 900px;
  visibility: hidden;
  transition: visibility 0s linear calc(var(--oh-fold-time) * 3 + 0.1s);
}
.oh-widget.is-open .oh-paper {
  visibility: visible;
  transition-delay: 0s;
}

.oh-panel {
  position: relative;
  background: var(--oh-paper);
  padding: 14px 18px;
  color: var(--oh-text);
  font-family: var(--oh-font-body);
  font-size: 0.88rem;
  line-height: 1.45;
  transform-origin: top center;
  transform: rotateX(-92deg);
  backface-visibility: hidden;
  box-shadow: 0 12px 28px rgba(8, 43, 88, 0.18);
  /* closing: last panel folds first */
  transition: transform var(--oh-fold-time) ease-in;
}
.oh-panel:first-child { border-radius: 10px 10px 0 0; padding-top: 18px; }
.oh-panel:last-child  { border-radius: 0 0 10px 10px; padding-bottom: 18px; }
.oh-panel + .oh-panel { border-top: 1px dashed var(--oh-crease); }
.oh-panel:nth-child(1) { transition-delay: calc(var(--oh-fold-time) * 2); }
.oh-panel:nth-child(2) { transition-delay: var(--oh-fold-time); }
.oh-panel:nth-child(3) { transition-delay: 0s; }

/* shading that fades as each panel flattens */
.oh-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(8, 43, 88, 0.22), rgba(8, 43, 88, 0));
  opacity: 1;
  pointer-events: none;
  transition: opacity var(--oh-fold-time) ease;
  transition-delay: inherit;
}

/* opening: wait for the door, then unfold top → bottom */
.oh-widget.is-open .oh-panel { transform: rotateX(0deg); transition-timing-function: cubic-bezier(.25,.8,.35,1.15); }
.oh-widget.is-open .oh-panel::after { opacity: 0; }
.oh-widget.is-open .oh-panel:nth-child(1) { transition-delay: calc(var(--oh-door-time) - 0.1s); }
.oh-widget.is-open .oh-panel:nth-child(2) { transition-delay: calc(var(--oh-door-time) - 0.1s + var(--oh-fold-time)); }
.oh-widget.is-open .oh-panel:nth-child(3) { transition-delay: calc(var(--oh-door-time) - 0.1s + var(--oh-fold-time) * 2); }

.oh-eyebrow {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oh-amber-dark);
}
.oh-title {
  margin: 2px 0 4px;
  font-family: var(--oh-font-display);
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--oh-blue-deep);
}
.oh-date { margin: 0; font-weight: 600; color: var(--oh-blue-darker); }

.oh-row { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.oh-row + .oh-row { margin-top: 8px; }
.oh-icon { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--oh-blue-deep); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.oh-row span { color: var(--oh-muted); }
.oh-row strong { display: block; color: var(--oh-text); font-weight: 600; }

.oh-actions { display: flex; flex-direction: column; gap: 8px; }
.oh-btn {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--oh-font-body);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.oh-btn--primary { background: var(--oh-blue-deep); color: #FFFFFF; border: 2px solid var(--oh-blue-deep); }
.oh-btn--primary:hover { background: var(--oh-amber); border-color: var(--oh-amber); color: var(--oh-blue-darker); }
.oh-btn--ghost { background: transparent; color: var(--oh-blue-deep); border: 2px solid var(--oh-blue-border, #C2DAF5); }
.oh-btn--ghost:hover { border-color: var(--oh-amber); color: var(--oh-blue-darker); }

.oh-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--oh-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.oh-close:hover { background: #F3EEDF; color: var(--oh-blue-darker); }
.oh-close:focus-visible, .oh-btn:focus-visible { outline: 3px solid var(--oh-amber); outline-offset: 2px; }

/* ── Keyframes ── */
@keyframes oh-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(1.5deg); }
}
@keyframes oh-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.08); opacity: 1; }
}
@keyframes oh-smoke {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translate(6px, -22px) scale(1.4); opacity: 0; }
}
@keyframes oh-enter {
  from { transform: translateY(24px) scale(0.6); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Larger screens ── */
@media (min-width: 768px) {
  :root { --oh-house-size: 128px; }
  .oh-widget { right: 40px; }
  .oh-label { font-size: 0.72rem; padding: 5px 12px; }
  .oh-paper { width: 320px; }
}
@media (min-width: 1200px) {
  .oh-widget { right: 64px; }
}

/* Desktop: floats under the sticky header while scrolling.
   The class is set by assets/open-house.js only at >= 1024px. */
@media (min-width: 1024px) {
  .oh-widget.is-stuck {
    position: fixed;
    top: var(--oh-stuck-top, 100px);
  }
}

/* ── Respect reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
  .oh-house, .oh-halo, .oh-smoke, .oh-house-btn { animation: none; }
  .oh-door, .oh-light, .oh-panel, .oh-panel::after { transition-duration: 0.01s; transition-delay: 0s !important; }
}
