/* ============================================================
   RESET + TYPOGRAPHY + LAYOUT
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden { display: none !important; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background var(--transition-base), color var(--transition-base);
}

/* Subtle grid background in dark mode */
[data-theme="dark"] body {
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
    line-height: 1.2;
    font-weight: 700;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

/* ── App layout ── */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--accent);
}

.app-header .logo span {
    font-size: var(--text-xl);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ── Navigation ── */
.app-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0 var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.app-nav a:hover {
    color: var(--text-primary);
}

.app-nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Main content ── */
.app-main {
    flex: 1;
    max-width: var(--max-content-width);
    width: 100%;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

/* ── Page transitions ── */
.page-enter {
    animation: fadeIn var(--transition-base) ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-bright);
}

/* ── Selection ── */
::selection {
    background: rgba(0, 229, 255, 0.3);
    color: var(--text-primary);
}
