/* The landing page — one screen, no scroll. Pinned to the dark theme
   (<html data-theme="dark"> in home.html): green felt on the left with chips
   drifting through it, the dark surface on the right with the four suits faint
   behind the sign-in. Every colour is a token from variables.css. */

html, body {
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    font-family: var(--font-sans);
}

/* ── Split container ─────────────────────────────────────── */

.home-split {
    display: flex;
    height: 100dvh;
    overflow: hidden;
}

.home-panel {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-10) var(--space-12);
    overflow: hidden;
    isolation: isolate;          /* the texture layers stay behind the content */
}

.home-panel > :not([aria-hidden]) { position: relative; z-index: 1; }

/* ── Left panel: felt under a lamp ───────────────────────── */

.home-panel--left {
    background: var(--brand);
    color: var(--text-on-brand);
}

/* A pool of light up and left, the cloth falling off to a deeper green at the
   edges, and a fine grain over it all. */
.home-felt {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(120% 90% at 22% 18%, var(--home-lamp), transparent 60%),
        radial-gradient(140% 120% at 50% 40%, transparent 55%, var(--home-felt-edge));
}

.home-felt::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.22;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Chips, drifting up through the felt in slow motion ──── */

.home-chips {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    perspective: 900px;
}

.home-chip {
    position: absolute;
    left: var(--x);
    top: 100%;
    width: var(--size);
    height: var(--size);
    background: var(--home-chip);
    -webkit-mask: url('/static/assets/chip-mask.svg') center / contain no-repeat;
            mask: url('/static/assets/chip-mask.svg') center / contain no-repeat;
    animation: home-chip-drift var(--dur) linear var(--delay) infinite;
    will-change: transform, opacity;
}

/* Further back: smaller, darker, slower in feel. */
.home-chip--deep {
    background: var(--home-chip-deep);
    filter: blur(1px);
}

@keyframes home-chip-drift {
    0%   { transform: translate3d(0, 0, 0) rotateX(55deg) rotateZ(0deg); opacity: 0; }
    12%  { opacity: 1; }
    50%  { transform: translate3d(var(--drift), -60dvh, 0) rotateX(-20deg) rotateZ(calc(var(--spin) / 2)); }
    88%  { opacity: 1; }
    100% { transform: translate3d(0, calc(-100dvh - 2 * var(--size)), 0) rotateX(55deg) rotateZ(var(--spin)); opacity: 0; }
}

/* Reduced motion: the chips rest where they are, scattered, still. */
@media (prefers-reduced-motion: reduce) {
    .home-chip {
        animation: none;
        top: auto;
        bottom: calc(10% + var(--size) * 2);
        transform: rotateX(45deg) rotateZ(var(--spin));
    }
}

/* ── Left panel content ──────────────────────────────────── */

/* The lockup (brand.css) on the green panel: white text, "MAX" by weight alone. */
.home-brand {
    flex-shrink: 0;
    align-self: flex-start;
    font-size: 2rem;
    color: var(--text-on-brand);
}

.home-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-shadow: 0 1px 12px var(--home-felt-edge);   /* reads over a passing chip */
}

.home-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(var(--font-size-2xl), 3.4vw, var(--font-size-4xl));
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-4);
    line-height: 1.12;
    max-width: 16ch;
    color: var(--text-on-brand);
    text-wrap: balance;
}

.home-hero p {
    font-size: var(--font-size-lg);
    line-height: 1.6;
    opacity: 0.9;
    margin: 0;
    max-width: 42ch;
}

.home-hero .home-eyebrow {
    font-family: var(--font-title);
    font-size: var(--font-size-sm);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: var(--space-3);
}

/* ── Right panel: the suits, faint ───────────────────────── */

.home-panel--right {
    background: var(--bg-page);
    color: var(--text-primary);
    justify-content: center;
    align-items: center;
}

.home-suits {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(60% 80% at 0% 50%, var(--home-seam-glow), transparent 70%);
}

.home-suits::before {
    content: '';
    position: absolute;
    inset: -60px;
    background: var(--home-suits);
    -webkit-mask: url('/static/assets/suits-tile.svg') 0 0 / 120px 120px repeat;
            mask: url('/static/assets/suits-tile.svg') 0 0 / 120px 120px repeat;
    transform: rotate(-12deg);
}

.home-auth {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-6);
    padding: var(--space-8);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-surface) 70%, transparent);
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
}

.home-auth-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.home-auth h2 {
    font-family: var(--font-title);
    font-size: var(--font-size-3xl);
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.home-auth p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    line-height: 1.5;
}

.home-auth form { margin: 0; }

.btn-google,
.home-cta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--font-size-md);
    font-weight: 500;
    text-decoration: none;
    transition: opacity var(--transition);
    width: fit-content;
}

.btn-google {
    background: var(--oauth-button-bg);
    color: var(--oauth-button-text);
    border: none;
    cursor: pointer;
}

.home-signin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
}

/* The check is invisible unless Cloudflare needs the visitor; then it takes this space. */
.home-signin .turnstile-slot { width: 100%; display: flex; justify-content: center; }

.home-auth-error {
    color: var(--danger) !important;
    font-size: var(--font-size-sm) !important;
}

.home-cta {
    background: var(--brand);
    color: var(--text-on-brand);
}

.btn-google:hover,
.home-cta:hover { opacity: 0.88; }

.home-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--font-size-sm);
    text-decoration: underline;
    cursor: pointer;
}

.home-auth-off { font-size: var(--font-size-sm); }

/* ── Narrow: felt over the sign-in, still one screen ─────── */

@media (max-width: 900px) {
    .home-panel { padding: var(--space-8); }
}

@media (max-width: 768px) {
    .home-split { flex-direction: column; }

    .home-panel { padding: var(--space-5) var(--space-5); }
    .home-panel--left { flex: 1 1 auto; }
    .home-panel--right { flex: 0 0 auto; padding-block: var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom)); }

    .home-brand { font-size: 1.6rem; }
    .home-hero h1 { font-size: var(--font-size-2xl); margin-bottom: var(--space-2); }
    .home-hero p { font-size: var(--font-size-md); }

    .home-auth { max-width: none; padding: var(--space-5); gap: var(--space-4); }
    .home-auth h2 { font-size: var(--font-size-xl); }
    .home-auth p { font-size: var(--font-size-sm); }
    .home-suits { background: radial-gradient(90% 60% at 50% 0%, var(--home-seam-glow), transparent 70%); }
}

/* Short phones: tighten the blurb before anything scrolls. */
@media (max-width: 768px) and (max-height: 700px) {
    .home-hero h1 { font-size: var(--font-size-xl); }
    .home-hero p { font-size: var(--font-size-sm); line-height: 1.5; }
}
