/* ============================================================================
   landing-v2.css — Foundation (Phase 1)
   Self-contained, light-theme stylesheet for the remodeled index.html landing
   page. Scoped to this page only; does NOT touch styles.css or shared CSS.
   Component classes (nav, hero, phone, cards) are added in later phases.
   ========================================================================== */

/* ---------- Design tokens ------------------------------------------------- */
:root {
    /* Color */
    --bg:               #ffffff;
    --bg-band:          #f3f4f6;  /* soft gray section bands */
    --accent:           #3b6dfb;  /* royal blue */
    --accent-hover:     #2f5be0;
    --accent-tint:      #eef2ff;  /* blue-tint icon backgrounds */
    --text:             #111111;  /* near-black */
    --text-secondary:   #5b6270;  /* secondary gray */
    --border:           #e5e7eb;  /* ~1px light border */
    --border-strong:    #d1d5db;

    /* Radii */
    --radius-sm:        10px;
    --radius-card:      18px;
    --radius-frame:     30px;  /* rounded wireframe phone frame */
    --radius-pill:      999px;

    /* Shadow */
    --shadow-card:      0 1px 2px rgba(17, 17, 17, 0.04),
                        0 8px 24px rgba(17, 17, 17, 0.06);
    --shadow-soft:      0 2px 8px rgba(17, 17, 17, 0.05);

    /* Spacing scale */
    --space-1:          4px;
    --space-2:          8px;
    --space-3:          12px;
    --space-4:          16px;
    --space-5:          24px;
    --space-6:          32px;
    --space-7:          48px;
    --space-8:          64px;
    --space-9:          96px;

    /* Layout */
    --container:        1200px;
    --container-pad:    24px;

    /* Type */
    --font-sans:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
                        Roboto, Helvetica, Arial, sans-serif;
    --font-serif:       'Fraunces', Georgia, 'Times New Roman', serif;
}

/* ---------- Reset --------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-x: none;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
    overscroll-behavior-x: none;
}

h1, h2, h3, h4, h5, h6, p, figure {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

button {
    font-family: inherit;
    cursor: pointer;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ---------- Type scale ---------------------------------------------------- */
/* Headings use Inter 800; the .serif-italic utility renders accent words in
   Fraunces italic for the high-contrast editorial accent. */
.serif-italic {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
}

.t-hero {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.t-section {
    font-size: clamp(1.875rem, 3.5vw, 2.75rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.t-sub {
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 400;
}

.t-eyebrow {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ---------- Layout helpers ------------------------------------------------ */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

/* Vertical rhythm for major sections */
.section {
    padding-block: var(--space-9);
}

/* Soft gray full-width band */
.section-band {
    background: var(--bg-band);
}

/* ============================================================================
   Phase 5 — Every format (TCG tabs)
   ========================================================================== */
.lv2-format__head {
    max-width: 640px;
    margin-inline: auto;
    text-align: center;
}

.lv2-format__head .t-section {
    margin-bottom: var(--space-4);
}

/* Pill tabs */
.lv2-format__tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-7);
    margin-bottom: var(--space-6);
}

.lv2-tab {
    padding: 10px 22px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: #fff;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lv2-tab:hover {
    border-color: var(--text);
    color: var(--text);
}

.lv2-tab--active,
.lv2-tab--active:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Panels */
.lv2-format__panel {
    display: none;
}

.lv2-format__panel.is-active {
    display: block;
}

.lv2-format__grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: var(--space-8);
    align-items: start;
    background: var(--bg-band);
    border-radius: var(--radius-card);
    padding: var(--space-8);
}

/* Left: game info */
.lv2-format__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--text);
    margin-bottom: var(--space-4);
}

.lv2-format__icon svg,
.lv2-format__icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.lv2-format__title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-3);
}

.lv2-format__desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
}

.lv2-format__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Tradeable card rows */
.lv2-format__trade {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: var(--shadow-soft);
}

.lv2-format__trade-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.lv2-format__badge {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.lv2-format__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    flex-shrink: 0;
}

/* Right: card-name cloud */
.lv2-format__cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-content: flex-start;
}

.lv2-format__pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}

.lv2-format__pill--more {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: none;
}

@media (max-width: 900px) {
    .lv2-format__grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        padding: var(--space-6);
    }
}


/* ============================================================================
   Auth modal — scoped, on-brand styling (replaces the old styles.css rules).
   auth.js toggles `.modal.active` and `.success-state.active`; form containers
   are toggled via inline display. This block keeps the modal hidden by default
   and renders it as a centered overlay when opened.
   ========================================================================== */

/* Legacy custom props referenced by inline styles in the modal markup
   (location step select/inputs). Defined here so they resolve on the new page. */
.modal {
    --bg-tertiary:    #f3f4f6;
    --bg-secondary:   #ffffff;
    --border-primary: var(--border);
    --text-primary:   var(--text);
    --text-tertiary:  var(--text-secondary);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.45);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 92vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-7) var(--space-6) var(--space-6);
}

.modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
    background: var(--bg-band);
    color: var(--text);
}

/* ---------- Header -------------------------------------------------------- */
.modal-header {
    text-align: center;
    margin-bottom: var(--space-5);
}

.modal-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin: 0 auto var(--space-3);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.gradient-text {
    color: var(--accent);
    font-weight: 700;
}

/* ---------- Forms --------------------------------------------------------- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input,
.form-control {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrapper input:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
}

.input-border { display: none; }

.password-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.password-toggle:hover { color: var(--text); }

.error-message {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: var(--space-2);
    min-height: 0;
}

.field-hint {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-top: var(--space-2);
}

.password-strength {
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--border);
    margin-top: var(--space-2);
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.2s ease;
}

/* ---------- Code input ---------------------------------------------------- */
.code-input-wrapper {
    display: flex;
    gap: var(--space-2);
    justify-content: space-between;
}

.code-digit {
    width: 100%;
    aspect-ratio: 1 / 1;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
}

.code-digit:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-tint);
}

.code-digit.filled { border-color: var(--accent); }
.code-digit.error  { border-color: #dc2626; }

.verification-info {
    text-align: center;
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ---------- Buttons ------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }

.button-shimmer { display: none; }

.btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lv2-spin 0.7s linear infinite;
}

.btn.loading .btn-text { visibility: hidden; }
.btn.loading .btn-loader {
    display: block;
    position: absolute;
}

@keyframes lv2-spin { to { transform: rotate(360deg); } }

/* ---------- Switch / secondary actions ------------------------------------ */
.auth-switch,
.resend-code-wrapper {
    text-align: center;
    margin-top: var(--space-5);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch-btn {
    padding: 0 4px;
    font: inherit;
    font-weight: 700;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
}

.auth-switch-btn:disabled {
    color: var(--text-secondary);
    cursor: default;
}

.change-phone-btn {
    display: block;
    margin: var(--space-3) auto 0;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
}

.change-phone-btn:hover { color: var(--text); }

/* ---------- Success state ------------------------------------------------- */
.success-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-4) 0;
}

.success-state.active { display: flex; }

.success-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin-bottom: var(--space-4);
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
}

.success-icon-glow { display: none; }

.success-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-2);
}

.success-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.success-note {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

.loading-animation { margin-top: var(--space-2); }

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: lv2-spin 0.7s linear infinite;
}

@media (max-width: 480px) {
    .modal-content {
        padding: var(--space-6) var(--space-4) var(--space-5);
    }
}

/* ============================================================================
   Scroll reveal — elements rise + fade in, staggered left-to-right
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(64px);
        transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 0.7, 0.21, 1);
        will-change: opacity, transform;
    }

    .reveal.is-visible {
        opacity: 1;
        transform: none;
    }

    /* Tab click — the grey format tile holds its position while its inner
       pieces stagger in left-to-right, top-to-bottom. JS sets the per-element
       animation-delay; `both` keeps each element hidden until its turn. */
    .lv2-format__grid .tile-in {
        animation: tileIn 0.32s cubic-bezier(0.22, 0.7, 0.21, 1) both;
    }

    @keyframes tileIn {
        from { opacity: 0; transform: translateX(-18px); }
        to   { opacity: 1; transform: none; }
    }
}

/* ---------- Native app (Capacitor shell) ------------------------------------
   index.html loads only this stylesheet, so it needs its own safe-area rules.
   html.native-app is set by native-app.js; the fixed .u-nav (index.html inline
   styles) handles the top inset itself. */
html.native-app body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}
