/* =======================================================
   Block Birthday — Bitcoin orange theme (centered + responsive)
   ======================================================= */

/* ---------- Design Tokens ---------- */
:root {
    --orange: #f7931a;
    --orange-hover: #e07f12;
    --text: #111827;
    --muted: #6b7280;
    --bg: #ffffff;
    --border: #e5e7eb;
    --soft: #f9fafb;
    --warn-bg: #fff7ed;
    --warn-border: #fdba74;
    --warn-text: #9a3412;
    --blue-bg: #eef6ff;
    --blue-border: #b6daff;
    --blue-text: #084298;
    --content-width: 680px;
    --transition-speed: .25s;
    --field-bg: #fff;
    --field-border: #ccc;
    /* NEW semantic surfaces */
    --card-bg: #ffffff;
    --modal-bg: #ffffff;
    --header-bg: rgba(255,255,255,.9);
    /* new shared tokens */
    --radius-sm: .4rem;
    --radius: .6rem;
    --radius-lg: .9rem;
    --control-h: 2.8rem;
}
[data-theme=dark] {
    --bg: #0d1117;
    --soft: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --blue-bg: #1e3a5c;
    --blue-border: #264b70;
    --blue-text: #96c8ff;
    --warn-bg: #2d1f0f;
    --warn-border: #92501d;
    --warn-text: #f0b179;
    --field-bg: #0f151c;
    --field-border: #30363d;
    /* Dark surface overrides */
    --card-bg: #161b22;
    --modal-bg: #161b22;
    --header-bg: rgba(13,17,23,.92);
    /* ensure tokens exist in dark too (values reused) */
    --radius-sm: .4rem;
    --radius: .6rem;
    --radius-lg: .9rem;
    --control-h: 2.8rem;
}
html[data-theme=dark], html[data-theme=dark] body {
    background: var(--bg);
    color: var(--text);
}
body, .card, .subcard, .ln-modal-content, .support-footer {
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ---------- Smooth Scroll Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page > header {
    /* animation: fadeInUp 0.8s ease-out; */ /* deleted */
}

/* Removed reference to deleted selectors */
@media (prefers-reduced-motion: reduce) {
    /* .scroll-animate, */
    /* .page > header { ... } */
    /* (No longer needed: no entrance animations remain) */
}

/* ---------- Layout ---------- */
.container { width: 100%; margin: 0 auto; padding: 0 1rem; }
.page { max-width: var(--content-width); margin: 2rem auto; }

/* ---------- Typography ---------- */
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
p { margin: .5rem 0 0; color: var(--text); opacity: .85; }
em { color: var(--text); opacity: .7; }
.meta, .kicker { font-size: .92rem; color: var(--muted); }
.kicker { font-size: .85rem; }
.big { font-weight: 800; font-size: 1.5rem; }

/* ---------- Alerts ---------- */
.alert {
    background: #fdecea;
    border: 1px solid #f5c2c7;
    color: #842029;
    padding: .75rem 1rem;
    border-radius: .5rem;
    margin: 1rem 0;
}

/* ---------- Form Layout ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0 2rem;
}
label { display: block; font-weight: 600; margin-bottom: .25rem; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: .25rem;
}

/* ---------- Form Controls ---------- */
input[type="text"], select {
    width: 100%;
    height: var(--control-h);
    padding: .5rem .6rem;
    border: 1px solid var(--field-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--field-bg);
    color: var(--text);
}

button, .btn {
    height: var(--control-h);
    padding: 0 1rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
}
button.primary, .btn.primary { background: var(--orange); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--orange-hover); }
button.secondary, .btn.secondary {
    background: var(--blue-bg);
    border: 1px solid var(--blue-border);
    color: var(--blue-text);
}

/* ---------- Inline Groups ---------- */
.inline-group { display: flex; align-items: center; gap: .5rem; }
.inline-group select {
    height: 2.8rem;
    padding: .5rem .6rem;
    border: 1px solid var(--field-border);
    border-radius: .6rem;
    font-size: 1rem;
    background: var(--field-bg);
    color: var(--text); /* added */
}
.inline-sep { font-weight: 700; color: var(--muted); }

/* Specific widths for compact selects */
#bb-day, #bb-hour, #bb-minute { width: 5.5rem; }
#bb-month, #bb-year { width: 7.5rem; }

/* Adaptive date order via flex ordering */
#bb-date-group { display: flex; gap: .5rem; align-items: center; }
#bb-date-group .bb-month { order: 2; }
#bb-date-group .bb-day   { order: 1; }
#bb-date-group .bb-year  { order: 3; }
#bb-date-group.us .bb-month { order: 1; }
#bb-date-group.us .bb-day   { order: 2; }
#bb-date-group.us .bb-year  { order: 3; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--card-bg);
    margin-top: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
}

/* ---------- Badges ---------- */
.badge {
    font-size: .85rem;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn-text);
    padding: .2rem .55rem;
    border-radius: .4rem;
}

/* ---------- Footer ---------- */
footer { margin-top: 1.5rem; }

/* ---------- Select groups (timezone) ---------- */
optgroup { font-style: normal; color: var(--text); }
optgroup[label="Recommended"] option { font-weight: 600; }

/* ---------- Support Footer & Lightning Modal ---------- */
.support-footer {
    margin-top: 2rem;
    padding: 1rem 0 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--soft);
}
.support-btn {
    /* cleaned: removed duplicate padding + clarified layout */
    background: transparent;
    border: 1px solid var(--orange);
    color: var(--orange);
    font-weight: 600;
    border-radius: 2rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    line-height: 1.1;
    padding: .7rem 1.1rem;
}
.support-btn:hover {
    background: var(--orange);
    color: #fff; /* keep white in both themes (removed dark override using #000) */
}

.ln-modal[aria-hidden="true"] { display: none; }
.ln-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ln-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
}
.ln-modal-content {
    position: relative;
    background: var(--modal-bg); /* replaced #fff */
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 360px;
    width: 92%;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,.35);
}
.ln-close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
}
.ln-close:hover { color: var(--text); }
.ln-title { margin: 0 0 .5rem; font-size: 1.25rem; }
.ln-qr-wrapper { display: flex; justify-content: center; margin: 1rem 0; }
.ln-qr { width: 180px; height: 180px; }
.ln-invoice {
    display: block;
    width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.2;
    font-size: .78rem;
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: .5rem;
    padding: .5rem .7rem .54rem;
    margin-bottom: .75rem;
}
.ln-actions { display: flex; align-items: center; gap: .75rem; }
body.no-scroll { overflow: hidden; }

@media (max-width: 480px) {
    .ln-qr { width: 150px; height: 150px; }
}

@media (max-width: 720px) {
    :root { --content-width: 94vw; }

    .form-grid { grid-template-columns: 1fr; }

    .form-actions {
        flex-direction: column;
        justify-content: stretch;
    }
    .form-actions > * { width: 100%; }

    .card { padding: 1rem .95rem .85rem; }
    .result-grid { gap: .65rem; }

    .inline-group { gap: .4rem; }
    #bb-month, #bb-year { flex: 1; width: auto; }

    #bb-date-group .bb-month,
    #bb-date-group .bb-year { flex: 1; min-width: 6.5rem; }
}

/* Mobile top-spacing optimization */
@media (max-width: 720px) {
    .page {
        /* was 2rem auto, reduce top margin to show more content above fold */
        margin: 1.1rem auto 2rem;
    }
    .page > header h1 {
        font-size: 1.9rem; /* subtle reduction from 2rem */
    }
    .page > header p {
        margin-top: .4rem; /* was .5rem */
    }
    .form-grid {
        margin: .5rem 0 1.6rem; /* was 1rem 0 2rem */
        gap: .75rem;            /* was 1rem */
    }
    .form-actions {
        margin-top: 0; /* remove extra gap before buttons */
    }
}

/* Optional further tightening for very short heights (e.g., Safari UI visible) */
@media (max-height: 750px) and (max-width: 720px) {
    .page { margin-top: .85rem; }
    .form-grid { margin: .4rem 0 1.4rem; }
}

/* Ensure result card not obscured by sticky header on any native scroll */
#bb-result-card { scroll-margin-top: 72px; }
@media (max-width: 720px) {
    #bb-result-card { scroll-margin-top: 64px; }
}

/* ---------- Meta Links ---------- */
.meta-link {
    font-size: .9rem;
    color: var(--blue-text);
    text-decoration: underline;
}
.meta-link:hover {
    color: var(--orange-hover);
}

/* ---------- Site Header (sticky, mobile-friendly) ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--header-bg); /* replaced hard-coded rgba */
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
    font-weight: 700;
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
}
.brand-icon { 
    font-size: 1.35rem; 
    line-height: 1; 
    color: var(--orange); /* ensure contrast in dark mode */
    font-weight: 700;
}
.brand:hover { color: var(--orange-hover); }

.support-mini-btn {
    background: var(--orange);
    color: #fff;
    border: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,.12);
    transition: background .18s;
    touch-action: manipulation;
}
.support-mini-btn:hover { background: var(--orange-hover); }
/* Support / pulse highlight: disable animation so footer no longer animates */
.support-mini-btn.pulse-highlight,
.support-btn.pulse-highlight {
    /* animation: lnPulse 1s ease-in-out 0s 5; */ /* disabled */
}
@keyframes lnPulse {
    /* kept in case re-enabled later; harmless */
    0%   { box-shadow: 0 0 0 0 rgba(247,147,26,.55); transform: scale(1); }
    70%  { box-shadow: 0 0 0 14px rgba(247,147,26,0); transform: scale(1.07); }
    100% { box-shadow: 0 0 0 0 rgba(247,147,26,0); transform: scale(1); }
}

/* ---------- Theme Toggle ---------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.theme-toggle {
    background: var(--soft);
    color: var(--text);
    border: 1px solid var(--border);
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.theme-toggle:hover {
    background: var(--orange);
    color: #fff;
    border-color: var(--orange);
}
[data-theme=dark] .theme-toggle {
    background: #1d232c;
    border-color: #30363d;
}
[data-theme=dark] .theme-toggle:hover {
    background: var(--orange);
    color: #000;
    border-color: var(--orange);
}

/* optional: soften QR look in dark */
[data-theme=dark] .ln-qr {
    filter: brightness(1.05) contrast(1.05);
}

html.theme-preload, html.theme-preload * {
    transition: none !important;
}

/* ---------- Result (Unified Gradient Card) ---------- */
#bb-result-card.result-card {
    background: linear-gradient(135deg, rgba(247,147,26,.18), rgba(247,147,26,0) 55%), var(--card-bg);
    position: relative;
    overflow: hidden;
    /* animation: cardPop .6s cubic-bezier(.16,.8,.3,1); */ /* removed pop-in */
    border-radius: var(--radius-lg);
}
[data-theme=dark] #bb-result-card.result-card {
    background: linear-gradient(135deg, rgba(247,147,26,.25), rgba(247,147,26,0) 60%), var(--card-bg);
}
/* Removed cardPop keyframes (no entrance effect) */
/* @keyframes cardPop { ... } */

/* Stats layout */
.result-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 1.1rem 1.25rem;
    margin-top: .25rem;
}
.result-stats .stat { min-width:0; }
.result-stats .label { margin-bottom:.15rem; font-weight:600; letter-spacing:.25px; }
.result-stats .value { line-height:1.25; }
.result-stats .links { margin-top:.4rem; }

@media (max-width: 900px) {
    .result-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 520px) {
    .result-stats { grid-template-columns: 1fr; gap:.85rem; }
    #bb-result-card.result-card { padding: 1rem .9rem .95rem; }
    #bb-result-card.result-card .card-header { margin-bottom:.75rem; }
}

/* ---------- Mobile Sticky Footer ---------- */
@media (max-width: 720px) {
    main.container { padding-bottom: 5.5rem; } /* room so content not obscured */
    .support-footer {
        position: sticky;
        bottom: 0;
        z-index: 450;
        background: var(--header-bg);
        backdrop-filter: blur(10px);
        padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
        margin-top: 2rem;
        box-shadow: 0 -6px 22px -10px rgba(0,0,0,.35);
    }
    .support-footer .support-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Desktop-only subtle pulse when the result card is rendered (non-scroll) */
@media (min-width: 721px) {
    #bb-result-card.result-card {
        animation: resultCardPulse .9s ease-out;
    }
    @keyframes resultCardPulse {
        0%   { transform: scale(.985); box-shadow: 0 0 0 0 rgba(247,147,26,0); }
        40%  { transform: scale(1);    box-shadow: 0 0 0 6px rgba(247,147,26,.18); }
        100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(247,147,26,0); }
    }
    [data-theme=dark] #bb-result-card.result-card {
        /* slightly softer glow in dark mode */
        box-shadow: 0 0 0 0 rgba(247,147,26,0);
    }
    @media (prefers-reduced-motion: reduce) {
        #bb-result-card.result-card { animation: none !important; }
    }
}
