/* ===================================================
   HAQTECH — Base Stylesheet
   Core layout, typography, components.
   Theme colors come from theme-*.css files via CSS variables.
   =================================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, Helvetica, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: disc;
    padding-left: 1.5rem;
}

/* --- Utility --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    color: var(--text-heading);
    line-height: 1.25;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
}

h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* --- Navigation --- */
.navbar {
    background-color: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    min-height: 60px;
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.navbar-links>a {
    color: var(--nav-text);
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.navbar-links>a:hover {
    background-color: var(--nav-hover-bg);
    color: var(--accent);
}

.navbar-links>a.active {
    background-color: var(--accent);
    color: var(--accent-contrast);
}

/* Nav Dropdowns */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--nav-text);
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-dropdown-toggle:hover {
    background-color: var(--nav-hover-bg);
    color: var(--accent);
}

.nav-dropdown-toggle.active {
    background-color: var(--accent);
    color: var(--accent-contrast);
}

.nav-dropdown-toggle::after {
    content: '\25BE';
    font-size: 0.7rem;
    opacity: 0.7;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    min-width: 180px;
    z-index: 200;
    overflow: visible;
    padding: 0.25rem 0;
}

/* Invisible hover bridge — prevents menu from closing while moving mouse down */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -14px;
    left: -8px;
    right: -8px;
    height: 14px;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background-color 0.15s;
    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background-color: var(--bg-secondary);
    color: var(--accent);
}

.nav-dropdown-menu a.active {
    color: var(--accent);
    font-weight: 600;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--nav-text);
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- Hero Section --- */
.hero {
    background: var(--hero-bg);
    padding: 5rem 1.5rem 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, var(--hero-glow) 0%, transparent 50%);
    opacity: 0.4;
    pointer-events: none;
}

.hero h1 {
    position: relative;
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--hero-text);
}

.hero p {
    position: relative;
    font-size: 1.2rem;
    color: var(--hero-subtext);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-img {
    position: relative;
    max-width: 280px;
    margin: 0 auto 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background-color 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: var(--accent);
    color: var(--accent-contrast);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: var(--accent-contrast);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-outline:hover {
    background-color: var(--accent);
    color: var(--accent-contrast);
}

.store-badge {
    max-width: 200px;
    transition: transform 0.2s;
}

.store-badge:hover {
    transform: scale(1.05);
}

/* --- Sections --- */
.section {
    padding: 5rem 1.5rem;
}

.section-alt {
    background-color: var(--bg-secondary);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title h2 {
    margin-bottom: 0.5rem;
}

.section-title p {
    max-width: 550px;
    margin: 0 auto;
}

/* --- Feature Cards --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

/* --- Video Section --- */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-width: 800px;
    margin: 0 auto;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* --- Footer --- */
.footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 3rem 1.5rem 1.5rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-col h4 {
    color: var(--footer-heading);
    margin-bottom: 1rem;
}

.footer-col a {
    display: block;
    color: var(--footer-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid var(--footer-border);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Theme Switcher --- */
.theme-switcher {
    position: relative;
}

.theme-switcher-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: border-color 0.2s;
}

.theme-switcher-btn:hover {
    border-color: var(--accent);
}

.theme-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}

.theme-dropdown.open {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background-color 0.15s;
}

.theme-option:hover {
    background-color: var(--bg-secondary);
}

.theme-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--card-border);
    flex-shrink: 0;
}

/* --- Content Pages (Privacy, About) --- */
.page-header {
    background: var(--hero-bg);
    padding: 3rem 1.5rem;
    text-align: center;
}

.page-header h1 {
    color: var(--hero-text);
    position: relative;
}

.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.page-content h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
}

.page-content ul {
    margin-bottom: 1rem;
}

.page-content li {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.page-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Error Page (404) --- */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
    padding: 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    opacity: 0.2;
}

.error-page h1 {
    margin-top: -1rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero {
        padding: 3.5rem 1.5rem 3rem;
    }

    .menu-toggle {
        display: block;
    }

    .navbar-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--nav-bg);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .navbar-links.open {
        display: flex;
    }

    .navbar-links>a {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    /* Mobile dropdown */
    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-toggle {
        width: 100%;
        padding: 0.75rem 1rem;
        justify-content: space-between;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        margin-top: 0;
        background: var(--bg-secondary);
        border-radius: 6px;
        padding: 0.25rem 0;
    }

    .nav-dropdown-menu a {
        padding: 0.6rem 1rem 0.6rem 1.75rem;
        font-size: 0.85rem;
    }

    .footer-content {
        flex-direction: column;
    }

    .error-code {
        font-size: 5rem;
    }
}

/* --- Blog Cards --- */
.blog-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.blog-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.blog-card h2 {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    border-bottom: none;
    padding-bottom: 0;
}

.blog-card p {
    margin-bottom: 0.75rem;
}

.blog-card-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.blog-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.blog-tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

/* --- Contact Form --- */
.contact-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: start;
}

.contact-form-wrap h2 {
    margin-bottom: 0.5rem;
}

.contact-form {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text-heading);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-success {
    text-align: center;
    padding: 2rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-info .feature-card {
    text-align: left;
    padding: 1.5rem;
}

.contact-info .feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* --- FAQ --- */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.faq-item h3 {
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

.faq-item p {
    margin-bottom: 0;
    color: var(--text-secondary);
}

/* --- App Showcase --- */
.app-showcase {
    max-width: 700px;
    margin: 0 auto;
}

.app-card-featured {
    background: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    position: relative;
}

.app-card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.app-card-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.app-card-content h2 {
    margin-bottom: 0.75rem;
}

.app-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.app-card-features span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
}

.app-card-coming {
    position: relative;
    overflow: hidden;
}

.app-coming-badge {
    position: absolute;
    top: 12px;
    right: -30px;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.25rem 2.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    transform: rotate(35deg);
    letter-spacing: 0.05em;
}

/* --- Game Cards & Badges --- */
.game-card {
    position: relative;
    overflow: hidden;
}

.game-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    color: #fff;
}

.game-badge-easy {
    background: #4CAF50;
}

.game-badge-medium {
    background: #FF9800;
}

.game-badge-all {
    background: #9C27B0;
}

/* --- Story Content --- */
.story-content {
    max-width: 750px;
    margin: 0 auto;
}

.story-content p {
    font-size: 1.05rem;
    line-height: 1.7;
}

/* --- Responsive (new components) --- */
@media (max-width: 768px) {
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .contact-info {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .contact-info .feature-card {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .section {
        padding: 3rem 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .blog-card {
        padding: 1.5rem;
    }

    .app-card-features {
        flex-direction: column;
        align-items: center;
    }

    .contact-info {
        flex-direction: column;
    }
}