/* A folded field map: paper, ink, and one impossible orange doorway. */
:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #272923;
  background: #eeeadd;
  --paper: #eeeadd;
  --ink: #272923;
  --accent: #b73b1c;
}
:host {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: block;
  color: #272923;
  font-family: Arial, Helvetica, sans-serif;
  --paper: #eeeadd;
  --ink: #272923;
  --accent: #b73b1c;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: .18;
  background-image: url('./paper-grain.svg?v=8035127e7ac5');
}
a { color: inherit; text-decoration: none; }
a { -webkit-tap-highlight-color: transparent; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }
main { min-height: 100svh; display: flex; flex-direction: column; }
.map-scene {
  position: relative;
  isolation: isolate;
  min-height: 300px;
  flex: 1;
  overflow: hidden;
}
.coordinates {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 4vw, 70px);
  padding-bottom: 30px;
  user-select: none;
}
.digit { font-size: clamp(210px, 27vw, 400px); font-weight: 900; line-height: .85; letter-spacing: -18px; }
.digit-left { transform: rotate(-9deg) translateY(-8px); }
.digit-right { transform: rotate(9deg) translateY(12px); }
.portal {
  position: relative;
  width: clamp(130px, 18vw, 258px);
  height: clamp(192px, 23vw, 335px);
  flex: 0 0 auto;
  margin-top: 12px;
}
.portal-sky { position: absolute; inset: 0; overflow: hidden; border-radius: 48% 48% 0 0; background: #1f302b; border: 9px solid #d95028; }
.coordinates:has([data-preview-ready="true"]) { isolation: isolate; }
[data-preview-ready="true"] .portal-sky { background: transparent; overflow: visible; box-shadow: 0 0 0 150vmax var(--paper); }
.digit { position: relative; z-index: 4; }
.portal { z-index: 3; }
.portal-door-clip {
  position: absolute;
  z-index: 2;
  inset: 0;
  perspective: 900px;
  perspective-origin: 12% 52%;
}
.portal-door {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transform: rotateY(-18deg);
  transition: transform .52s cubic-bezier(.15,.72,.15,1);
}
.door-face, .door-back {
  position: absolute;
  inset: 0;
  border: 8px solid #ed7042;
  border-radius: 48% 48% 0 0;
  backface-visibility: hidden;
}
.door-face { background: linear-gradient(90deg, #d94a24, #e86737); box-shadow: inset 0 0 0 2px #a4381e, 6px 4px 16px #17241c66; }
.door-back { background: linear-gradient(90deg, #a7341b, #d9532b); transform: rotateY(180deg) translateZ(7px); box-shadow: inset 0 0 0 2px #822916; }
.door-knob { position: absolute; right: 12%; top: 62%; width: 7px; height: 7px; border-radius: 50%; background: #ffe2a6; box-shadow: 1px 2px 0 #7f2d18; }
.portal-light { position: absolute; top: 100%; left: 0; width: 100%; height: 23%; background: #dd732c30; clip-path: polygon(0 0,100% 0,140% 100%,-50% 100%); transform: skewX(-30deg); transform-origin: top; opacity: 0; transition: opacity .3s; }
.portal-step { position: absolute; top: 100%; left: -5%; width: 110%; height: 9px; background: #d3cbbc; border-bottom: 3px solid #afa796; transform: skewX(-30deg); }
.step-two { top: calc(100% + 9px); left: -10%; width: 120%; }
.door-passage { position: fixed; z-index: 10; overflow: visible; pointer-events: none; box-sizing: border-box; background: transparent; box-shadow: 0 0 0 150vmax var(--paper); }
[data-door-phase="entering"] .portal-door { transform: rotateY(-118deg); }
[data-door-phase="entering"] .portal-light { opacity: 1; }
[data-door-phase="entering"] .digit { opacity: 0; transition: opacity .2s ease; }
@media (hover: hover) {
  [data-door-phase="idle"] .portal:hover .portal-door { transform: rotateY(-38deg); }
  [data-door-phase="idle"] .portal:hover .portal-light { opacity: .5; }
}
@media (prefers-reduced-motion: no-preference) {
  .coordinates { animation: unfold .85s cubic-bezier(.16,1,.3,1) both; }
  @keyframes unfold { from { opacity: 0; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
}
@media (prefers-reduced-motion: reduce) {
  .portal-door, .portal-light { transition: none; }
}

@media (max-width: 600px) {
  .map-scene { min-height: 230px; }
  .coordinates { gap: clamp(6px, 2vw, 12px); padding-bottom: 15px; }
  .digit { font-size: clamp(128px, 40vw, 210px); letter-spacing: -8px; }
  .portal { width: clamp(115px, 33vw, 165px); height: clamp(166px, 50vw, 245px); margin-top: 0; }
  .portal-sky, .door-face, .door-back { border-width: 5px; }
  .door-knob { width: 4px; height: 4px; }
  .portal-step { height: 6px; border-bottom-width: 2px; }
  .step-two { top: calc(100% + 6px); }
}
@media (max-height: 500px) and (min-width: 601px) {
  .map-scene { min-height: 260px; }
  .digit { font-size: 260px; }
  .portal { width: 140px; height: 200px; }
}
@media (max-height: 500px) and (max-width: 600px) {
  .portal { width: min(140px, 33vw); height: min(180px, calc(100svh - 48px)); }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#door-enter { position: absolute; inset: 0; z-index: 3; border-radius: 48% 48% 0 0; }
[data-door-phase="idle"] .portal:has(#door-enter:focus-visible) .portal-door { transform: rotateY(-38deg); }
