/* ==========================================================================
   catherina.dev App Store Design System & Styles
   ========================================================================== */

:root {
    /* Color Palette - Dark Theme (Default) */
    --bg-primary: #0a0c10;
    --bg-secondary: #12161f;
    --bg-tertiary: #1b212d;
    --bg-glass: rgba(18, 22, 31, 0.75);
    --bg-glass-card: rgba(23, 29, 41, 0.65);
    --bg-modal: rgba(14, 17, 24, 0.96);

    --text-primary: #f0f4fc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-purple: #a855f7;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #a855f7 100%);
    --card-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    --hero-glow: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.18) 0%, rgba(56, 189, 248, 0.08) 40%, transparent 70%);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.35);
    --border-card: rgba(255, 255, 255, 0.09);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 35px rgba(56, 189, 248, 0.2);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    --radius-squircle: 22.5%;

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --brand-gradient: linear-gradient(135deg, #ffffff 0%, #cbd5e1 45%, #94a3b8 100%);

    --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-card: rgba(255, 255, 255, 0.9);
    --bg-modal: rgba(255, 255, 255, 0.98);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --brand-gradient: linear-gradient(135deg, #0f172a 0%, #334155 50%, #64748b 100%);

    --primary-gradient: linear-gradient(135deg, #0284c7 0%, #0284c7 50%, #1d4ed8 100%);
    --card-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.6) 100%);
    --hero-glow: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.1) 0%, rgba(56, 189, 248, 0.05) 40%, transparent 70%);

    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-hover: rgba(2, 132, 199, 0.4);
    --border-card: rgba(15, 23, 42, 0.08);

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 35px rgba(2, 132, 199, 0.15);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* Ambient Background Glow */
.bg-ambient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hero-glow);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-subtle);
    transition: all var(--transition-normal);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #333842;
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.brand:hover .brand-icon {
    transform: scale(1.05);
    background: #3d434f;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.github-link, .theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.github-link:hover, .theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.theme-toggle svg, .github-link svg {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Hero Section (Minimal)
   ========================================================================== */

.hero-section {
    padding: 3rem 0 2rem;
    text-align: center;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 4.5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
}

/* ==========================================================================
   Controls: Search Bar & Category Filter (Hidden until more apps are added)
   ========================================================================== */

.controls-bar,
.apps-count-label {
    display: none !important;
}

.controls-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
    .controls-bar {
        flex-direction: row;
        justify-content: space-between;
    }
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 42px;
    padding: 0 2.25rem 0 2.75rem;
    background: var(--bg-glass-card);
    border: 1px solid var(--border-card);
    border-radius: 9999px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.search-clear {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    padding: 4px;
    border-radius: 50%;
}

.search-clear:hover {
    color: var(--text-primary);
}

.category-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.category-btn {
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    background: var(--bg-glass-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.category-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-tertiary);
}

.category-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Minimal App Store Icon Grid
   ========================================================================== */

.apps-count-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .apps-count-label {
        text-align: left;
    }
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 2.25rem 1.5rem;
    justify-content: center;
    margin-bottom: 5rem;
}

@media (min-width: 640px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 2.75rem 2rem;
    }
}

@media (min-width: 1024px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 3rem 2.25rem;
    }
}

/* Minimal App Icon Item (Launchpad / App Store style) */
.app-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    outline: none;
    transition: transform var(--transition-fast);
    position: relative;
    user-select: none;
    color: inherit;
    font-family: inherit;
}

.app-icon-item:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-blue);
}

.app-icon-box {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-squircle);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

@media (min-width: 768px) {
    .app-icon-box {
        width: 96px;
        height: 96px;
    }
}

.app-icon-item:hover .app-icon-box {
    transform: translateY(-6px) scale(1.06);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-hover);
}

.app-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-icon-label {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-fast);
}

.app-icon-item:hover .app-icon-label {
    color: var(--accent-blue);
}

.app-icon-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* No results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ==========================================================================
   Modal Dialog (App Store Product Sheet)
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    position: relative;
    background: var(--bg-modal);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.5);
    transform: translateY(24px) scale(0.97);
    transition: transform var(--transition-smooth), opacity var(--transition-smooth);
    opacity: 0;
    scrollbar-width: thin;
}

.modal-backdrop.active .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-close-btn {
    position: sticky;
    top: 1.25rem;
    float: right;
    margin-right: 1.25rem;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: scale(1.08);
}

.modal-content-inner {
    padding: 2.25rem;
    clear: both;
}

/* Modal Hero Header */
.modal-header-hero {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.modal-icon-wrapper {
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    border-radius: var(--radius-squircle);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.modal-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal-header-meta {
    flex: 1;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.modal-subtitle {
    font-size: 0.98rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.6rem;
}

.modal-dev-line {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-dev-link {
    color: var(--accent-blue);
    text-decoration: none;
}

/* Modal Action Bar */
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.modal-btn-launch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.modal-btn-launch:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal Quick Stats Row */
.modal-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    margin-bottom: 2rem;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Modal Sections */
.modal-section {
    margin-bottom: 2rem;
}

.modal-section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-desc-text {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.98rem;
}

/* Feature checklist */
.modal-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-feature-check {
    color: var(--accent-emerald);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

/* Tech Pills */
.modal-tech-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-tech-pill {
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--bg-glass);
    position: relative;
    z-index: 10;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
