/* ═══════════════════════════════════════════
   PEREZ FAMILY — Design System
   Dark-first. Inter (body) + Cormorant Garamond (display).
   Inspired by gradi.world, adapted for private family portal.
   ═══════════════════════════════════════════ */

/* ── Fonts ── */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('fonts/inter-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('fonts/inter-medium.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('fonts/inter-semibold.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('fonts/inter-bold.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 400; font-display: swap; src: url('fonts/cormorant-garamond-400.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 400; font-style: italic; font-display: swap; src: url('fonts/cormorant-garamond-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-display: swap; src: url('fonts/cormorant-garamond-500.woff2') format('woff2'); }

/* ── Variables ── */
:root {
    --bg-void: #0a0a12;
    --bg-primary: #0f0f1a;
    --bg-surface: #1a1a2e;
    --bg-card: #1e1e32;
    --bg-elevated: #262640;

    --accent: #7c3aed;
    --accent-light: #9b6af7;
    --accent-dim: rgba(124, 58, 237, 0.4);
    --accent-glow: rgba(124, 58, 237, 0.08);
    --accent-subtle: rgba(124, 58, 237, 0.12);

    --color-blue: #3b82f6;
    --color-green: #10b981;
    --color-red: #ef4444;
    --color-amber: #f59e0b;
    --color-gold: #eab308;

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a88;

    --color-border: #2a2a40;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Cormorant Garamond', 'Georgia', serif;

    --ease-smooth: cubic-bezier(0.23, 1, 0.32, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.3s;

    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html { touch-action: manipulation; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Header ── */
.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: 56px;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.back-btn {
    position: absolute; left: 0;
    background: none; border: none;
    color: var(--text-muted); font-size: 1.4rem;
    cursor: pointer; min-width: 56px; min-height: 56px;
    display: flex; align-items: center; justify-content: center;
    transition: color var(--duration-fast);
    text-decoration: none;
}
@media (hover: hover) { .back-btn:hover { color: var(--accent-light); } }
.header-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Main content area ── */
.main {
    padding: 72px var(--space-sm) calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
    max-width: 560px;
    margin: 0 auto;
}

/* ── Cards ── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    transition: border-color var(--duration-normal) var(--ease-smooth),
                transform var(--duration-fast) var(--ease-smooth),
                box-shadow var(--duration-normal);
}
@media (hover: hover) {
    .card:hover {
        border-color: var(--accent-dim);
        box-shadow: 0 4px 20px rgba(124, 58, 237, 0.08);
        transform: translateY(-1px);
    }
}
.card:active { transform: scale(0.985); }

/* ── Stat cards row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin: var(--space-md) 0;
}
.stat-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-xs);
    text-align: center;
    border: 1px solid var(--color-border);
    transition: border-color var(--duration-normal);
}
.stat-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-card .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.stat-card.accent { border-color: var(--accent-dim); }
.stat-card.accent .value { color: var(--accent-light); }
.stat-card.red { border-color: rgba(239, 68, 68, 0.3); }
.stat-card.red .value { color: var(--color-red); }
.stat-card.green { border-color: rgba(16, 185, 129, 0.3); }
.stat-card.green .value { color: var(--color-green); }

/* ── Chart sections ── */
.chart-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin: var(--space-sm) 0;
    border: 1px solid var(--color-border);
}
.chart-section h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.chart-section .description {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}
.chart-section .description strong { color: var(--text-secondary); }
.chart-container { position: relative; height: 260px; }

/* ── Bio section ── */
.bio {
    background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-md) 0;
    border: 1px solid var(--color-border);
    line-height: 1.8;
}
.bio h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}
.bio p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: var(--space-xs);
}
.bio .signoff {
    margin-top: var(--space-md);
    font-family: var(--font-display);
    font-style: italic;
    color: var(--accent-light);
    font-size: 1.1rem;
}

/* ── Password screen ── */
.password-screen {
    position: fixed; inset: 0;
    background: var(--bg-primary);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 2000;
}
.password-screen h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.password-screen .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}
.password-screen input {
    background: var(--bg-surface);
    border: 1.5px solid var(--color-border);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    text-align: center;
    width: 260px;
    outline: none;
    transition: border-color var(--duration-normal);
}
.password-screen input:focus { border-color: var(--accent); }
.password-screen .error {
    color: var(--color-red);
    margin-top: var(--space-xs);
    font-size: 0.8rem;
    display: none;
}

/* ── Family landing page ── */
.landing {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: var(--space-lg);
}
.landing h1 {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.landing .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-xl);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
    font-size: 0.7rem;
}
.members {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-sm);
    max-width: 420px;
    width: 100%;
}
a.member-card {
    background: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-sm);
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color var(--duration-normal) var(--ease-smooth),
                transform var(--duration-fast) var(--ease-smooth),
                box-shadow var(--duration-normal);
}
@media (hover: hover) {
    a.member-card:hover {
        border-color: var(--accent-dim);
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(124, 58, 237, 0.1);
    }
}
a.member-card:active { transform: scale(0.97); }
.member-card .icon {
    font-size: 2.2rem;
    margin-bottom: var(--space-xs);
    opacity: 0.9;
}
.member-card .name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 500;
}
.member-card .desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* ── Footer ── */
.footer {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-align: center;
    padding: var(--space-lg) 0 var(--space-sm);
    letter-spacing: 0.03em;
    opacity: 0.5;
}

/* ── Page transition ── */
.page-transition {
    position: fixed; inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}
.page-transition.fade-out { opacity: 0; }
