/* ==========================================================
   HearthByte Site — Shared Dark-Theme Base Stylesheet
   ==========================================================
   Used by: index, about, products/chaosflow, ensemble/pricing,
            legal/privacy, legal/terms

   NOT used by: tool pages (use shared.css + tool-template.css)
                light-theme product pages (exanima, catgame, inthered)
                ensemble sub-pages (use ensemble.css)
   ========================================================== */

@import url('tokens.css');

/* === Site-specific variable overrides === */
/* tokens.css provides all canonical + legacy variables.
   These overrides adjust values that differ for the main site pages. */
:root {
    --bg-elevated: #16133A;
    --surface-hover: #16133A;
    --text-primary: #E2E0ED;
    --text-secondary: #9B97B8;
    --text-muted: #6B6889;
    --container-width: 1200px;
}

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

/* === Base === */
html, body {
    background-color: var(--bg-color);
    color: var(--body-text);
    font-family: var(--body-font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Grain texture overlay */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.03;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--display-font);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
    color: var(--body-text);
}

a {
    color: var(--primary-accent);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--body-text);
}

ul, ol {
    color: var(--secondary-text);
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* === Layout === */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--body-font);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--secondary-accent);
    color: var(--bg-color);
    box-shadow: 0 2px 12px rgba(217, 174, 131, 0.15);
}

.btn-primary:hover {
    background-color: var(--copper-hover);
    color: var(--bg-color);
    box-shadow: 0 4px 16px rgba(217, 174, 131, 0.25);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-accent);
    border: 1px solid var(--primary-accent);
    box-shadow: 0 0 0 0 var(--glow);
}

.btn-secondary:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    box-shadow: 0 0 0 4px var(--glow);
    transform: translateY(-1px);
}

.btn + .btn {
    margin-left: 1rem;
}

/* === Header === */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background-color: rgba(8, 6, 26, 0.8);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.header-inner {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Logo === */
.logo {
    font-family: var(--display-font);
    font-size: 1.5rem;
    color: var(--body-text);
    display: flex;
    align-items: center;
    position: relative;
    text-decoration: none;
}

.logo-hearth {
    font-weight: 400;
}

.logo-byte {
    font-weight: 700;
}

.logo-dot {
    position: relative;
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--secondary-accent);
    margin: 0 1px;
    box-shadow: 0 0 10px var(--secondary-accent);
}

/* === Navigation === */
nav {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 2rem;
}

.nav-links a {
    color: var(--secondary-text);
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--body-text);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary-accent);
    bottom: 0;
    left: 0;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-links a:hover::after {
    width: 100%;
}

/* === Mobile Menu Toggle === */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--body-text);
    transition: all 0.3s ease;
}

/* === Section Headings === */
.section-heading {
    text-align: center;
    margin-bottom: 1rem;
    font-size: clamp(2rem, 5vw, 3rem);
}

.section-subheading {
    text-align: center;
    color: var(--secondary-text);
    max-width: 600px;
    margin: 0 auto 4rem;
    font-size: 1.25rem;
}

/* === Page Hero (subpages) === */
.page-hero {
    padding-top: calc(var(--header-height) + 60px);
    padding-bottom: 60px;
    text-align: center;
    position: relative;
}

/* === Product Hero === */
.product-hero {
    padding-top: calc(var(--header-height) + 80px);
    padding-bottom: 60px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.product-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    display: block;
    filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.2));
}

.hero-text {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3rem;
}

.hero-text h1 {
    font-family: var(--display-font);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 1rem;
}

.hero-tagline {
    font-size: 1.5rem;
    color: var(--secondary-text);
    margin-bottom: 1.25rem;
}

.hero-text p {
    color: var(--secondary-text);
    margin-bottom: 1.75rem;
    font-size: 1.1rem;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Hero Screenshot (browser frame) === */
.hero-screenshot {
    max-width: 900px;
    margin: 0 auto;
}

.screenshot-frame {
    background-color: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: perspective(1000px) rotateX(2deg);
    border: 1px solid var(--border-color);
}

.screenshot-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: rgba(8, 6, 26, 0.9);
    border-bottom: 1px solid var(--border-color);
}

.screenshot-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.screenshot-dot:nth-child(1) { background: #ff5f57; }
.screenshot-dot:nth-child(2) { background: #ffbd2e; }
.screenshot-dot:nth-child(3) { background: #28c840; }

.screenshot-title {
    margin-left: 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: system-ui;
}

.screenshot-frame img {
    width: 100%;
    height: auto;
    display: block;
}

/* === Content Sections === */
.content-section {
    padding: var(--section-spacing) 0;
}

.content-section:nth-child(odd) {
    background-color: var(--bg-color);
}

.content-section:nth-child(even) {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* === Screenshot Gallery === */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.screenshot-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.screenshot-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
    transform: translateY(-4px);
    background-color: var(--surface-hover);
}

.screenshot-card img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-card-caption {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.screenshot-card-caption h3 {
    font-family: var(--display-font);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.screenshot-card-caption p {
    font-size: 1rem;
    color: var(--secondary-text);
    margin-bottom: 0;
}

/* === Video Section === */
.video-wrapper {
    max-width: 800px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: var(--surface-color);
    aspect-ratio: 16/9;
    border: 1px solid var(--border-color);
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* === Features Grid === */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
    transform: translateY(-4px);
    background-color: var(--surface-hover);
}

.feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(167, 139, 250, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
    color: var(--primary-accent);
}

.feature-icon svg {
    width: 20px;
    height: 20px;
}

.feature-card h3 {
    font-family: var(--display-font);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.feature-card p {
    color: var(--secondary-text);
    font-size: 1rem;
    margin-bottom: 0;
}

/* === Shortcuts Grid === */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.shortcut kbd {
    font-family: var(--mono-font);
    font-size: 0.9rem;
    background-color: rgba(8, 6, 26, 0.8);
    color: var(--primary-accent);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.shortcut span {
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* === Pricing Card === */
.price-card {
    background-color: var(--surface-color);
    border: 2px solid var(--primary-accent);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 40px rgba(167, 139, 250, 0.12);
    text-align: center;
}

.price-amount {
    font-family: var(--display-font);
    font-size: 3rem;
    color: var(--secondary-accent);
    margin-bottom: 0.25rem;
}

.price-term {
    color: var(--muted-text);
    margin-bottom: 1.5rem;
}

.price-features {
    list-style: none;
    text-align: left;
    margin-bottom: 1.5rem;
    padding-left: 0;
}

.price-features li {
    padding: 0.5rem 0;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
}

.price-features li svg {
    width: 18px;
    height: 18px;
    color: var(--primary-accent);
    flex-shrink: 0;
}

/* === About Content === */
.about-content {
    padding: var(--section-spacing) 0;
}

.about-section {
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.about-section h2 {
    font-family: var(--display-font);
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--body-text);
}

.about-section p {
    color: var(--secondary-text);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

.about-section ul {
    color: var(--secondary-text);
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.about-section li {
    margin-bottom: 0.5rem;
}

/* === Quote Box === */
.quote-box {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin: 2rem auto;
    max-width: fit-content;
    position: relative;
    transition: all 0.3s ease;
    border-left: 3px solid var(--primary-accent);
}

.quote-box:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
    transform: translateY(-2px);
    background-color: var(--surface-hover);
}

.quote-box p {
    font-family: var(--display-font);
    font-style: italic;
    color: var(--body-text);
    margin: 0;
}

/* === Highlight Box (legal pages) === */
.highlight {
    background: rgba(167, 139, 250, 0.1);
    border-left: 3px solid var(--primary-accent);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* === Team Card === */
.team-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

.team-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.1);
    transform: translateY(-2px);
    background-color: var(--surface-hover);
}

.team-card h3 {
    font-family: var(--display-font);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.team-role {
    color: var(--primary-accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.team-card p {
    color: var(--secondary-text);
    font-size: 1rem;
    line-height: 1.7;
}

/* === CTA Section === */
.cta-section {
    padding: var(--section-spacing) 0;
    background-color: var(--surface-color);
    position: relative;
    text-align: center;
}

.cta-section::before,
.cta-section::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(167, 139, 250, 0) 0%, var(--primary-accent) 50%, rgba(167, 139, 250, 0) 100%);
}

.cta-section::before { top: 0; }
.cta-section::after { bottom: 0; }

.cta-content {
    max-width: 560px;
    margin: 0 auto;
}

.cta-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    color: var(--secondary-text);
    margin-bottom: 2rem;
}

/* === Newsletter === */
.newsletter {
    padding: var(--section-spacing) 0;
    background: linear-gradient(180deg, var(--bg-color) 0%, rgba(8, 6, 26, 0.98) 50%, rgba(217, 174, 131, 0.04) 100%);
    position: relative;
}

.newsletter-inner {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.newsletter-heading {
    font-family: var(--display-font);
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.newsletter-subtext {
    color: var(--secondary-text);
    margin-bottom: 2rem;
}

.newsletter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.newsletter-input,
.newsletter-form input[type="email"] {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: rgba(15, 13, 36, 0.5);
    color: var(--body-text);
    font-family: var(--body-font);
    min-width: 200px;
}

.newsletter-input:focus,
.newsletter-form input:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 2px var(--glow);
}

.newsletter-btn,
.newsletter-form button {
    background-color: var(--secondary-accent);
    color: var(--bg-color);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.newsletter-btn:hover,
.newsletter-form button:hover {
    background-color: var(--copper-hover);
    transform: translateY(-1px);
}

.privacy-text {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--muted-text);
}

/* === Tables (legal pages) === */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--body-text);
    font-weight: 600;
}

td {
    color: var(--secondary-text);
}

/* === Code Blocks === */
.code-block {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
    font-family: var(--mono-font);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
    max-width: 100%;
}

.token-string {
    color: var(--secondary-accent);
}

.token-property {
    color: var(--primary-accent);
}

.token-punctuation {
    color: var(--muted-text);
}

/* === Footer === */
footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    font-family: var(--display-font);
    font-size: 1.25rem;
    color: var(--body-text);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.footer-tagline {
    color: var(--secondary-text);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.footer-links a {
    color: var(--secondary-text);
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--primary-accent);
}

.copyright {
    width: 100%;
    text-align: center;
    margin-top: 2rem;
    color: var(--muted-text);
    font-size: 0.875rem;
}

/* === Reveal Animations === */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* === Responsive: 1200px === */
@media (max-width: 1200px) {
    .container {
        padding: 0 2rem;
    }
}

/* === Responsive: 992px === */
@media (max-width: 992px) {
    .screenshot-grid {
        grid-template-columns: 1fr;
    }

    .screenshot-frame {
        transform: none;
    }

    .about-section {
        padding: 0 1rem;
    }
}

/* === Responsive: 768px === */
@media (max-width: 768px) {
    :root {
        --section-spacing: 4rem;
    }

    .menu-toggle {
        display: flex;
        z-index: 101;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background-color: var(--surface-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right 0.3s ease;
        z-index: 100;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        margin-left: 0;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .btn + .btn {
        margin-left: 0;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-btn,
    .newsletter-form button {
        width: 100%;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-left {
        align-items: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .code-block {
        font-size: 0.8rem;
    }
}

/* === Responsive: 375px === */
@media (max-width: 375px) {
    .section-heading {
        font-size: 1.75rem;
    }

    .section-subheading {
        font-size: 1rem;
    }
}

/* === webMCP Section === */
.webmcp-section {
    padding: var(--section-spacing) 0;
    text-align: center;
}

.webmcp-section .section-subheading {
    max-width: 650px;
}
