/* expositus.net home: the door (door.php). */
:root {
    --night: #05070f;
    --silver: #dbe7ff;
    --ink: #e8eefc;
    --dim: #93a3c4;
    --warm: #ffd9a0;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: radial-gradient(ellipse at 50% 0%, #17223d 0%, #0a1020 45%, var(--night) 100%) fixed;
    color: var(--ink);
    font: 17px/1.45 Georgia, "Times New Roman", serif;
    overflow-x: hidden;
}
a { color: var(--silver); }

/* The sky */
.sky { position: fixed; inset: 0; pointer-events: none; }
.stars {
    position: absolute; inset: 0;
    background-image:
        radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 28% 8%, #cfe0ff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 44% 22%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 78% 26%, #cfe0ff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 90% 9%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 6% 40%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 95% 44%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 52% 4%, #fff 50%, transparent 51%);
    animation: twinkle 6s ease-in-out infinite alternate;
}
.stars.far { transform: translate(37px, 61px) scale(1.3); opacity: .5; animation-duration: 9s; }
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }

/* The stage */
.stage { position: relative; display: flex; flex-direction: column; align-items: center; padding: 18px 16px 8px; }
.door {
    position: relative;
    width: min(88vw, 420px);
    aspect-ratio: 400 / 600;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .7));
}
@supports not (aspect-ratio: 1) { .door { height: calc(min(88vw, 420px) * 1.5); } }
.wall { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }

/* The silver lines show only by moonlight */
.ithil { opacity: .05; transition: opacity 2.6s ease-in; }
.moonrise .ithil { opacity: 1; animation: breathe 5s ease-in-out 2.6s infinite alternate; }
@keyframes breathe { from { opacity: .82; } to { opacity: 1; } }
.moonmark { fill: rgba(219, 231, 255, .12); }
.script {
    fill: var(--silver);
    font: italic 17px Georgia, "Times New Roman", serif;
    letter-spacing: .06em;
    transition: opacity .6s ease;
}
.moonrise .script.fade { opacity: 0; animation: none; }

/* The doorway (x 70 to 330, y 150 to 560 of the wall) and its two leaves */
.doorway {
    position: absolute;
    left: 17.5%; width: 65%; top: 25%; height: 68.33%;
    border-radius: 50% 50% 0 0 / 31.7% 31.7% 0 0;
    overflow: hidden;
    perspective: 900px;
    cursor: pointer;
    outline: none;
}
.doorway:focus-visible { box-shadow: 0 0 0 3px var(--warm); }
.passage {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 50% 85%, rgba(255, 196, 120, .55) 0%, rgba(120, 70, 30, .25) 35%, #020203 75%);
    opacity: 0; transition: opacity 1.4s ease .3s;
}
.leaf {
    position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden;
    transition: transform 1.3s cubic-bezier(.5, .05, .25, 1);
    backface-visibility: hidden;
}
.leaf .art { position: absolute; top: 0; height: 100%; width: 100%; display: block; }
.leaf.left { left: 0; transform-origin: 0 50%; box-shadow: inset -1px 0 0 rgba(0, 0, 0, .6); }
.leaf.right { right: 0; transform-origin: 100% 50%; box-shadow: inset 1px 0 0 rgba(0, 0, 0, .6); }
.doorway:hover .leaf.left { transform: rotateY(-4deg); }
.doorway:hover .leaf.right { transform: rotateY(4deg); }
.open .leaf.left { transform: rotateY(-96deg); }
.open .leaf.right { transform: rotateY(96deg); }
.open .passage { opacity: 1; }
.open .doorway { cursor: default; }

.shake { animation: shake .45s ease; }
@keyframes shake {
    20% { transform: translateX(-6px); } 40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}

/* The still pool before the door, with the moon in it */
.pool {
    position: relative; width: min(96vw, 520px); height: 46px; margin-top: -10px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 40%, #16233f 0%, #0b1224 60%, transparent 72%);
    overflow: hidden;
}
.moonlight {
    position: absolute; left: 50%; top: 30%; width: 70px; height: 10px; margin-left: -35px;
    border-radius: 50%; background: rgba(219, 231, 255, .55); filter: blur(4px);
    opacity: 0; transition: opacity 2.6s ease-in;
    animation: ripple 4s ease-in-out infinite;
}
.moonrise .moonlight { opacity: 1; }
@keyframes ripple { 50% { transform: scaleX(1.35) translateY(2px); } }

/* Speaking to the door */
.speak, .inside { width: min(92vw, 420px); text-align: center; margin-top: 6px; }
.lead { display: block; font-size: 19px; font-style: italic; color: var(--ink); margin-bottom: 10px; }
.say { display: flex; gap: 8px; }
.say input {
    flex: 1; min-width: 0; min-height: 48px; padding: 10px 14px;
    border: 1px solid #3a4a70; border-radius: 10px; background: rgba(8, 12, 24, .8);
    color: var(--ink); font: italic 18px Georgia, serif; text-align: center;
}
.say input:focus { outline: none; border-color: var(--silver); box-shadow: 0 0 12px rgba(219, 231, 255, .35); }
.say button, .enter {
    min-height: 48px; padding: 10px 18px; border: 1px solid var(--silver); border-radius: 10px;
    background: rgba(219, 231, 255, .1); color: var(--ink); font: bold 16px Arial, Helvetica, sans-serif; cursor: pointer;
}
.say button:hover, .enter:hover { background: rgba(219, 231, 255, .22); }
.riddle { min-height: 1.4em; margin: 10px 0 4px; color: var(--warm); font-style: italic; }
.knock {
    margin-top: 4px; padding: 8px; border: 0; background: none; color: var(--dim);
    font: 15px Arial, Helvetica, sans-serif; text-decoration: underline; cursor: pointer;
}

/* Behind the door */
.inside { animation: rise .7s ease both; text-align: left; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.inside h1 { margin: 0 0 10px; text-align: center; font: italic 26px Georgia, serif; color: var(--warm); }
.inside label { display: block; margin: 10px 0 4px; font: bold 14px Arial, Helvetica, sans-serif; color: var(--dim); }
.inside input {
    width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid #3a4a70; border-radius: 10px;
    background: rgba(8, 12, 24, .85); color: var(--ink); font: 17px Arial, Helvetica, sans-serif;
}
.inside input:focus { outline: none; border-color: var(--warm); }
.inside .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.inside .enter { display: block; width: 100%; margin-top: 16px; text-align: center; text-decoration: none; border-color: var(--warm);
    background: rgba(255, 217, 160, .15); font-size: 18px; line-height: 26px; }
.msg { min-height: 1.4em; margin: 10px 0 0; color: #ffb4a8; font: bold 15px Arial, Helvetica, sans-serif; text-align: center; }
.msg.good { color: #a8f0d8; }
.small { margin: 12px 0 0; text-align: center; font: 15px Arial, Helvetica, sans-serif; }
.dim { color: var(--dim); }

footer { padding: 18px 16px 24px; text-align: center; color: #5d6b8a; font: 13px Arial, Helvetica, sans-serif; letter-spacing: .04em; }

@media (max-width: 380px) { .inside .two { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
