/* HearthByte Shared Styles - Source of Truth from Homepage */
/* All pages MUST use this file for consistent styling */

/* === Variables === */
:root {
    /* Color Variables */
    --bg-color: #08061A;
    --surface-color: #0F0D24;
    --surface-hover: #16133A;
    --primary-accent: #A78BFA;
    --secondary-accent: #D9AE83;
    --copper-hover: #E8C4A0;
    --body-text: #E2E0ED;
    --secondary-text: #9B97B8;
    --muted-text: #6B6889;
    --border-color: rgba(167, 139, 250, 0.12);
    --border-hover: rgba(167, 139, 250, 0.25);
    --glow: rgba(167, 139, 250, 0.15);
    
    /* Typography */
    --display-font: 'Sora', sans-serif;
    --body-font: 'Instrument Sans', sans-serif;
    --mono-font: 'JetBrains Mono', monospace;
    
    /* Sizing and spacing */
    --container-width: 1200px;
    --section-spacing: clamp(3.5rem, 8vw, 6rem);
    --header-height: 80px;
}

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

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

/* === Base === */
html {
    background-color: #08061A !important;
}

body {
    background-color: #08061A !important;
    color: #E2E0ED !important;
    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;
    min-height: 100vh;
    padding-top: 80px !important;
}

/* 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);
}

/* === Container === */
.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;
    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;
}

.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 {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.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);
}

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;
}

/* === Footer === */
footer {
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: var(--section-spacing);
}

footer p {
    color: var(--muted-text);
    font-size: 0.9rem;
    margin: 0;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    .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;
    }
}

/* === Tool Page Specific === */
/* Content padding for fixed header - handled by body padding-top */
main {
    min-height: calc(100vh - var(--header-height));
}

/* Tool page hero */
.tool-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.tool-hero p {
    color: var(--secondary-text);
    max-width: 600px;
    margin: 0 auto;
}

/* Tool navigation arrows */
.tool-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
}

.tool-nav.prev { left: 1rem; }
.tool-nav.next { right: 1rem; }

.tool-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.tool-nav a:hover {
    background: var(--surface-hover);
    color: var(--body-text);
    transform: scale(1.1);
}

/* Cards/Panels */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.card:hover {
    border-color: var(--border-hover);
}

/* Input fields */
input[type="text"],
input[type="number"],
input[type="email"],
select,
textarea {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: var(--body-text);
    font-family: var(--body-font);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px var(--glow);
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--surface-hover);
    border-radius: 4px;
    height: 6px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Export sections */
.export-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.export-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.export-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.export-tab:hover,
.export-tab.active {
    background: var(--surface-hover);
    border-color: var(--primary-accent);
    color: var(--body-text);
}

.export-code {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--mono-font);
    font-size: 0.85rem;
    overflow-x: auto;
    position: relative;
}

.export-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--secondary-text);
    font-size: 0.75rem;
    cursor: pointer;
}

.export-copy:hover {
    background: var(--primary-accent);
    color: var(--bg-color);
}

/* Cross-linking hints */
.tool-hint {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tool-hint-icon {
    font-size: 1.25rem;
}

.tool-hint a {
    color: var(--primary-accent);
    font-weight: 500;
}
