/* ════════════════════════════════════════════════════════════
   CrucibleCraft — Shared Styles
   Used across 3+ pages: nav, footer, hamburger, fade-in,
   back-to-top button.
   ════════════════════════════════════════════════════════════ */

/* --------------------------------------------------------
   CSS Custom Properties (shared subset)
-------------------------------------------------------- */
:root {
    --base: #F7F6F3;
    --base-alt: #FFFDF9;
    --primary: #1B3A5C;
    --primary-hover: #142D48;
    --secondary: #C4722F;
    --secondary-light: #E8A04F;
    --tertiary: #B8A272;
    --dark: #1A1A2E;
    --gray: #6B7280;
    --light: #EDECEA;
    --white: #FFFFFF;
    --footer-text: #9CA3AF;
    --footer-logo-primary: #8BA4C0;
    --footer-logo-secondary: #D1D5DB;
    --footer-muted: #6B7280;
    --shadow-card: 0 2px 8px rgba(26, 26, 46, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

/* Offset anchor scroll to account for sticky nav bar */
section[id] {
    scroll-margin-top: 80px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Helvetica Neue', Arial, sans-serif;
    color: var(--dark);
    line-height: 1.6;
    background: var(--base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------
   Navigation
-------------------------------------------------------- */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--base);
    border-bottom: 1px solid var(--light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
    z-index: 200;
}

.nav-logo-crucible {
    color: var(--primary);
}

.nav-logo-craft {
    color: var(--dark);
}

.nav-logo-icon {
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 4px;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--gray);
    font-weight: 500;
    font-size: 15px;
    transition: color 0.2s ease;
}

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

/* --------------------------------------------------------
   Hamburger Menu (mobile fullscreen overlay, Apple-style)
-------------------------------------------------------- */
.nav-toggle {
    position: relative;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle .icon-menu,
.nav-toggle .icon-close {
    position: absolute;
    transition: opacity 0.2s ease;
}

.nav-toggle .icon-close { opacity: 0; pointer-events: none; }
.nav-toggle.active .icon-menu { opacity: 0; pointer-events: none; }
.nav-toggle.active .icon-close { opacity: 1; pointer-events: auto; }

.nav-links.nav-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--base);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 150;
    padding: 0 48px;
    animation: menuFadeIn 0.25s ease;
}

@keyframes menuFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.nav-links.nav-open li {
    display: list-item;
    width: 100%;
    max-width: 320px;
    border-bottom: 1px solid var(--light);
}

.nav-links.nav-open li:first-child {
    border-top: 1px solid var(--light);
}

.nav-links.nav-open a {
    display: block;
    padding: 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    text-align: center;
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
}

.nav-links.nav-open a::before,
.nav-links.nav-open a::after {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-links.nav-open a::before {
    content: '>';
    margin-right: 12px;
    transform: translateX(6px);
}

.nav-links.nav-open a::after {
    content: '<';
    margin-left: 12px;
    transform: translateX(-6px);
}

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

.nav-links.nav-open a:hover::before,
.nav-links.nav-open a:hover::after,
.nav-links.nav-open a:focus-visible::before,
.nav-links.nav-open a:focus-visible::after {
    opacity: 1;
    transform: translateX(0);
}

/* --------------------------------------------------------
   Footer
-------------------------------------------------------- */
.footer {
    position: relative;
    padding: 40px 24px;
    background: var(--dark);
    color: var(--footer-text);
    text-align: center;
    font-size: 14px;
}

.footer-gold-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tertiary);
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-logo-crucible {
    color: var(--footer-logo-primary);
}

.footer-logo-craft {
    color: var(--footer-logo-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--white);
}

.footer-copy {
    color: var(--footer-muted);
    font-size: 13px;
}

/* --------------------------------------------------------
   Fade-in Animations
   Progressive enhancement: visible by default,
   JS adds .js-enabled to <html> to activate animations.
-------------------------------------------------------- */
.js-enabled .fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.js-enabled .fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --------------------------------------------------------
   Back to Top Button
-------------------------------------------------------- */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--dark);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99;
    box-shadow: var(--shadow-card);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary);
}

/* --------------------------------------------------------
   Focus Visible (accessibility)
-------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════
   Desktop Overrides (min-width: 768px)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .nav {
        padding: 18px 64px;
    }

    .nav-toggle {
        display: none;
    }

    .nav-links {
        display: flex;
        gap: 36px;
    }

    .nav-links li {
        display: list-item;
    }

    .footer {
        padding: 48px 64px;
    }
}
