/* The almari entrance (D-129): two linen doors with the ALMARI name across the seam.
   A thread of warm light appears down the seam, then the doors glide apart onto the page.
   Quiet on purpose: type, light and one movement, no wood photograph and no 3D flip. */
:root {
  --door: #F2ECE2;          /* linen, a shade deeper than the page */
  --door-edge: #E4DBCC;
  --door-ink: #1C1A17;
  --brass: #A8875A;
  --glow: rgba(255, 214, 160, .85);
}

/* Plain closed doors from the first paint until entrance.js takes over (no text yet,
   so no flash of a fallback font). */
html.almari-entering::after {
  content: ''; position: fixed; inset: 0; z-index: 1000; background: var(--door);
}

.almari-entrance { position: fixed; inset: 0; z-index: 1000; overflow: hidden; pointer-events: none; }
.almari-door {
  position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; background: var(--door);
  will-change: transform;
}
.almari-door-left { left: 0; box-shadow: inset -1px 0 0 var(--door-edge); }
.almari-door-right { right: 0; box-shadow: inset 1px 0 0 var(--door-edge); }
/* Depth on the inner edges once the doors move apart. */
.almari-door::before { content: ''; position: absolute; top: 0; bottom: 0; width: 64px; opacity: 0; }
.almari-door-left::before { right: 0; background: linear-gradient(to left, rgba(60, 40, 20, .12), transparent); }
.almari-door-right::before { left: 0; background: linear-gradient(to right, rgba(60, 40, 20, .12), transparent); }

/* The same name in both doors, centred on the seam, so each door carries one half. */
.almari-name {
  position: absolute; top: 50%; width: max-content;
  font: 400 clamp(52px, 10vw, 128px)/1 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  letter-spacing: .06em; color: var(--door-ink);
  transform: translate(-50%, -62%); opacity: 0;
}
.almari-door-left .almari-name { left: 100%; }
.almari-door-right .almari-name { left: 0; }
/* Two slim brass pulls under the name, one on each door. */
.almari-pull { position: absolute; top: calc(50% + clamp(40px, 6vw, 72px)); width: 2px; height: clamp(36px, 5vw, 56px); background: var(--brass); border-radius: 2px; opacity: 0; }
.almari-door-left .almari-pull { right: 12px; }
.almari-door-right .almari-pull { left: 12px; }
/* The thread of light down the seam. */
.almari-seam {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: linear-gradient(to bottom, transparent, var(--glow) 18%, var(--glow) 82%, transparent);
  box-shadow: 0 0 18px 4px rgba(255, 210, 150, .45);
  transform: scaleY(0); opacity: 0;
}

/* Timeline (about 2.2 s): name 0–0.5 s, light 0.45–1.05 s, doors 1.0–2.15 s. */
.almari-entrance.is-opening .almari-name { animation: almari-name-in 600ms cubic-bezier(.2, .7, .2, 1) both; }
.almari-entrance.is-opening .almari-pull { animation: almari-fade-in 600ms ease-out 150ms both; }
.almari-entrance.is-opening .almari-seam { animation: almari-light 900ms cubic-bezier(.5, 0, .2, 1) 450ms both; }
.almari-entrance.is-opening .almari-door-left { animation: almari-open-left 1150ms cubic-bezier(.76, 0, .24, 1) 1000ms both; }
.almari-entrance.is-opening .almari-door-right { animation: almari-open-right 1150ms cubic-bezier(.76, 0, .24, 1) 1000ms both; }
.almari-entrance.is-opening .almari-door::before { animation: almari-fade-in 500ms ease-out 1000ms both; }
/* The page settles forward slightly as the doors part. */
html.almari-revealing .hero-tile img { animation: almari-settle 1600ms cubic-bezier(.2, .7, .2, 1) 1000ms both; }

@keyframes almari-name-in { from { opacity: 0; transform: translate(-50%, -54%); } to { opacity: 1; transform: translate(-50%, -62%); } }
@keyframes almari-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes almari-light {
  0% { opacity: 0; transform: scaleY(0); }
  40% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 1; transform: scaleY(1); }
}
@keyframes almari-open-left { from { transform: translateX(0); } to { transform: translateX(-101%); } }
@keyframes almari-open-right { from { transform: translateX(0); } to { transform: translateX(101%); } }
@keyframes almari-settle { from { transform: scale(1.04); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .almari-entrance, html.almari-entering::after { display: none; }
  html.almari-revealing .hero-tile img { animation: none; }
}
