/* Thread Sign-In (templates/auth/login.php and register.php, public/js/auth-thread.js): one game window over the
   painted Crossroads, a gold thread running down its left gutter with a knot at every field. */

.public-page-body-login,
.public-page-body-register { width: 100%; }

.auth-thread-page {
    --thread-gutter: 22px;
    position: relative;
    display: grid;
    justify-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 0.25rem 0 2.5rem;
}

/* The Crossroads plate, darkened, behind everything on the page; it brightens as the card lets the hero in. */
.auth-thread-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(70% 45% at 50% 100%, rgba(215, 174, 88, 0.16), transparent 70%),
        linear-gradient(180deg, rgba(4, 8, 14, 0.58), rgba(4, 8, 14, 0.8)),
        url('/assets/world/whispering-woods/crossroads-plate-v2.webp') 50% 70% / cover no-repeat,
        #071019;
    transition: filter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-thread-page.is-entering .auth-thread-backdrop { filter: brightness(1.2); }

.auth-thread-card {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    padding: 1.5rem 1.25rem 1.25rem calc(var(--thread-gutter) * 2);
    border: 2px solid #f3ecdc;
    border-radius: 10px;
    background: #070b1c;
    color: #f4eedf;
    box-shadow: 0 0 0 2px #0b1020, 0 24px 60px rgba(0, 0, 0, 0.6);
    text-align: left;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-thread-page.is-entering .auth-thread-card { transform: translateY(-8px) scale(1.02); opacity: 0; }

/* The card's left rule glows for a beat when a field takes focus. */
.auth-thread-card::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 7px;
    width: 1px;
    background: linear-gradient(180deg, transparent, #f2d08a 30%, #f2d08a 70%, transparent);
    opacity: 0.32;
}
.auth-thread-card.is-rule-glow::before { animation: auth-thread-rule 0.24s ease-out both; }
@keyframes auth-thread-rule {
    50% { opacity: 1; box-shadow: 0 0 10px 1px rgba(242, 208, 138, 0.75); }
}

.auth-thread-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.auth-thread-path {
    fill: none;
    stroke: #f2d08a;
    stroke-width: 2;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(242, 208, 138, 0.55));
    transition: stroke 0.24s, opacity 0.24s;
}
.auth-thread-path.is-live { stroke: #fff3cf; }
.auth-thread-under { fill: none; stroke: #e0734f; stroke-width: 2; opacity: 0; }
.auth-thread-under.is-on { opacity: 0.85; }

/* The password's strength is the thread's health on the register card. */
.auth-thread-card[data-strength="weak"] .auth-thread-path { stroke-dasharray: 5 4 !important; opacity: 0.5; }
.auth-thread-card[data-strength="fair"] .auth-thread-path { opacity: 0.72; filter: none; }
.auth-thread-card[data-strength="strong"] .auth-thread-path { stroke: #fff3cf; filter: drop-shadow(0 0 6px rgba(244, 217, 145, 0.9)); }

.auth-thread-knot {
    position: absolute;
    top: 0;
    left: calc(var(--thread-gutter) - 7px);
    width: 14px;
    height: 14px;
    margin-top: -7px;
    background: var(--fate-knot-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0 9.7 6.3 16 8 9.7 9.7 8 16 6.3 9.7 0 8 6.3 6.3Z' fill='%23fff3cf'/%3E%3C/svg%3E")) center / contain no-repeat;
    filter: drop-shadow(0 0 4px rgba(242, 208, 138, 0.8));
    transform: scale(0) rotate(-45deg);
    transition: transform 0.36s cubic-bezier(0.2, 0.9, 0.3, 1.25);
    pointer-events: none;
}
.auth-thread-knot.is-tied { transform: scale(1) rotate(0deg); }

.auth-thread-eyebrow {
    margin: 0 0 0.3rem;
    color: #d7ae58;
    font: 600 0.7rem/1.2 Inter, system-ui, sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.public-wrapper .auth-thread-title {
    margin: 0 0 0.35rem;
    color: #f4d991;
    font: 700 1.45rem/1.15 Cinzel, Georgia, serif;
    letter-spacing: 0.01em;
}
.auth-thread-subtitle { margin: 0; color: #aeb7c5; font-size: 0.92rem; line-height: 1.45; }

/* A hero this browser already started (public/js/site-thread.js): its tile takes the guest road's place. */
.auth-thread-resume {
    display: grid;
    gap: 0.15rem;
    margin: 1.15rem 0 0.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(244, 217, 145, 0.6);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(48, 38, 16, 0.92), rgba(18, 16, 12, 0.94));
    color: #f4eedf;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 243, 207, 0.12);
}
.auth-thread-resume[hidden] { display: none; }
.auth-thread-resume:hover { color: #f4eedf; border-color: #f4d991; }
.auth-thread-resume:focus-visible { outline: 2px solid #fff3cf; outline-offset: 3px; }
.auth-thread-resume-eyebrow { color: #d7ae58; font: 600 0.68rem/1.2 Inter, system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; }
.auth-thread-resume strong { color: #f4d991; font: 700 1.1rem/1.2 Cinzel, Georgia, serif; }
.auth-thread-resume-where { color: #c9d1dc; font-size: 0.86rem; }
.auth-thread-resume-go { margin-top: 0.35rem; color: #fff1cc; font: 700 0.92rem/1 Inter, system-ui, sans-serif; }
.auth-thread-card.has-resume .auth-thread-guest,
.auth-thread-card.has-resume .auth-thread-note { display: none; }

/* Most players are guests, so the guest road is the big gold one. */
.auth-thread-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 1.15rem 0 0.55rem;
    border: 1px solid #f4d991;
    border-radius: 10px;
    background: linear-gradient(180deg, #e8c46b, #b8862f);
    color: #1d1406;
    font: 700 1.05rem/1 Inter, system-ui, sans-serif;
    letter-spacing: 0.01em;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 255, 255, 0.35);
    transition: filter 0.16s, transform 0.08s;
}
.auth-thread-guest:hover { color: #1d1406; filter: brightness(1.08); }
.auth-thread-guest:active { transform: translateY(1px); }
.auth-thread-guest:focus-visible,
.auth-thread-submit:focus-visible { outline: 2px solid #fff3cf; outline-offset: 3px; }
.auth-thread-note { margin: 0; color: #8f9aab; font-size: 0.8rem; line-height: 1.45; }

.auth-thread-rule {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.9rem;
    color: #c9d1dc;
    font: 600 0.74rem/1 Inter, system-ui, sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.auth-thread-rule::before,
.auth-thread-rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(215, 174, 88, 0.5)); }
.auth-thread-rule::after { background: linear-gradient(90deg, rgba(215, 174, 88, 0.5), transparent); }

.auth-thread-card .alert-danger,
.auth-thread-card .alert-success { margin: 0 0 0.9rem; font-size: 0.86rem; }

.auth-thread-form { margin: 1rem 0 0; }
.auth-thread-rule + .alert-danger + .auth-thread-form,
.auth-thread-rule + .auth-thread-form { margin-top: 0; }
.auth-thread-field { margin: 0 0 0.85rem; }
.auth-thread-field label {
    display: block;
    margin: 0 0 0.35rem;
    color: #d7ae58;
    font: 600 0.72rem/1.2 Inter, system-ui, sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.auth-thread-field input {
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 0.9rem;
    border: 1px solid rgba(242, 208, 138, 0.28);
    border-radius: 6px;
    background: #0b1326;
    color: #f4eedf;
    font: 500 1rem Inter, system-ui, sans-serif;
    transition: border-color 0.24s, box-shadow 0.24s;
}
.auth-thread-field input::placeholder { color: #6f7b8d; }
.auth-thread-field input:focus { border-color: #f2d08a; outline: none; box-shadow: 0 0 0 3px rgba(242, 208, 138, 0.16); }

.auth-thread-actions { margin: 1.1rem 0 0; }
.auth-thread-submit {
    width: 100%;
    min-height: 48px;
    border: 1px solid #d7ae58;
    border-radius: 8px;
    background: linear-gradient(180deg, #9c7631, #6f4f20);
    color: #fff4d5;
    font: 700 1rem/1 Inter, system-ui, sans-serif;
    cursor: pointer;
    transition: transform 0.08s, filter 0.16s;
}
.auth-thread-submit:hover { filter: brightness(1.1); }
.auth-thread-submit:active { transform: translateY(1px); }
.auth-thread-submit.is-pulled { filter: brightness(1.25); }

.auth-thread-footer { margin: 1.1rem 0 0; color: #8f9aab; font-size: 0.84rem; line-height: 1.6; }
.auth-thread-footer a { color: #f4d991; }

.auth-thread-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 1.1rem;
    margin: 0;
    color: #aeb7c5;
    font-size: 0.82rem;
}
.auth-thread-facts b { color: #f4d991; font-family: Cinzel, Georgia, serif; }

.auth-thread-vows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; width: 100%; margin: 0; padding: 0; list-style: none; }
.auth-thread-vow { padding: 0.75rem 0.8rem; border: 1px solid rgba(215, 174, 88, 0.22); border-radius: 10px; background: rgba(7, 11, 28, 0.78); }
.auth-thread-vow strong { display: block; margin-bottom: 0.25rem; color: #f4d991; font: 700 0.82rem/1.2 Cinzel, Georgia, serif; }
.auth-thread-vow span { color: #aeb7c5; font-size: 0.76rem; line-height: 1.4; }

/* Phones: the vows become one swipeable line under the card. */
@media (max-width: 560px) {
    .auth-thread-page { --thread-gutter: 18px; }
    .auth-thread-card { padding: 1.25rem 1rem 1.1rem calc(var(--thread-gutter) * 2); }
    .public-wrapper .auth-thread-title { font-size: 1.3rem; }
    .auth-thread-vows { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
    .auth-thread-vows::-webkit-scrollbar { display: none; }
    .auth-thread-vow { flex: 0 0 78%; scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-thread-card,
    .auth-thread-backdrop,
    .auth-thread-knot,
    .auth-thread-path { transition: none; }
    .auth-thread-card.is-rule-glow::before { animation: none; }
}
