/* YardOps sign-in pages. Static file: no build step needed. Bump ?v= after editing. */

:root {
    --ink: #0b2a3a;
    --ink-2: #35505f;
    --muted: #5b7280;
    --line: #d8e1e7;
    --line-strong: #b9c7d1;
    --surface: #ffffff;
    --surface-2: #f2f6f8;
    --amber: #f29a1f;
    --amber-press: #dc8610;
    --on-amber: #0b2a3a;
    --danger: #c0372f;
    --danger-bg: #fdeceb;
    --ok: #17784a;
    --ok-bg: #e5f5ed;
    --warn: #8a5400;
    --warn-bg: #fff3dc;
    --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
    color-scheme: light;
}

html[data-theme="dark"] {
    --ink: #eaf2f6;
    --ink-2: #bfd0d9;
    --muted: #93a9b6;
    --line: #28424f;
    --line-strong: #3b5967;
    --surface: rgba(8, 24, 34, 0.92);
    --surface-2: rgba(255, 255, 255, 0.06);
    --danger: #ff9188;
    --danger-bg: rgba(255, 113, 102, 0.13);
    --ok: #62d49b;
    --ok-bg: rgba(66, 200, 139, 0.14);
    --warn: #ffc56b;
    --warn-bg: rgba(242, 154, 31, 0.15);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.auth {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: #061821;
    display: flex;
    flex-direction: column;
}

/* ---------- Cover photo ---------- */
.cover { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #061821; }

.cover-img {
    position: absolute;
    inset: -3%;
    background: url("../images/login-bg.jpg") 62% 50% / cover no-repeat;
    transform-origin: 70% 60%;
    animation: drift 48s ease-in-out infinite alternate;
    transition: filter .6s ease;
}

.cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(100deg, rgba(5, 22, 31, .9) 0%, rgba(5, 22, 31, .66) 40%, rgba(5, 22, 31, .12) 100%),
        linear-gradient(0deg, rgba(5, 22, 31, .55) 0%, rgba(5, 22, 31, 0) 38%);
    transition: background .6s ease;
}

/* Dark mode cover: the same yard after sunset. */
html[data-theme="dark"] .cover-img { filter: brightness(.5) saturate(.72) hue-rotate(-8deg); }
html[data-theme="dark"] .cover::after {
    background:
        linear-gradient(100deg, rgba(2, 10, 16, .94) 0%, rgba(2, 12, 19, .78) 45%, rgba(3, 16, 26, .5) 100%),
        linear-gradient(0deg, rgba(2, 10, 16, .7) 0%, rgba(2, 10, 16, 0) 45%);
}

@keyframes drift {
    from { transform: scale(1.04) translate3d(0, 0, 0); }
    to   { transform: scale(1.15) translate3d(-2.2%, -1.2%, 0); }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    z-index: 10;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: background .2s, transform .2s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .22); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* ---------- Shell ---------- */
.shell {
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 56px);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 480px);
    column-gap: clamp(32px, 6vw, 96px);
    align-items: center;
}

/* ---------- Hero ---------- */
.hero { color: #fff; max-width: 560px; }
.hero-brand { margin: 0 0 18px; font-size: .95rem; font-weight: 600; color: rgba(255, 255, 255, .8); letter-spacing: .01em; }
.hero h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 4.6vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: -.025em;
    text-wrap: balance;
}
.hero-lead { margin: 22px 0 0; max-width: 46ch; font-size: 1.1rem; color: rgba(255, 255, 255, .82); }
.hero-list { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 18px; }
.hero-list li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.hero-list .ico {
    width: 40px; height: 40px; display: grid; place-items: center;
    border-radius: 12px; background: rgba(242, 154, 31, .18); color: #ffb648;
    border: 1px solid rgba(242, 154, 31, .35);
}
.hero-list strong { display: block; font-weight: 700; font-size: 1rem; }
.hero-list span { display: block; font-size: .93rem; color: rgba(255, 255, 255, .72); }

/* ---------- Ticket ---------- */
.ticket-wrap {
    width: 100%;
    max-width: 480px;
    justify-self: end;
    filter: drop-shadow(0 26px 44px rgba(0, 0, 0, .38));
    animation: issue .8s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes issue {
    from { opacity: 0; transform: translateY(22px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.ticket {
    --notch: 96px;
    position: relative;
    background: var(--surface);
    color: var(--ink);
    border-radius: 22px;
    -webkit-mask:
        radial-gradient(circle 13px at 0 var(--notch), #0000 97%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle 13px at 100% var(--notch), #0000 97%, #000) right / 51% 100% no-repeat;
    mask:
        radial-gradient(circle 13px at 0 var(--notch), #0000 97%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle 13px at 100% var(--notch), #0000 97%, #000) right / 51% 100% no-repeat;
}

.ticket::before {
    content: "";
    position: absolute;
    left: 24px; right: 24px;
    top: var(--notch);
    border-top: 2px dashed var(--line-strong);
    opacity: .7;
}

.stub {
    height: var(--notch);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo { display: block; height: 88px; width: auto; margin: -4px 0 -4px -10px; }
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: block; }

.stamp { text-align: right; line-height: 1.15; }
.stamp-time { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stamp-date { display: block; margin-top: 3px; font-size: .8rem; color: var(--muted); }

.ticket-body { padding: 28px 30px 30px; }
.ticket h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 750;
    font-size: 1.65rem;
    line-height: 1.12;
    letter-spacing: -.02em;
}
.sub { margin: 8px 0 22px; color: var(--ink-2); font-size: .98rem; }

/* ---------- Notices ---------- */
.notice {
    display: grid; grid-template-columns: 22px 1fr; gap: 10px;
    margin: 0 0 18px; padding: 12px 14px; border-radius: 12px;
    font-size: .92rem; line-height: 1.45;
}
.notice svg { margin-top: 2px; }
.notice-ok   { background: var(--ok-bg);   color: var(--ok); }
.notice-warn { background: var(--warn-bg); color: var(--warn); }
.notice-err  { background: var(--danger-bg); color: var(--danger); }
.notice p { margin: 0; }

/* ---------- Fields ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .88rem; color: var(--ink); }
.control { position: relative; }

.field input {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    font: inherit;
    font-size: 1rem; /* 16px stops iOS zoom on focus */
    color: var(--ink);
    background: var(--surface-2);
    border: 1.5px solid var(--line);
    border-radius: 13px;
    transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none;
    appearance: none;
}
.field input::placeholder { color: var(--muted); opacity: .8; }
.field input:hover { border-color: var(--line-strong); }
.field input:focus { outline: none; border-color: var(--amber); background: var(--surface); box-shadow: 0 0 0 4px rgba(242, 154, 31, .28); }
.field.has-toggle input { padding-right: 54px; }
.field.has-error input { border-color: var(--danger); }
.field.has-error input:focus { box-shadow: 0 0 0 4px rgba(192, 55, 47, .22); }

html[data-theme="dark"] .field input:-webkit-autofill {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 100px #12303f inset;
    caret-color: var(--ink);
}

.reveal {
    position: absolute; top: 7px; right: 7px;
    width: 38px; height: 38px; display: grid; place-items: center;
    border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.reveal:hover { background: var(--line); color: var(--ink); }
.reveal .i-off { display: none; }
.reveal[aria-pressed="true"] .i-on { display: none; }
.reveal[aria-pressed="true"] .i-off { display: block; }

.field-error { display: flex; gap: 6px; align-items: flex-start; margin: 7px 0 0; color: var(--danger); font-size: .86rem; line-height: 1.35; }
.field-error svg { flex: none; margin-top: 2px; }

/* Password strength */
.meter { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 9px; }
.meter-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.meter-bars i { height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.meter[data-score="1"] i:nth-child(-n+1) { background: #d9534f; }
.meter[data-score="2"] i:nth-child(-n+2) { background: #f0a030; }
.meter[data-score="3"] i:nth-child(-n+3) { background: #7bc043; }
.meter[data-score="4"] i:nth-child(-n+4) { background: #2fb36b; }
.meter-text { min-width: 4.5em; text-align: right; font-size: .8rem; color: var(--muted); }

/* ---------- Row / checkbox / links ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 20px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--ink-2); cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--amber); cursor: pointer; }
.link { color: var(--ink); font-weight: 600; font-size: .92rem; text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.link:hover { color: var(--amber-press); }
html[data-theme="dark"] .link:hover { color: #ffb648; }

/* ---------- Buttons ---------- */
.btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; min-height: 52px; padding: 0 20px;
    font: inherit; font-weight: 700; font-size: 1rem; text-decoration: none;
    border-radius: 13px; border: 1.5px solid transparent; cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--amber); color: var(--on-amber); box-shadow: 0 8px 20px -8px rgba(242, 154, 31, .75); }
.btn-primary:hover { background: var(--amber-press); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-2); }
.btn[disabled] { cursor: progress; opacity: .85; }
.btn .spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(11, 42, 58, .3); border-top-color: var(--on-amber); animation: spin .7s linear infinite; }
.btn.is-loading .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted); font-size: .85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.back { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; }
.actions { display: grid; gap: 12px; }

:is(a, button, input, label.check):focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.field input:focus-visible { outline: none; }

.legal { position: relative; z-index: 1; padding: 0 20px 20px; text-align: center; font-size: .82rem; color: rgba(255, 255, 255, .62); }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 991px) {
    .shell { grid-template-columns: 1fr; row-gap: 22px; align-content: end; padding-top: clamp(64px, 14vh, 140px); padding-bottom: 12px; max-width: 560px; }
    .hero { max-width: none; }
    .hero-brand { margin-bottom: 8px; }
    .hero h2 { font-size: clamp(1.9rem, 8.2vw, 2.7rem); }
    .hero-lead, .hero-list { display: none; }
    .ticket-wrap { justify-self: stretch; max-width: none; }
    .cover::after {
        background: linear-gradient(0deg, rgba(5, 22, 31, .9) 0%, rgba(5, 22, 31, .5) 45%, rgba(5, 22, 31, .22) 100%);
    }
    html[data-theme="dark"] .cover::after {
        background: linear-gradient(0deg, rgba(2, 10, 16, .95) 0%, rgba(2, 10, 16, .72) 50%, rgba(2, 10, 16, .55) 100%);
    }
    .cover-img { background-position: 66% 40%; }
}

@media (max-width: 440px) {
    .shell { padding-left: 14px; padding-right: 14px; }
    .stub { padding: 0 22px; }
    .ticket-body { padding: 24px 22px 26px; }
    .ticket::before { left: 18px; right: 18px; }
    .logo { height: 76px; }
    .stamp-time { font-size: 1.25rem; }
    .ticket h1 { font-size: 1.5rem; }
}

@media (max-height: 640px) and (min-width: 992px) {
    .hero-list { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cover-img, .ticket-wrap { animation: none; }
    * { transition-duration: .01ms !important; }
}

/* ---------- Login intro: desktop = parked 3D truck (auth/yardops-truck.js), phone = plain card slide ---------- */
.truck-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 1; pointer-events: none; }
/* the truck drives BEHIND the sign-in card, so the card sits above the canvas */
html.has-truck .shell { z-index: 2; }
html.has-truck .ticket-wrap { animation: none; }
html.truck-playing, html.truck-playing body,
html.card-slide, html.card-slide body { overflow-x: hidden; }
html.truck-playing .ticket-wrap { transform: translate3d(120vw, 0, 0); }
/* parked mode (register / forgot password / back to login): card and truck fade in together, no truck pop-in */
html.truck-parked .ticket-wrap, html.truck-parked .truck-canvas { transition: opacity .3s ease; }
html.truck-parked:not(.truck-shown) .ticket-wrap, html.truck-parked:not(.truck-shown) .truck-canvas { opacity: 0; }

@keyframes card-in { from { transform: translate3d(110vw, 0, 0); } to { transform: none; } }
html.card-slide .ticket-wrap { animation: card-in .95s cubic-bezier(.2, .8, .2, 1) both; }
html.card-done .ticket-wrap { animation: none; }

/* Hero: brand line + one sentence. Desktop shows them as one row at the bottom-left, under the parked truck. */
.hero { display: flex; flex-direction: column; }
@media (min-width: 992px) {
    .hero { align-self: end; max-width: none; }
    .hero-title, .hero-list { display: none; }
    .hero-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 28px; }
    .hero-bar .hero-brand { margin: 0; white-space: nowrap; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
    .hero-bar .hero-lead { margin: 0; max-width: none; font-size: 1rem; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
}
@media (max-width: 991px) {
    .hero { display: none; }          /* phone: no text, just the truck pass + the card */
}

/* ---------- 3D yard mode (desktop): CSS draws only the sky; the canvas draws ground, containers, crane, palms ---------- */
html.yard-3d .cover-img { display: none; }
html.yard-3d .cover::after { display: none; }
html.yard-3d .cover {
    background:
        radial-gradient(ellipse 34% 20% at 16% var(--horizon, 62%), rgba(255, 226, 160, .95), rgba(255, 176, 86, .38) 48%, rgba(255, 150, 60, 0) 78%),
        linear-gradient(180deg, #2b6cb0 0%, #5d9bd0 calc(var(--horizon, 62%) * .5), #f1c07c calc(var(--horizon, 62%) * .88), #fbe0b0 var(--horizon, 62%), #cdbfa8 100%);
}
html.yard-3d[data-theme="dark"] .cover {
    background:
        radial-gradient(ellipse 46% 16% at 30% var(--horizon, 62%), rgba(74, 118, 150, .5), rgba(74, 118, 150, 0) 72%),
        linear-gradient(180deg, #02070d 0%, #06161f 32%, #0d2b3b calc(var(--horizon, 62%) * .85), #1b4358 var(--horizon, 62%), #0a1620 100%);
}

/* ---------- v7: desktop card height (no page scrollbar) ---------- */
@media (min-width: 992px) {
    .shell { padding-top: clamp(10px, 2vh, 24px); padding-bottom: clamp(30px, 5vh, 44px); }
    .legal { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 20px 8px; z-index: 1; pointer-events: none; }
    body.auth { min-height: 100dvh; }
    .ticket { --notch: 84px; }
    .stub { padding: 0 28px; }
    .logo { height: 78px; margin: -4px 0 -4px -10px; }
    .stamp-time { font-size: 1.4rem; }
    .ticket-body { padding: 22px 28px 26px; }
    .ticket h1 { font-size: 1.55rem; }
    .sub { margin: 5px 0 16px; }
    .field { margin-bottom: 13px; }
    .field label { margin-bottom: 5px; }
    .field input { height: 50px; }
    .reveal { top: 6px; right: 6px; }
    .row-between { margin: 0 0 16px; }
    .btn { min-height: 50px; }
    .divider { margin: 16px 0 12px; }
    .back { margin-top: 14px; }
    .actions { gap: 10px; }
    .notice { margin-bottom: 12px; padding: 10px 12px; }
}
@media (min-width: 992px) and (max-height: 700px) {
    .ticket { --notch: 78px; }
    .logo { height: 70px; }
    .ticket-body { padding: 20px 26px 24px; }
    .ticket h1 { font-size: 1.5rem; }
    .sub { margin: 4px 0 14px; }
    .field { margin-bottom: 12px; }
    .field input { height: 49px; }
    .reveal { top: 5px; }
    .btn { min-height: 49px; }
    .divider { margin: 14px 0 10px; }
}
@media (min-width: 992px) and (max-height: 600px) {
    .ticket { --notch: 66px; }
    .logo { height: 58px; }
    .ticket-body { padding: 14px 24px 16px; }
    .ticket h1 { font-size: 1.3rem; }
    .sub { margin-bottom: 10px; }
    .field { margin-bottom: 8px; }
    .field input { height: 42px; }
    .reveal { top: 2px; }
    .btn { min-height: 42px; }
    .divider { margin: 10px 0 8px; }
}

/* ---------- v8: soft page swap ---------- */
.ticket-wrap.swap-in .ticket { animation: ticket-swap .22s ease-out; }
@keyframes ticket-swap { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
html.card-busy .ticket-wrap { cursor: progress; }
@media (prefers-reduced-motion: reduce) { .ticket-wrap.swap-in .ticket { animation: none; } }

/* Mobile: never flash the legacy photo while the 3D yard initializes. */
@media (max-width: 991px) {
    html .cover-img {
        display: none !important;
    }
}
