/* 대각선 체인은 벽 뒤로 감겨 들어가고, 성문은 정면을 유지하며 좌우로 열린다. */
.gate-intro {
  --gate-intro-ready: 1;
  --gate-jamb: clamp(24px, 3.2vw, 58px);
  --gate-lintel: clamp(88px, 13vh, 110px);
  --gate-sill: 20px;
  --gate-width: calc(100vw - var(--gate-jamb) * 2);
  --gate-height: calc(100dvh - var(--gate-lintel) - var(--gate-sill));
  --gate-art-width: max(var(--gate-width), calc(var(--gate-height) * 1.5));
  --gate-art-height: calc(var(--gate-art-width) / 1.5);
  --gate-travel-duration: 1.75s;
  --gate-start-delay: .6s;
  --gate-pull-curve: cubic-bezier(.58, .02, .18, 1);
  --gate-chain-span: clamp(230px, 30vw, 460px);
  --gate-chain-thickness: clamp(28px, 3.5vw, 46px);
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--color-on-dark);
  background: transparent;
}
.gate-intro[hidden] { display: none; }
.gate-intro::backdrop { background: transparent; }
.gate-intro-veil { position: absolute; inset: 0; background: #14120f; }
.gate-intro-scene { position: absolute; inset: 0; }
.gate-intro-opening { position: absolute; inset: var(--gate-lintel) var(--gate-jamb) var(--gate-sill); }
.gate-intro-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  will-change: transform;
  box-shadow: 0 0 20px 6px var(--c-black-a53);
}
.gate-intro-door-left { left: 0; }
.gate-intro-door-right { right: 0; }
.gate-intro-face {
  position: absolute;
  inset: 0;
  background: var(--color-surface-dark) url("/images/leafme-gate-timber-v2.webp") no-repeat;
  background-size: var(--gate-art-width) var(--gate-art-height);
  background-position-y: center;
  box-shadow: inset 0 0 0 2px #171410, inset 0 0 20px 5px #090807b0;
}
.gate-intro-door-left .gate-intro-face { background-position-x: calc((var(--gate-width) - var(--gate-art-width)) / 2); }
.gate-intro-door-right .gate-intro-face { background-position-x: calc(var(--gate-art-width) / -2); }
.gate-intro-face::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  background: linear-gradient(90deg, #a28c612e, #191712 45%, #050504);
  pointer-events: none;
}
.gate-intro-door-left .gate-intro-face::after { right: 0; }
.gate-intro-door-right .gate-intro-face::after { left: 0; transform: scaleX(-1); }
.gate-intro-jamb, .gate-intro-lintel, .gate-intro-threshold {
  position: absolute;
  background-color: var(--color-surface-dark);
  border: 1px solid #81705755;
  box-shadow: inset 0 2px 2px #bcb09a25, inset 0 -4px 8px #080705a0;
}
.gate-intro-jamb {
  top: 0;
  bottom: 0;
  width: var(--gate-jamb);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 112px, #080807 113px 117px, #9a8b6833 118px 120px),
    repeating-linear-gradient(7deg, #c3b58c08 0 1px, transparent 1px 5px),
    linear-gradient(90deg, #151512, #514a3e 28%, #34312a 72%, #151411);
}
.gate-intro-jamb-left { left: 0; box-shadow: inset -8px 0 8px #0009, 8px 0 16px var(--c-black-a53); }
.gate-intro-jamb-right { right: 0; box-shadow: inset 8px 0 8px #0009, -8px 0 16px var(--c-black-a53); }
.gate-intro-lintel {
  inset: 0 0 auto;
  height: var(--gate-lintel);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px 4px;
  gap: 14px;
  background: linear-gradient(#403a30, var(--color-surface-dark) 48%, #12120f 70%, var(--color-surface-dark) 88%, #12110e);
  border-bottom: 4px solid #171510;
  box-shadow: 0 6px 18px #000b, inset 0 2px 1px #a28e5b40;
}
.gate-intro-lintel img { width: 42px; height: 50px; opacity: .95; }
.gate-intro-brand { display: flex; flex-direction: column; align-items: center; gap: 7px; text-shadow: 0 2px 3px #000; }
.gate-intro-brand-name { color: var(--color-on-dark); font: 600 36px/1.1 var(--lm-serif); letter-spacing: .18em; padding-left: .18em; }
.gate-intro-brand-subtitle { color: var(--color-on-dark); font: 600 14px/1.4 var(--lm-serif); letter-spacing: .08em; white-space: nowrap; }
.gate-intro-chain {
  position: absolute;
  top: clamp(35px, 7vh, 68px);
  width: var(--gate-chain-span);
  height: var(--gate-chain-thickness);
  filter: drop-shadow(4px 8px 5px #000c);
}
.gate-intro-chain-left { left: calc(var(--gate-chain-span) * -.2); transform: rotate(-43deg); }
.gate-intro-chain-right { right: calc(var(--gate-chain-span) * -.2); transform: rotate(43deg); }
.gate-intro-chain-run {
  position: absolute;
  inset: 0;
  background: url("/images/leafme-gate-chain.svg?v=20261024-diagonal") 0 center / calc(var(--gate-chain-thickness) * 3) var(--gate-chain-thickness) repeat-x;
}
.gate-intro-threshold { inset: auto 0 0; height: var(--gate-sill); background: linear-gradient(#1a1813, #5b5140 24%, var(--color-surface-dark)); }
.gate-intro-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gate-intro-skip {
  position: absolute;
  bottom: max(30px, env(safe-area-inset-bottom));
  right: max(30px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 44px;
  padding: 9px 16px;
  color: var(--color-on-dark-muted);
  background: #15130fe8;
  border: 1px solid #80705499;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
}
.gate-intro-skip:hover { color: #fff3dc; background: var(--color-surface-dark); }
.gate-intro-skip:focus-visible { outline: 2px solid var(--color-border-strong); outline-offset: 3px; }
.gate-intro.is-opening .gate-intro-door,
.gate-intro.is-opening .gate-intro-chain-run {
  animation-duration: var(--gate-travel-duration);
  animation-delay: var(--gate-start-delay);
  animation-timing-function: var(--gate-pull-curve);
  animation-fill-mode: both;
}
.gate-intro.is-opening .gate-intro-door-left { animation-name: leafme-gate-left; }
.gate-intro.is-opening .gate-intro-door-right { animation-name: leafme-gate-right; }
.gate-intro.is-opening .gate-intro-chain-left .gate-intro-chain-run { animation-name: leafme-chain-left; }
.gate-intro.is-opening .gate-intro-chain-right .gate-intro-chain-run { animation-name: leafme-chain-right; }
.gate-intro.is-opening .gate-intro-scene { animation: leafme-gate-exit .2s 2.35s ease-out both; }
.gate-intro.is-opening .gate-intro-veil { animation: leafme-gate-veil .85s .6s ease-out both; }
@keyframes leafme-gate-left { from { transform: translateX(0); } to { transform: translateX(calc(-100% - var(--gate-jamb))); } }
@keyframes leafme-gate-right { from { transform: translateX(0); } to { transform: translateX(calc(100% + var(--gate-jamb))); } }
/* 1 / cos(43deg): 대각선 체인의 수평 이동 성분을 문의 이동량과 맞춘다. */
@keyframes leafme-chain-left { from { background-position-x: 0; } to { background-position-x: calc(-50vw * 1.367); } }
@keyframes leafme-chain-right { from { background-position-x: 0; } to { background-position-x: calc(50vw * 1.367); } }
@keyframes leafme-gate-exit { from { opacity: 1; } to { opacity: 0; } }
@keyframes leafme-gate-veil { from { opacity: 1; } to { opacity: 0; } }
@media (max-width: 600px) {
  .gate-intro { --gate-jamb: 18px; --gate-lintel: 78px; --gate-sill: 18px; }
  .gate-intro-lintel { gap: 9px; }
  .gate-intro-lintel img { width: 27px; height: 33px; }
  .gate-intro-brand { gap: 5px; }
  .gate-intro-brand-name { font-size: 28px; }
  .gate-intro-brand-subtitle { font-size: 11px; letter-spacing: .03em; }
  .gate-intro-chain { top: 20px; }
  .gate-intro-skip { right: 28px; bottom: max(30px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) and (min-width: 601px) {
  .gate-intro { --gate-lintel: 70px; --gate-sill: 14px; --gate-jamb: 26px; }
  .gate-intro-brand { gap: 4px; }
  .gate-intro-brand-name { font-size: 25px; }
  .gate-intro-brand-subtitle { font-size: 11px; }
  .gate-intro-skip { bottom: 25px; }
}
@media (max-width: 360px) { .gate-intro-lintel img { display: none; } }
@media (prefers-reduced-motion: reduce) { .gate-intro { display: none !important; } }

