/* WiRalogy sliding-door entrance (homepage only). Pure CSS + ~1KB JS, no images.
   Two architectural panels: emerald fluted lacquer, champagne-brass frames, clear glass lites.
   The brand name is split across the seam: "WiRa" | "logy". */

@property --open { syntax: '<number>'; inherits: true; initial-value: 0; }

.door {
  --brass-hi: #F0DCA8;
  --brass: #D9B872;
  --brass-lo: #A8843C;
  --night: #06120D;
  --emerald: #0C1C15;
  --emerald-hi: #15382A;

  --fr: 11px;          /* frame (stile) thickness */
  --bead: 7px;         /* brass bead around the glass */
  --x-out: 21%;        /* glass starts this far from the outer edge */
  --seam: 50px;        /* space between glass and seam, holds the pull handle */
  --y1: 7%;            /* glass top */
  --y2: 70%;           /* glass bottom, below it is the solid kick panel with the name */

  --brass-grad: linear-gradient(135deg, var(--brass-hi), var(--brass) 38%, var(--brass-lo) 62%, var(--brass) 82%, var(--brass-hi));

  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  --open: 0;
  font-family: 'Figtree', system-ui, sans-serif;
  background: transparent;
  transition: --open 1.5s cubic-bezier(.76, 0, .16, 1);
}
.door.is-fixed { position: fixed; inset: 0; height: 100dvh; z-index: 9999; }
.door-lock { overflow: hidden; }
.no-js .door, .skip-door .door { display: none; }
.door.is-open { --open: 1; }
.door[hidden] { display: none !important; }

/* ---------- panels ---------- */
.d-panel {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  will-change: transform;
  filter: drop-shadow(0 0 26px rgba(0, 0, 0, .6));
}
.d-left  { left: 0;  z-index: 2; transform: translateX(calc(var(--open) * -102%));
           --x1: var(--x-out); --x2: calc(100% - var(--seam)); --glow-at: 100% 0; }
.d-right { right: 0; z-index: 1; transform: translateX(calc(var(--open) * 102%));
           --x1: var(--seam);  --x2: calc(100% - var(--x-out)); --glow-at: 0 0; }

/* solid body with a rectangular hole where the glass sits */
.d-body {
  position: absolute; inset: 0;
  --hx1: calc(var(--x1) + var(--bead));
  --hx2: calc(var(--x2) - var(--bead));
  --hy1: calc(var(--y1) + var(--bead));
  --hy2: calc(var(--y2) - var(--bead));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    var(--hx1) var(--hy1), var(--hx1) var(--hy2), var(--hx2) var(--hy2), var(--hx2) var(--hy1), var(--hx1) var(--hy1));
  background:
    radial-gradient(120% 60% at var(--glow-at), rgba(240, 220, 168, .16), transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, .35)),
    /* fluted lacquer: soft highlight, deep groove, repeat */
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, .055) 0, rgba(255, 255, 255, .02) 2px,
      rgba(0, 0, 0, .34) 3px, rgba(0, 0, 0, .12) 6px,
      rgba(255, 255, 255, 0) 7px, rgba(255, 255, 255, 0) 12px),
    linear-gradient(180deg, var(--emerald-hi), var(--emerald) 45%, var(--night));
}

/* outer frame */
.d-frame {
  position: absolute; inset: 0;
  border: var(--fr) solid transparent;
  border-image: var(--brass-grad) 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.d-frame::after { /* brushed grain over the brass */
  content: ''; position: absolute; inset: calc(var(--fr) * -1);
  border: var(--fr) solid transparent;
  border-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .22) 0 1px, rgba(0, 0, 0, .14) 1px 3px) 1;
  mix-blend-mode: overlay;
}

/* glass lite */
.d-glass {
  position: absolute;
  left: var(--x1); top: var(--y1);
  width: calc(var(--x2) - var(--x1));
  height: calc(var(--y2) - var(--y1));
  box-sizing: border-box;
  border: var(--bead) solid transparent;
  border-image: var(--brass-grad) 1;
  background:
    linear-gradient(0deg, rgba(240, 220, 168, .10), transparent 28%),
    linear-gradient(104deg, rgba(255, 255, 255, .17) 0, rgba(255, 255, 255, 0) 24%),
    linear-gradient(104deg, transparent 40%, rgba(255, 255, 255, .075) 40% 47%, transparent 47%),
    rgba(10, 34, 25, .14);
  box-shadow: inset 0 0 38px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(1.2px) saturate(1.12);
  backdrop-filter: blur(1.2px) saturate(1.12);
}
.d-glass::after { /* glazing bar */
  content: ''; position: absolute; left: 0; right: 0; top: 63%; height: 5px;
  background: var(--brass-grad);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

/* pull handle */
.d-handle {
  position: absolute; top: 38%; height: 22%;
  width: 11px; border-radius: 6px;
  background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi) 40%, var(--brass) 62%, var(--brass-lo));
  box-shadow: 0 3px 8px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .25);
}
.d-left .d-handle  { right: calc(var(--fr) + (var(--seam) - var(--fr) - var(--bead)) / 2 - 5px); }
.d-right .d-handle { left:  calc(var(--fr) + (var(--seam) - var(--fr) - var(--bead)) / 2 - 5px); }

/* name, split by the seam */
.d-name {
  position: absolute; left: 0; right: 0; top: var(--y2); bottom: 0;
  display: flex; align-items: center;
  padding: 0 calc(var(--fr) + 8px) 8.5% calc(var(--fr) + 8px);
  font-family: 'Young Serif', Georgia, serif;
  font-size: min(8.4cqw, 15cqh);
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .14)) drop-shadow(0 -1px 0 rgba(0, 0, 0, .7));
  user-select: none;
}
.d-left .d-name  { justify-content: flex-end; }
.d-right .d-name { justify-content: flex-start; }

/* header track and sill */
.d-rail, .d-sill {
  position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
  opacity: calc(1 - var(--open) * 2.2);
}
.d-rail { top: 0; height: 5px; background: var(--brass-grad); box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.d-sill { bottom: 0; height: 4px; background: linear-gradient(180deg, #02070a, var(--brass-lo)); }

/* the one instruction */
.d-cta {
  position: absolute; left: 50%; bottom: 4.2%; z-index: 5;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  border-radius: 99px;
  border: 1px solid rgba(217, 184, 114, .5);
  background: rgba(6, 18, 13, .78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--brass-hi);
  font-weight: 600; font-size: .9rem; letter-spacing: .03em;
  white-space: nowrap;
  pointer-events: none;
  opacity: calc(1 - var(--open) * 4);
}
.d-cta i { /* two hairlines that part, like the doors */
  display: block; width: 16px; height: 1px; background: var(--brass);
  animation: d-part 2.6s cubic-bezier(.2, .7, .2, 1) infinite;
}
.d-cta i:first-child { transform-origin: right; }
.d-cta i:last-child  { transform-origin: left; }
@keyframes d-part { 0%, 100% { transform: scaleX(.35); opacity: .5; } 50% { transform: scaleX(1); opacity: 1; } }

/* whole-door hit area and bypass */
.d-hit {
  position: absolute; inset: 0; z-index: 6;
  border: 0; padding: 0; margin: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.d-hit:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: -10px; }
.d-skip {
  position: absolute; top: 16px; right: 16px; z-index: 7;
  padding: 7px 14px; border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(6, 18, 13, .72);
  color: #A6B8AE; font: 600 .78rem 'Figtree', system-ui, sans-serif; cursor: pointer;
  opacity: calc(1 - var(--open) * 4);
}
.d-skip:hover, .d-skip:focus-visible { color: #F5F4EE; border-color: var(--brass); outline: none; }

/* phones: narrower glass, taller kick panel, bigger name (vars set on panels, since a container can't query itself) */
@container (max-width: 700px) {
  .d-panel { --fr: 8px; --bead: 5px; --x-out: 13%; --seam: 36px; --y1: 6%; --y2: 64%; }
  .d-name { font-size: 13.2cqw; padding-bottom: 15%; }
  .d-handle { width: 8px; top: 33%; height: 18%; }
  .d-left .d-handle  { right: calc(var(--fr) + 6px); }
  .d-right .d-handle { left:  calc(var(--fr) + 6px); }
  .d-cta { bottom: 5%; font-size: .84rem; padding: 8px 16px; gap: 9px; }
  .d-cta i { width: 12px; }
  .d-skip { top: 14px; right: 12px; }
}


@media (prefers-reduced-motion: reduce) {
  .door { transition: opacity .3s linear; }
  .door.is-open { --open: 0; opacity: 0; }
  .d-cta i { animation: none; }
}
