/* ───────────── DOOR BAR — sticky door navigation ───────────── */
:root {
  --db-wall: #F3F0EA;
  --db-trim: #FFFFFF;
  --db-ink: #161616;
  --db-accent: #B08D57;
  --db-room-top: #4A4036;
  --db-room-bot: #1E1A16;
  --db-header-h: var(--site-header-h, 64px);   /* set --site-header-h in css/style.css */
  --db-door-w: 52px;
  --db-door-h: 88px;
}

.doorbar {
  position: sticky;
  top: var(--db-header-h);
  z-index: 40;
  background: rgba(243, 240, 234, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,.06);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.doorbar__inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; justify-content: center; gap: clamp(14px, 2.6vw, 40px);
  padding: 12px clamp(16px, 4vw, 40px) 10px;
}

/* One door */
.db-door {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-decoration: none; color: var(--db-ink);
  flex: 0 0 auto; outline-offset: 4px;
  -webkit-tap-highlight-color: transparent;
}
.db-frame {
  position: relative; display: block;
  width: var(--db-door-w); height: var(--db-door-h);
  perspective: 260px;
  /* casing */
  box-shadow: 0 0 0 4px var(--db-trim), 0 0 0 5px rgba(0,0,0,.06), 0 6px 14px rgba(0,0,0,.08);
  background: linear-gradient(180deg, var(--db-room-top), var(--db-room-bot));
}
.db-frame::after { /* light spilling from the room */
  content: ''; position: absolute; inset: auto 0 0 0; height: 40%;
  background: radial-gradient(ellipse at 50% 100%, rgba(255,214,150,.35), transparent 70%);
  opacity: 0; transition: opacity .5s;
}
.db-leaf {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #FFFFFF, #F4F2EE);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.07);
  transform-origin: left center;
  transition: transform .55s cubic-bezier(.3,.7,.2,1), box-shadow .55s;
  backface-visibility: hidden;
}
.db-knob { /* lever handle */
  position: absolute; right: 7px; top: 52%; width: 9px; height: 2.5px; border-radius: 2px;
  background: #1a1a1a; box-shadow: 3px 1px 0 -1px #1a1a1a;
}
.db-label {
  font: 600 11px/1.2 'Inter', system-ui, sans-serif; letter-spacing: .02em;
  text-align: center; max-width: 92px; color: rgba(22,22,22,.75);
  transition: color .3s;
}
.db-label small { display: block; font-weight: 500; font-size: 10px; color: rgba(22,22,22,.5); }

/* ── Door styles ── */
/* Hollow-core: plain flush slab, light */
.db-door[data-door="hollow"] .db-leaf { background: linear-gradient(180deg, #FFFFFF, #F7F6F3); }

/* Solid-core: flush, heavier — thicker edge and shadow */
.db-door[data-door="solid"] .db-leaf {
  background: linear-gradient(180deg, #F8F7F4, #ECE9E3);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1), inset -3px 0 0 rgba(0,0,0,.06);
}
.db-door[data-door="solid"] .db-leaf::before { /* subtle "quiet" lines */
  content: ''; position: absolute; left: 50%; top: 18%; width: 14px; height: 14px; margin-left: -7px;
  border: 1.5px solid rgba(176,141,87,.55); border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(176,141,87,.15);
}

/* Shaker: 2-panel */
.db-door[data-door="shaker"] .db-leaf::before,
.db-door[data-door="shaker"] .db-leaf::after {
  content: ''; position: absolute; left: 18%; right: 18%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.14), inset 0 -1px 0 rgba(255,255,255,.9);
  background: #F2F0EC;
}
.db-door[data-door="shaker"] .db-leaf::before { top: 9%; height: 46%; }
.db-door[data-door="shaker"] .db-leaf::after { top: 62%; bottom: 9%; }

/* Barn & bypass: plank door on a rail, slides sideways */
.db-door[data-door="barn"] .db-frame { overflow: visible; }
/* Thin brushed-steel rail (not a tab underline). It runs far enough right that
   both rollers stay on it when the door is fully open (slid 80% of its width):
   right roller ends at ~1.64 × (door width + 6px) − 3px from the frame's left edge. */
.db-door[data-door="barn"] .db-rail {
  position: absolute; left: -5px; right: calc(var(--db-door-w) * -0.64 - 9px); top: -9px; height: 3px; border-radius: 1.5px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #C9CDD1 0%, #9EA3A8 55%, #7E8388 100%);
  box-shadow: 0 1px 1px rgba(0,0,0,.18);
  z-index: 3;
}
/* Two small rollers where the door hangs from the rail (move with the door) */
.db-door[data-door="barn"] .db-leaf::before {
  content: ''; position: absolute; left: 16%; right: 16%; top: -9px; height: 9px; z-index: 4;
  background:
    radial-gradient(circle 3px at 3px 3px, #B9BDC2 0 1.4px, #6E7378 1.9px 2.6px, transparent 3px),
    radial-gradient(circle 3px at calc(100% - 3px) 3px, #B9BDC2 0 1.4px, #6E7378 1.9px 2.6px, transparent 3px),
    linear-gradient(#7E8388, #7E8388) 2.5px 4px / 1px 5px no-repeat,
    linear-gradient(#7E8388, #7E8388) calc(100% - 2.5px) 4px / 1px 5px no-repeat;
}
.db-door[data-door="barn"] .db-leaf {
  inset: -2px -3px 0 -3px; transform-origin: center;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.07) 0 1px, transparent 1px 10px),
    linear-gradient(180deg, #FFFFFF, #F1EFEA);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 2px 2px 6px rgba(0,0,0,.08);
  backface-visibility: visible;
}
.db-door[data-door="barn"] .db-knob { right: auto; left: 7px; width: 2.5px; height: 14px; box-shadow: none; }

/* Closet conversion: pair of hinged doors */
.db-door[data-door="closet"] .db-frame { width: calc(var(--db-door-w) * 1.25); }
.db-door[data-door="closet"] .db-leaf.l { right: 50%; }
.db-door[data-door="closet"] .db-leaf.r { left: 50%; transform-origin: right center; }
.db-door[data-door="closet"] .db-leaf.l .db-knob { right: 4px; }
.db-door[data-door="closet"] .db-leaf.r .db-knob { right: auto; left: 4px; box-shadow: -3px 1px 0 -1px #1a1a1a; }

/* Concealed / modern: flush with the wall, no casing, hidden hinges */
.db-door[data-door="concealed"] .db-frame {
  box-shadow: 0 0 0 1px rgba(0,0,0,.12), 0 6px 14px rgba(0,0,0,.06);
}
.db-door[data-door="concealed"] .db-leaf { background: linear-gradient(180deg, #F3F0EA, #EAE6DF); }
.db-door[data-door="concealed"] .db-knob { width: 2px; height: 16px; right: 6px; box-shadow: none; }

/* ── Interaction states ── */
/* hover: door opens a crack */
@media (hover: hover) {
  .db-door:hover .db-leaf { transform: rotateY(-22deg); }
  .db-door[data-door="closet"]:hover .db-leaf.r { transform: rotateY(22deg); }
  .db-door[data-door="barn"]:hover .db-leaf { transform: translateX(18%); }
  .db-door:hover .db-label { color: var(--db-ink); }
}
/* open (current page, or clicked) */
.db-door.is-open .db-frame::after { opacity: 1; }
.db-door.is-open .db-leaf { transform: rotateY(-78deg); box-shadow: inset 0 0 0 1px rgba(0,0,0,.07), -6px 0 10px rgba(0,0,0,.18); }
.db-door[data-door="closet"].is-open .db-leaf.r { transform: rotateY(78deg); }
.db-door[data-door="barn"].is-open .db-leaf { transform: translateX(80%); }
.db-door[data-door="barn"] { margin-right: 14px; }
.db-door.is-current .db-label { color: var(--db-ink); }
.db-door.is-current .db-label::after {
  content: ''; display: block; height: 2px; width: 22px; margin: 5px auto 0;
  background: var(--db-accent); border-radius: 2px;
}
.db-door:focus-visible .db-frame { box-shadow: 0 0 0 4px var(--db-trim), 0 0 0 7px var(--db-accent); }

/* Fly-through: a fixed clone of the clicked door (casing + leaf), placed over
   the original by doorbar.js, scales up around the centre of the opening.
   Inside the opening: warm light, then the next page's colour (var(--bg)). */
.db-door.db-fly {
  position: fixed; z-index: 9998; pointer-events: none; margin: 0;
  display: block; transform-origin: 50% 50%;
  transition: transform .7s cubic-bezier(.55, 0, 1, .45);   /* ease-in: stepping forward */
}
.db-door.db-fly .db-frame { width: 100%; height: 100%; }
.db-door.db-fly .db-frame::before,
.db-door.db-fly .db-frame::after {
  content: ''; position: absolute; inset: 0; height: auto; opacity: 0;
}
.db-door.db-fly .db-frame::before {   /* light from the next room, under the leaf */
  background:
    radial-gradient(ellipse 70% 60% at 50% 55%, rgba(255, 226, 180, .55), transparent 75%),
    var(--bg, #F6F4F0);
  transition: opacity .22s ease;
}
.db-door.db-fly .db-frame::after {    /* becomes the next page's plain colour */
  background: var(--bg, #F6F4F0);
  transition: opacity .3s ease .38s;
}
.db-door.db-fly .db-rail { transition: opacity .25s ease .05s; }
.db-door.db-fly .db-leaf { transition: opacity .25s ease .05s; }
.db-door.db-fly.db-fly--go .db-frame::before,
.db-door.db-fly.db-fly--go .db-frame::after { opacity: 1; }
.db-door.db-fly.db-fly--go .db-leaf,
.db-door.db-fly.db-fly--go .db-rail { opacity: 0; }

/* Arriving on services.html#section: land instantly, no smooth scroll.
   Set by the head script, removed by doorbar.js after load, so same-page
   door clicks and in-page links stay smooth. */
html.db-jump { scroll-behavior: auto !important; }

/* Arrival fade on the next page (class set by the inline head script):
   starts as the colour the opening ended on, so it reads as one move */
html.db-arriving::after {
  content: ''; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: var(--bg, #F6F4F0);
  transition: opacity .5s ease;
}
html.db-arriving.db-arrived::after { opacity: 0; }

/* ── Mobile: swipeable strip ── */
@media (max-width: 760px) {
  :root { --db-door-w: 42px; --db-door-h: 70px; --db-header-h: var(--site-header-h-mobile, 56px); }
  .doorbar__inner {
    justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scrollbar-width: none; gap: 22px;
    padding: 12px 20px 10px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent);
  }
  .doorbar__inner::-webkit-scrollbar { display: none; }
  .db-door { scroll-snap-align: center; }
  .db-label { font-size: 10.5px; max-width: 76px; }
}
/* Phones: all six doors fit across the screen, no scrolling, nothing cut off */
@media (max-width: 480px) {
  :root { --db-door-w: 34px; --db-door-h: 56px; }
  .doorbar__inner {
    justify-content: space-between; overflow: visible; gap: 2px; padding: 10px 8px 8px;
    -webkit-mask-image: none; mask-image: none;
  }
  .db-door { flex: 1 1 0; min-width: 0; gap: 6px; }
  .db-door[data-door="barn"] { margin-right: 0; }
  .db-door[data-door="barn"] .db-rail { left: -4px; }
  .db-label { font-size: 9.5px; max-width: 62px; letter-spacing: 0; }
  .db-label small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .db-leaf, .db-fly, .db-frame::after { transition: none !important; }
  html.db-arriving::after { display: none; }
}
