/* ============================================
   Home Page — dark-first modern hub
   Overrides on top of base.css
   ============================================ */
body {
    min-height: 100vh;
    min-height: 100dvh;
}

/* Fade overlay for smooth page transition */
#fade-overlay {
    position: fixed;
    inset: 0;
    background: #05070c;
    opacity: 1;
    z-index: 10000;
    pointer-events: none;
    transition: opacity 1.2s ease-in;
}

.background-image {
    background-image: url('assets/bg-home.png');
    opacity: 0.10;
}

/* --- Container --- */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 56px 24px;
    position: relative;
    z-index: 1;
}

/* --- Header --- */
.home-header {
    text-align: center;
    margin-bottom: 52px;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-header h1 {
    font-family: var(--font-brand);
    /* "OpeningMastermind" is a single long word — the floor must be small
       enough that it fits a 320px phone without clipping under overflow-x. */
    font-size: clamp(1.7rem, 7vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #aebbe0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
body.theme-light .home-header h1 {
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--text);
}

.home-header p {
    font-size: 1.02rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.04em;
}

/* --- Navigation Cards (grid) --- */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 760px;
    width: 100%;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.nav-card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 30px 28px;
    cursor: pointer;
    transition: transform var(--ease-bounce), border-color var(--ease-default),
                box-shadow var(--ease-default), background var(--ease-default);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 18px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
body.theme-light .nav-card {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
}

.nav-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(420px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                rgba(91, 155, 213, 0.12) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.nav-card:hover::before { opacity: 1; }

.nav-card:hover {
    transform: translateY(-5px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    background: rgba(91, 155, 213, 0.08);
    border: 1px solid var(--border);
    transition: all var(--ease-bounce);
}

/* Chess piece glyph inside the icon tile */
.card-glyph {
    font-size: 2rem;
    line-height: 1;
    color: var(--accent-light);
    transition: transform var(--ease-bounce), color var(--ease-default);
}
.nav-card:hover .card-glyph {
    transform: scale(1.08);
    color: var(--accent-light);
}
.nav-card:hover .card-icon {
    transform: scale(1.06) translateY(-1px);
    color: var(--accent-light);
    border-color: var(--border-hover);
}

.card-content { flex: 1; }

.card-content h2 {
    font-family: var(--font-brand);
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 7px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    font-weight: 300;
}

.card-arrow {
    position: absolute;
    top: 30px;
    right: 26px;
    color: var(--text-faint);
    transition: all var(--ease-bounce);
    opacity: 0;
    transform: translateX(-8px);
}
.nav-card:hover .card-arrow {
    color: var(--accent-light);
    opacity: 1;
    transform: translateX(0);
}

/* Uniform blue accent on hover (all cards) */
.nav-card:hover { border-color: rgba(91, 155, 213, 0.5); }
.nav-card:hover .card-icon { background: rgba(91, 155, 213, 0.14); }

/* --- "Your collection" section: Repertoire sits apart from the modes --- */
.nav-section-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 760px;
    width: 100%;
    margin: 34px 0 16px;
    animation: fadeInUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}
.nav-section-divider::before,
.nav-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.nav-section-divider span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.nav-cards-solo {
    grid-template-columns: repeat(2, 1fr);
    animation-delay: 0.35s;
}
/* Insights sits on its own centered row below, same card size as the pair */
#insights-card {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: 370px;
}
@media (max-width: 720px) {
    .nav-cards-solo { grid-template-columns: 1fr; }
}

/* Wide, horizontal layout for the lone Repertoire card */
.nav-card-wide {
    flex-direction: row;
    align-items: center;
    padding: 24px 28px;
}
.nav-card-wide .card-icon { flex-shrink: 0; }
.nav-card-wide .card-content h2 { margin-bottom: 4px; }
.nav-card-wide .card-arrow {
    position: static;
    margin-left: auto;
    flex-shrink: 0;
}

/* --- Footer --- */
.home-footer {
    text-align: center;
    margin-top: 52px;
    animation: fadeInUp 1s ease-out 0.5s both;
}
.home-footer p {
    color: var(--text-faint);
    font-size: 0.92rem;
    font-weight: 300;
    letter-spacing: 0.04em;
}

/* --- Exported Lines --- */
.exported-lines-container {
    width: 100%;
    max-width: 1000px;
    margin: 40px 0;
}

.no-lines-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.no-lines-message svg { margin-bottom: 20px; }
.no-lines-message h3 { font-size: 1.5rem; color: var(--text-secondary); margin-bottom: 10px; }
.no-lines-message p { font-size: 1rem; color: var(--text-muted); }

.exported-lines-list { display: flex; flex-direction: column; gap: 20px; }

.exported-line-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--ease-default);
}
.exported-line-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.line-opening { font-size: 1.1rem; font-weight: 600; color: var(--accent-light); }
.line-date { font-size: 0.85rem; color: var(--text-muted); }

.line-notation {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    border: 1px solid var(--border);
}
body.theme-light .line-notation { background: rgba(240, 244, 248, 0.65); }

.line-actions { margin-top: 15px; display: flex; gap: 10px; }

.line-action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    font-size: 0.8rem;
    transition: all var(--ease-default);
}
.line-action-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    color: var(--text);
}
.delete-btn:hover {
    background: var(--error-soft);
    border-color: var(--error);
    color: var(--error);
}

/* --- Responsive --- */
@media (max-width: 720px) {
    .nav-cards { grid-template-columns: 1fr; }
    .line-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .line-actions { flex-wrap: wrap; }
}

/* Home-specific: theme toggle offset */
.theme-toggle-btn { left: calc(72px + env(safe-area-inset-left)); }


/* --- The Agent card (premium) --- */
.nav-agent-row { margin-top: 20px; grid-template-columns: 1fr; }
.nav-card-agent {
    border-color: rgba(255, 210, 138, 0.35);
    background: linear-gradient(160deg, rgba(255, 210, 138, 0.05) 0%, rgba(255, 255, 255, 0.015) 60%);
}
.nav-card-agent:hover {
    border-color: rgba(255, 210, 138, 0.65) !important;
    box-shadow: 0 6px 26px rgba(255, 210, 138, 0.12);
}
.nav-card-agent .card-glyph { color: #ffd28a; }
.nav-card-agent:hover .card-icon { background: rgba(255, 210, 138, 0.10); }
.agent-pill {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #ffd28a;
    border: 1px solid rgba(255, 210, 138, 0.45);
    border-radius: 999px;
    padding: 2px 9px;
}


/* --- Equal-sized mode cards (modes grid only; collection + agent rows keep
   their own compact shapes) --- */
.nav-cards:not(.nav-cards-solo) > .nav-card { min-height: 188px; }
.nav-cards-solo > .nav-card-wide { min-height: 104px; }

.footer-link { color: var(--text-muted); text-decoration: none; border-bottom: 1px dotted var(--border-hover); }
.footer-link:hover { color: var(--accent-light); }


/* --- Currents button nested in the agent card --- */
.agent-sub-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    background: rgba(126, 231, 255, 0.05);
    border: 1px solid rgba(185, 166, 255, 0.35);
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all var(--ease-snappy, 0.15s ease);
}
.agent-sub-btn:hover {
    border-color: rgba(126, 231, 255, 0.7);
    color: #7ee7ff;
    box-shadow: 0 0 14px rgba(126, 231, 255, 0.15);
}
.agent-sub-glyph { color: #7ee7ff; font-size: 0.9rem; line-height: 1; }
.exp-pill {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #b9a6ff;
    border: 1px solid rgba(185, 166, 255, 0.45);
    border-radius: 999px;
    padding: 2px 9px;
}

.agent-sub-row { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-sub-row .agent-sub-btn { margin-top: 12px; }


/* --- Global settings (home) --- */
.home-settings-btn {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: calc(14px + env(safe-area-inset-right));
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all var(--ease-snappy, 0.15s ease);
}
.home-settings-btn:hover { border-color: var(--accent); color: var(--accent-light); transform: rotate(20deg); }
.home-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(3, 5, 9, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.home-settings-modal {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xl, 16px);
    padding: 22px 24px 26px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.25s ease both;
}
.home-settings-head { display: flex; align-items: center; justify-content: space-between; }
.home-settings-head h3 {
    font-family: var(--font-brand);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
}
.home-settings-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.home-settings-close:hover { color: var(--text); }
.home-settings-sub { font-size: 0.76rem; color: var(--text-muted); margin: 4px 0 16px; }
.home-setting {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.home-setting select {
    background: var(--card-bg, rgba(10,12,18,0.5));
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.86rem;
    padding: 9px 12px;
}
.home-setting select:focus { outline: none; border-color: var(--accent); }
