/* ============================================
   MARK ROOD DESIGN SYSTEM
   ============================================

   Brand Essence:
   - Engineer/Builder with precision and craft
   - Curious & Exploratory mindset
   - Red Panda as signature warmth element
   - Geometric precision in visual language

   "Approachable Technical Excellence"
   ============================================ */

/* === CSS CUSTOM PROPERTIES (Design Tokens) === */
:root {
    /* ── Background Scale (Warm Charcoal) ── */
    --bg-primary: #262624;
    --bg-secondary: #2E2E2B;
    --bg-tertiary: #363633;
    --bg-elevated: #3E3E3A;
    --bg-hover: #464642;

    /* ── Surface Colors ── */
    --surface-primary: #2E2E2B;
    --surface-secondary: #363633;
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-border-subtle: rgba(255, 255, 255, 0.04);
    --surface-border-accent: rgba(74, 103, 133, 0.3);

    /* ── Accent Blue Scale ── */
    --accent-50: #F0F4F7;
    --accent-100: #DCE4EB;
    --accent-200: #B9C9D7;
    --accent-300: #8BA7BD;
    --accent-400: #6B8CAE;
    --accent-500: #4A6785;  /* PRIMARY */
    --accent-600: #3D566E;
    --accent-700: #324758;
    --accent-800: #283844;
    --accent-900: #1F2B34;

    /* ── Panda Orange Scale (Signature) ── */
    --panda-50: #FEF6F3;
    --panda-100: #FCE8E1;
    --panda-200: #F9D0C2;
    --panda-300: #F4A989;
    --panda-400: #E8845A;  /* PRIMARY */
    --panda-500: #D4693D;
    --panda-600: #B54E2A;
    --panda-700: #8F3D22;
    --panda-800: #6B2F1B;
    --panda-900: #4A2114;

    /* ── Text Colors ── */
    --text-primary: #F5F5F4;
    --text-secondary: #A8A8A4;
    --text-tertiary: #6B6B67;
    --text-accent: #8BA7BD;
    --text-inverse: #262624;

    /* ── Semantic Colors ── */
    --success: #7CB97E;
    --success-muted: rgba(124, 185, 126, 0.12);
    --warning: #D4A857;
    --warning-muted: rgba(212, 168, 87, 0.12);
    --error: #C97373;
    --error-muted: rgba(201, 115, 115, 0.12);

    /* ── Typography ── */
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-serif: 'Source Serif 4', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    /* ── Font Sizes ── */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* ── Spacing ── */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* ── Effects ── */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-accent: 0 4px 20px -4px rgba(74, 103, 133, 0.35);
    --shadow-panda: 0 4px 20px -4px rgba(232, 132, 90, 0.25);

    /* ── Radii ── */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ── Transitions ── */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Grid ── */
    --grid-unit: 8px;
}


/* === BASE RESET === */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}


/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0;
    color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    margin: 0 0 var(--space-4);
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent-300);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-200);
}

.font-serif {
    font-family: var(--font-serif);
}

.font-mono {
    font-family: var(--font-mono);
}


/* === LAYOUT === */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: 800px;
}

.container-wide {
    max-width: 1400px;
}


/* === GEOMETRIC BACKGROUND === */
.geo-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0.4;
    z-index: 0;
}

.geo-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(74, 103, 133, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 103, 133, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
}


/* === HEADER === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: var(--space-4) 0;
    background-color: rgba(38, 38, 36, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--surface-border-subtle);
}

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


/* === LOGO === */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--text-primary);
}

.logo-mark {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mark::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
    border-radius: var(--radius-lg);
    transition: transform var(--transition-normal);
}

.logo:hover .logo-mark::before {
    transform: rotate(3deg);
}

.logo-mark::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: var(--panda-400);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.logo-text {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: var(--text-sm);
    color: white;
    letter-spacing: -0.02em;
}

.logo-name {
    font-weight: 600;
    font-size: var(--text-base);
    letter-spacing: -0.01em;
}


/* === NAVIGATION === */
.nav {
    display: flex;
    gap: var(--space-1);
}

.nav-link {
    position: relative;
    padding: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--panda-400);
    border-radius: 50%;
}

@media (max-width: 640px) {
    .nav {
        display: none;
    }
}


/* === FLOATING NAV === */
.floating-header {
    position: fixed;
    top: var(--space-4);
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0 var(--space-4);
}

@media (min-width: 640px) {
    .floating-header {
        top: var(--space-6);
    }
}

.floating-nav {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: fit-content;
    margin: 0 auto;
    padding: var(--space-2) var(--space-4);
    background: rgba(46, 46, 43, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--transition-normal);
}

.floating-nav:hover {
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--surface-border-accent);
}

.floating-nav .nav-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--text-primary);
}

.floating-nav .nav-logo img {
    height: 28px;
    width: auto;
    border-radius: var(--radius-md);
}

/* Static panda logo */
.floating-nav .nav-logo .panda-animated {
    width: 28px;
    height: 28px;
    background: url('favicon.png') center/contain no-repeat;
    border-radius: var(--radius-md);
}

.floating-nav .nav-logo-name {
    font-weight: 600;
    font-size: var(--text-sm);
    letter-spacing: -0.02em;
}

.floating-nav .nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

@media (min-width: 640px) {
    .floating-nav {
        gap: var(--space-3);
    }

    .floating-nav .nav-links {
        gap: var(--space-2);
    }
}


/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent-500);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-600);
    box-shadow: var(--shadow-accent);
    color: white;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
    border-color: var(--accent-500);
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-panda {
    background: var(--panda-400);
    color: white;
}

.btn-panda:hover {
    background: var(--panda-500);
    box-shadow: var(--shadow-panda);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}


/* === CARDS === */
.card {
    background: var(--surface-primary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-normal);
}

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

.card-elevated {
    background: var(--bg-elevated);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.card-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
}


/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    background: rgba(74, 103, 133, 0.15);
    color: var(--accent-300);
}

.badge-panda {
    background: rgba(232, 132, 90, 0.15);
    color: var(--panda-300);
}

.badge-success {
    background: var(--success-muted);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-muted);
    color: var(--warning);
}

.badge-error {
    background: var(--error-muted);
    color: var(--error);
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    background: currentColor;
    border-radius: 50%;
}


/* === SECTION COMPONENTS === */
.section {
    position: relative;
    z-index: 1;
    padding: var(--space-16) 0;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
}

.section-label::before {
    content: '';
    width: 12px;
    height: 2px;
    background: var(--panda-400);
    border-radius: 1px;
}

.section-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-3);
}

.section-desc {
    color: var(--text-secondary);
    max-width: 600px;
}


/* === ACCENT ELEMENTS === */
.accent-line {
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-500), var(--panda-400));
    border-radius: var(--radius-full);
}

.gradient-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--surface-border), transparent);
}


/* === QUOTE === */
.quote {
    position: relative;
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    font-style: italic;
    color: var(--text-secondary);
    padding-left: var(--space-8);
    margin: var(--space-8) 0;
}

.quote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent-500), var(--panda-400));
    border-radius: 2px;
}


/* === CODE === */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--accent-300);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}


/* === FORM ELEMENTS === */
.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--accent-500);
    box-shadow: 0 0 0 3px rgba(74, 103, 133, 0.15);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}


/* === FOOTER === */
.site-footer {
    padding: var(--space-12) 0;
    text-align: center;
    border-top: 1px solid var(--surface-border-subtle);
}

.footer-mark {
    width: 32px;
    height: 32px;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
    border-radius: var(--radius-md);
    position: relative;
}

.footer-mark::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--panda-400);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}


/* === UTILITY CLASSES === */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent { color: var(--text-accent); }

.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-elevated { background-color: var(--bg-elevated); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

.text-center { text-align: center; }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }


/* === SELECTION === */
::selection {
    background: var(--panda-400);
    color: white;
}


/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-600);
}


/* === ACCESSIBILITY === */
.skip-link {
    position: absolute;
    left: 0;
    top: 0;
    background: var(--accent-500);
    color: white;
    padding: var(--space-2) var(--space-4);
    border-radius: 0 0 var(--radius-md) 0;
    transform: translateY(-100%);
    transition: transform var(--transition-fast);
    z-index: 1000;
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-400);
    outline-offset: 2px;
}


/* === ANIMATIONS === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }


/* === RESPONSIVE === */
@media (max-width: 768px) {
    :root {
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
    }

    .section {
        padding: var(--space-12) 0;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .grid-cols-2,
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }
}
