/* ==========================================================
   LOGIN / CREATE ACCOUNT  -  "Pull the lamp" scene
   Cream & Espresso theme (matches the rest of the site)
   Loaded after style.css; only affects login.php
   ========================================================== */

.login-scene {
    /* Uses the site's own variables: --bg-main, --card-border,
       --accent-gold, --accent-btn, --text-primary, --text-secondary */
    --lamp-dark: #5a3a24;      /* espresso */
    --lamp-mid:  #8a5a2b;      /* caramel */
    --lamp-glow: #f0c987;      /* warm light */

    position: relative;
    isolation: isolate;
    overflow: hidden;
    max-width: none;
    width: 100%;
    min-height: calc(100vh - 140px);
    margin: 0;
    padding: 40px 6vw;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(30px, 8vw, 120px);
    background: var(--bg-main);
}

/* Warm light that washes over the cream when the lamp is on */
.login-scene .scene-glow {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.9s ease;
    background:
        radial-gradient(ellipse 50% 60% at 28% 35%, rgba(240, 201, 135, 0.60), transparent 72%),
        radial-gradient(ellipse 90% 80% at 50% 50%, rgba(138, 90, 43, 0.10), transparent 80%);
}
.login-scene.lit .scene-glow { opacity: 1; }

/* ---------------- LAMP ---------------- */
.lamp-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.lamp {
    --shade: var(--lamp-dark);
    position: relative;
    width: 220px;
    height: 330px;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.lamp:focus-visible { outline: 2px dashed var(--lamp-mid); outline-offset: 8px; border-radius: 12px; }

.lamp-shade {
    position: absolute;
    top: 0;
    left: 35px;
    width: 150px;
    height: 72px;
    border-radius: 75px 75px 4px 4px;
    background: var(--shade);
    transition: background 0.5s ease, box-shadow 0.6s ease;
    z-index: 2;
}
.lamp-pole {
    position: absolute;
    top: 72px;
    left: 104px;
    width: 12px;
    height: 220px;
    background: var(--lamp-dark);
    border-radius: 3px;
    z-index: 2;
}
.lamp-base {
    position: absolute;
    bottom: 0;
    left: 60px;
    width: 100px;
    height: 12px;
    background: var(--lamp-dark);
    border-radius: 6px 6px 3px 3px;
    z-index: 2;
}

/* Cone of light under the shade */
.lamp-cone {
    position: absolute;
    top: 68px;
    left: -10px;
    width: 240px;
    height: 250px;
    background: linear-gradient(to bottom, rgba(240, 190, 100, 0.55), rgba(240, 190, 100, 0));
    clip-path: polygon(31% 0, 69% 0, 100% 100%, 0 100%);
    opacity: 0;
    transition: opacity 0.7s ease;
    pointer-events: none;
    z-index: 1;
}

/* Pull cord */
.lamp-cord {
    --pull: 0px;
    position: absolute;
    top: 72px;
    left: 152px;
    width: 14px;
    height: calc(64px + var(--pull));
    display: flex;
    justify-content: center;
    cursor: grab;
    touch-action: none;
    z-index: 3;
    transition: height 0.25s cubic-bezier(.3, 1.6, .5, 1);
}
.lamp-cord::before {
    content: "";
    width: 2px;
    height: 100%;
    background: var(--lamp-dark);
}
.lamp-bead {
    position: absolute;
    bottom: -9px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--lamp-mid);
    box-shadow: 0 0 0 5px rgba(138, 90, 43, 0);
    transition: box-shadow 0.3s;
}
.lamp-cord:hover .lamp-bead { box-shadow: 0 0 0 5px rgba(138, 90, 43, 0.22); }
.lamp-cord.pulled { --pull: 26px; }

/* Lit state */
.login-scene.lit .lamp { --shade: #fff1cf; }
.login-scene.lit .lamp-shade {
    box-shadow:
        0 0 0 2px rgba(138, 90, 43, 0.35),
        0 10px 40px 8px rgba(240, 190, 100, 0.65),
        0 0 90px 30px rgba(240, 190, 100, 0.35);
}
.login-scene.lit .lamp-cone { opacity: 1; }

.lamp-hint {
    margin-top: 18px;
    font-size: 0.85rem;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    text-align: center;
    animation: hintPulse 2.4s ease-in-out infinite;
}
.login-scene.lit .lamp-hint { animation: none; opacity: 0.75; }
@keyframes hintPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ---------------- CARD ---------------- */
.login-scene .login-container {
    flex: 0 1 430px;
    width: 100%;
    max-width: 430px;
    padding: 34px 30px 30px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: 0 20px 50px rgba(90, 58, 36, 0.18);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);

    /* hidden until the lamp is on */
    opacity: 0;
    visibility: hidden;
    transform: translateX(26px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s, visibility 0s linear 0.85s;
}
.login-scene.lit .login-container {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s, visibility 0s;
}

.login-scene .login-header { margin-bottom: 24px; }
.login-scene .login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}
.login-scene .login-header p { font-size: 0.85rem; color: var(--text-secondary); }

.login-scene .login-container .form-group { margin-bottom: 16px; }
.login-scene .login-container label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 7px;
    font-weight: 500;
}

.login-scene .login-container input[type="email"],
.login-scene .login-container input[type="password"],
.login-scene .login-container input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    background-color: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.92rem;
}
.login-scene .login-container input::placeholder { color: var(--text-muted); }
.login-scene .login-container input[type="email"]:focus,
.login-scene .login-container input[type="password"]:focus,
.login-scene .login-container input[type="text"]:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(138, 90, 43, 0.18);
    background-color: #fff;
}
.login-scene .login-container input:-webkit-autofill {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 40px var(--input-bg) inset;
}

.login-scene .form-options { margin-bottom: 20px; }
.login-scene .remember-me { color: var(--text-secondary); font-size: 0.82rem; }
.login-scene .remember-me input[type="checkbox"] { accent-color: var(--accent-btn); }
.login-scene .custom-checkbox { display: none; }

.login-scene .forgot-link,
.login-scene .login-container a { color: var(--accent-gold); font-weight: 600; text-decoration: none; }
.login-scene .login-container a:hover { color: var(--accent-btn); text-decoration: underline; }
.login-scene .forgot-link { font-size: 0.78rem; }

/* Espresso button with a soft caramel sheen, same family as the site's Login button */
.login-scene .login-submit-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
    background: linear-gradient(110deg, #4a2e1b 0%, #6e4a30 30%, #8a5a2b 50%, #6e4a30 70%, #4a2e1b 100%);
    background-size: 200% 100%;
    background-position: 0% 0;
    box-shadow: 0 6px 16px rgba(90, 58, 36, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    transition: background-position 0.5s ease, transform 0.12s, box-shadow 0.2s;
}
.login-scene .login-submit-btn:hover {
    background-color: transparent;
    background-position: 100% 0;
    box-shadow: 0 8px 22px rgba(90, 58, 36, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.login-scene .login-submit-btn:active { transform: scale(0.985); }

.login-scene .login-footer { margin-top: 18px; text-align: center; }
.login-scene .login-footer p { font-size: 0.82rem; color: var(--text-secondary); }

.login-scene #login-view,
.login-scene #register-view,
.login-scene #forgot-view { animation: viewIn 0.4s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- PASSWORD HELPERS ---------------- */
.login-scene .label-row { display: flex; justify-content: space-between; align-items: center; }

.login-scene .pw-toggle {
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-gold);
}
.login-scene .pw-toggle:hover { color: var(--accent-btn); text-decoration: underline; }

.login-scene .pw-tools { margin-top: 12px; }

/* strength meter */
.login-scene .pw-meter { display: flex; align-items: center; gap: 10px; min-height: 16px; margin-bottom: 10px; }
.login-scene .pw-meter-track { flex: 1; height: 6px; border-radius: 6px; background: var(--card-border); overflow: hidden; }
.login-scene .pw-meter-bar { display: block; height: 100%; width: 0; border-radius: 6px; background: #b3261e; transition: width 0.3s ease, background-color 0.3s ease; }
.login-scene .pw-tools[data-level="2"] .pw-meter-bar { background: #c8935a; }
.login-scene .pw-tools[data-level="3"] .pw-meter-bar { background: #8a8f3c; }
.login-scene .pw-tools[data-level="4"] .pw-meter-bar { background: #2e7d4f; }
.login-scene .pw-meter-label { min-width: 70px; text-align: right; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }

/* requirement checklist */
.login-scene .pw-rules {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 14px;
    margin: 0 0 14px;
    padding: 0;
}
.login-scene .pw-rules li { display: flex; align-items: flex-start; gap: 7px; font-size: 0.74rem; line-height: 1.3; color: var(--text-secondary); transition: color 0.2s; }
.login-scene .pw-icon { flex: 0 0 auto; width: 13px; font-weight: 700; color: var(--text-muted); text-align: center; }
.login-scene .pw-rules li.met { color: #2e7d4f; }
.login-scene .pw-rules li.met .pw-icon { color: #2e7d4f; }

/* "suggest a strong password" */
.login-scene .pw-suggest {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px dashed var(--accent-gold);
    background: rgba(138, 90, 43, 0.06);
    color: var(--accent-btn);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-scene .pw-suggest:hover { background: rgba(138, 90, 43, 0.14); }
.login-scene .pw-note { margin-top: 8px; font-size: 0.75rem; color: var(--text-secondary); min-height: 1em; }

/* consent */
.login-scene .consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 6px 0 20px;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-secondary);
}
.login-scene .consent-row input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent-btn); cursor: pointer; }

/* disabled submit */
.login-scene .login-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    background-position: 0% 0;
}

@media (max-width: 420px) {
    .login-scene .pw-rules { grid-template-columns: 1fr; }
}

/* ---------------- WIDE CREATE-ACCOUNT LAYOUT ---------------- */
.login-scene .login-container { transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s, max-width 0.35s ease, visibility 0s linear 0.85s; }
.login-scene.lit .login-container { transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s, max-width 0.35s ease, visibility 0s; }
.login-scene .login-container.is-wide { flex-basis: 800px; max-width: 800px; padding: 28px 34px 24px; }
.login-scene .is-wide .login-header { margin-bottom: 18px; }
.login-scene .reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-items: start; }
.login-scene .reg-col { min-width: 0; }
.login-scene .reg-col .form-group:last-child { margin-bottom: 0; }
.login-scene .is-wide .pw-tools { margin-top: 10px; }
.login-scene .is-wide .pw-rules { margin-bottom: 10px; }
.login-scene .is-wide .consent-row { margin: 18px 0 16px; }
.login-scene .is-wide .login-footer { margin-top: 14px; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1000px) {
    .login-scene {
        flex-direction: column;
        justify-content: flex-start;
        gap: 10px;
        padding: 24px 18px 40px;
    }
    .lamp { transform: scale(0.72); transform-origin: top center; margin-bottom: -92px; }
    .lamp-hint { margin-top: 14px; }
    .login-scene .login-container { max-width: 440px; transform: translateY(24px) scale(0.97); }
    .login-scene .login-container.is-wide { max-width: 800px; }
    .login-scene .scene-glow {
        background:
            radial-gradient(ellipse 80% 40% at 50% 14%, rgba(240, 201, 135, 0.60), transparent 72%),
            radial-gradient(ellipse 90% 80% at 50% 60%, rgba(138, 90, 43, 0.08), transparent 80%);
    }
}

@media (max-width: 720px) {
    .login-scene .reg-grid { grid-template-columns: 1fr; }
    .login-scene .reg-col .form-group:last-child { margin-bottom: 16px; }
    .login-scene .login-container.is-wide { padding: 25px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .login-scene *, .login-scene *::before { animation: none !important; transition-duration: 0.01s !important; transition-delay: 0s !important; }
}
