/* ---------- Theme tokens ---------- */
:root {
    --bg: #f8fafc;
    --bg-elev: #ffffff;
    --bg-elev-2: #f1f5f9;
    --text: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --shadow-color: rgba(15, 23, 42, 0.08);
}
html.dark {
    --bg: #0f172a;
    --bg-elev: #1e293b;
    --bg-elev-2: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
}
h1, h2, p { margin: 0; }
button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1.5rem;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px var(--shadow-color);
}
.header-inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
@media (min-width: 768px) {
    .header-inner { flex-direction: row; }
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon {
    width: 3rem; height: 3rem; border-radius: 9999px;
    background-color: #2563eb;
    color: white; font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}
.brand-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; }
.brand-subtitle { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); margin-top: 0.125rem; }

/* ---------- Search ---------- */
.search-wrap { position: relative; width: 100%; }
@media (min-width: 768px) { .search-wrap { width: 24rem; } }
.search-icon {
    position: absolute; left: 1rem; top: 50%;
    transform: translateY(-50%); color: var(--text-muted);
    pointer-events: none;
}
.search-input {
    width: 100%;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0.75rem 1rem 0.75rem 3rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: transparent; box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Header right ---------- */
.header-right { display: flex; align-items: center; gap: 0.75rem; }
.counter-pill {
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: inset 0 2px 4px 0 var(--shadow-color);
}
.theme-toggle {
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    transition: background-color 0.15s ease;
}
.theme-toggle:hover { background: var(--bg-elev-2); }

/* ---------- Layout ---------- */
main {
    flex-grow: 1;
    padding: 1.5rem;
    max-width: 80rem;
    margin: 0 auto;
    width: 100%;
}

.hooks-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) { .hooks-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .hooks-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .hooks-grid { grid-template-columns: repeat(4, 1fr); } }
.hooks-grid.hidden { display: none; }

/* ---------- Hook card ---------- */
.hook-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.hook-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px var(--shadow-color);
}
.hook-label {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.hook-text {
    color: var(--text);
    font-weight: 500;
    line-height: 1.375;
}
.hook-body { margin-bottom: 1rem; }

.copy-btn {
    margin-top: auto;
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-elev-2);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn:active { transform: scale(0.97); }
.copy-btn.copied { background: #10b981 !important; color: #fff !important; }

/* ---------- Empty state ---------- */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
    color: var(--text-muted);
}
.empty-state.visible { display: flex; }
.empty-state .icon { font-size: 3.75rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h2 { font-size: 1.25rem; font-weight: 600; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
