/* =========================================
   RICHZEX — HOME PAGE STYLES
   Phase 2.1 — Frontend
========================================= */

/* 1. Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 2. Design Variables */
:root {
    --bg-color: #080d18;
    --surface-color: #111827;
    --surface-light: #182235;
    --text-color: #f1f5f9;
    --muted-color: #94a3b8;
    --primary-color: #00c8ff;
    --secondary-color: #8b5cf6;
    --border-color: rgba(148, 163, 184, 0.18);
    --container-width: 1120px;
}

/* 3. Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(100% - 40px, var(--container-width));
    margin-inline: auto;
}

/* 4. Header and Navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    padding: 18px 0;
    background: rgba(8, 13, 24, 0.92);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.logo {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #e2e8f0;
    text-shadow: 0 0 18px rgba(0, 200, 255, 0.18);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.main-nav a {
    color: var(--muted-color);
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
    color: var(--primary-color);
}

/* 5. Hero Section */
.hero {
    position: relative;
    overflow: hidden;
    padding: 112px 0 120px;
    text-align: center;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(0, 200, 255, 0.13), transparent 42%),
        radial-gradient(ellipse at 80% 75%, rgba(139, 92, 246, 0.16), transparent 42%),
        var(--bg-color);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 850px;
}

.hero-label,
.section-label {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
}

.hero h1 {
    margin: 18px 0;
    font-size: clamp(38px, 7vw, 68px);
    line-height: 1.12;
    font-weight: 800;
}

.hero h1 span {
    display: inline-block;
    background: linear-gradient(90deg, #e2e8f0, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-description {
    max-width: 620px;
    margin: 0 auto 30px;
    color: var(--muted-color);
    font-size: 17px;
}

.primary-button {
    display: inline-block;
    padding: 12px 26px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background: linear-gradient(100deg, rgba(0, 200, 255, 0.16), rgba(139, 92, 246, 0.16));
    color: var(--text-color);
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:hover,
.primary-button:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 200, 255, 0.16);
}

/* 6. Shared Section Styles */
.apps-section,
.about-section {
    padding: 82px 0;
}

.apps-section {
    background: #0b1220;
}

.section-heading {
    max-width: 680px;
    margin: 0 auto 34px;
    text-align: center;
}

.section-heading h2 {
    margin: 10px 0;
    font-size: clamp(28px, 4vw, 38px);
}

.section-heading > p:last-child {
    color: var(--muted-color);
}

/* 7. App Search */
.app-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto 34px;
}

.app-search input,
.app-search select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    background: var(--surface-color);
    color: var(--text-color);
    font: inherit;
}

.app-search input::placeholder {
    color: #718096;
}

.app-search input:focus,
.app-search select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.1);
}

/* 8. App Grid and Empty State */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 22px;
}

.app-card {
    min-width: 0;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--surface-light), var(--surface-color));
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.app-card h3 {
    margin-bottom: 8px;
    color: var(--text-color);
    font-size: 21px;
}

.app-category {
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 200, 255, 0.1);
    color: var(--primary-color);
    font-size: 12px;
}

.app-card p {
    color: var(--muted-color);
    font-size: 14px;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 42px 24px;
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    background: var(--surface-color);
    text-align: center;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 22px;
}

.empty-state p {
    color: var(--muted-color);
}

/* 9. About Section */
.about-section {
    background:
        radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, 0.09), transparent 55%),
        var(--bg-color);
}

.about-section .section-heading {
    margin-bottom: 0;
}

/* 10. Footer */
.site-footer {
    padding: 24px 0;
    border-top: 1px solid var(--border-color);
    background: #070b13;
    color: var(--muted-color);
    text-align: center;
    font-size: 13px;
}

/* 11. Keyboard Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

/* 12. Responsive Design */
@media (max-width: 600px) {
    .container {
        width: min(100% - 30px, var(--container-width));
    }

    .site-header {
        padding: 15px 0;
    }

    .logo {
        font-size: 22px;
    }

    .main-nav {
        gap: 14px;
    }

    .main-nav a {
        font-size: 13px;
    }

    .hero {
        padding: 82px 0 90px;
    }

    .hero-description {
        font-size: 15px;
    }

    .apps-section,
    .about-section {
        padding: 62px 0;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 360px) {
    .header-container {
        gap: 12px;
    }

    .logo {
        font-size: 19px;
        letter-spacing: 1px;
    }

    .main-nav {
        gap: 10px;
    }

    .main-nav a {
        font-size: 12px;
    }
}


/* 13. App Details Button */
.details-button {
    display: inline-block;
    margin-top: 18px;
    padding: 9px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 7px;
    background: rgba(0, 200, 255, 0.08);
    color: var(--primary-color);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.details-button:hover {
    background: var(--primary-color);
    color: #06111b;
}

/* 14. App Details Dialog */
body.modal-open {
    overflow: hidden;
}

.details-overlay[hidden] {
    display: none;
}

.details-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(2, 6, 15, 0.82);
    backdrop-filter: blur(8px);
}

.details-panel {
    position: relative;
    width: min(100%, 520px);
    max-height: min(85vh, 700px);
    overflow-y: auto;
    padding: 32px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: linear-gradient(145deg, var(--surface-light), var(--surface-color));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.details-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--text-color);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.details-panel h2 {
    margin: 12px 42px 12px 0;
    font-size: clamp(25px, 6vw, 34px);
}

.details-category {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 20px;
    background: rgba(0, 200, 255, 0.1);
    color: var(--primary-color);
    font-size: 12px;
}

.details-description {
    margin: 22px 0;
    color: var(--muted-color);
}

.details-meta {
    display: grid;
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.details-meta div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.details-meta dt {
    color: var(--muted-color);
}

.details-meta dd {
    color: var(--text-color);
    text-align: right;
    font-weight: 600;
}

@media (max-width: 480px) {
    .app-search {
        grid-template-columns: 1fr;
    }

    .details-panel {
        padding: 26px 20px;
    }
}


/* 15. Responsive Navigation and Layout Refinements */
.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 9px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 4px 0;
    border-radius: 2px;
    background: var(--text-color);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header {
    scroll-margin-top: 80px;
}

main section {
    scroll-margin-top: 86px;
}

@media (max-width: 700px) {
    .header-container {
        position: relative;
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: block;
        margin-left: auto;
    }

    .main-nav {
        display: none;
        order: 3;
        flex: 0 0 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        background: var(--surface-color);
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        padding: 12px 10px;
        border-radius: 6px;
        font-size: 15px;
    }

    .main-nav a:hover,
    .main-nav a:focus-visible {
        background: rgba(0, 200, 255, 0.08);
    }

    .hero {
        padding: 76px 0 82px;
    }

    .hero-description {
        max-width: 540px;
    }
}

@media (max-width: 420px) {
    .container {
        width: min(100% - 28px, var(--container-width));
    }

    .hero h1 {
        font-size: clamp(34px, 10vw, 44px);
    }

    .hero-label,
    .section-label {
        letter-spacing: 2px;
    }

    .app-card {
        padding: 21px;
    }

    .details-overlay {
        padding: 12px;
    }

    .details-panel {
        max-height: 90vh;
        padding: 24px 18px;
    }

    .details-meta div {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .details-meta dd {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* 16. SEO and Accessibility Refinements */
.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    padding: 10px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background: var(--surface-color);
    color: var(--text-color);
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

#mainContent:focus {
    outline: none;
}

.app-grid[aria-live] {
    min-height: 1px;
}


/* 17. Published App Release and Download */
.download-button {
    display: inline-block;
    margin: 18px 8px 0 0;
    padding: 9px 16px;
    border: 1px solid var(--secondary-color);
    border-radius: 7px;
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.download-button:hover,
.download-button:focus-visible {
    background: var(--secondary-color);
    color: #fff;
}

.details-release {
    display: grid;
    gap: 14px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.details-release[hidden] {
    display: none;
}

.details-release p {
    color: var(--muted-color);
    font-size: 14px;
}

.details-release .download-button {
    justify-self: start;
    margin-top: 0;
}


/* 18. Published Android version history */
.release-history {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.release-history[hidden] {
    display: none;
}

.release-history h3 {
    font-size: 17px;
}

.release-history ul {
    display: grid;
    gap: 12px;
    list-style: none;
}

.release-history li {
    display: grid;
    gap: 5px;
    padding: 13px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: rgba(8, 13, 24, 0.42);
}

.release-history li strong {
    color: var(--text-color);
    font-size: 14px;
}

.release-history li span,
.release-history li p {
    color: var(--muted-color);
    font-size: 13px;
}

.release-history li a {
    width: fit-content;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 700;
}

.release-history li a:hover,
.release-history li a:focus-visible {
    text-decoration: underline;
}
