/* ==========================================
   Dustin Dannenhauer - Modern Professional Theme
   Light/Dark mode with modern typography
   ========================================== */

/* CSS Variables - Light Theme (Default) */
:root {
    /* Colors - Warm Cream Palette */
    --bg-primary: #f5f2ed;
    --bg-elevated: #faf8f5;
    --bg-hover: #ebe7e0;
    --bg-input: #faf8f5;

    --text-primary: #2d2a26;
    --text-secondary: #5c5650;
    --text-tertiary: #7a746c;

    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: rgba(37, 99, 235, 0.08);
    --accent-glow: rgba(37, 99, 235, 0.15);

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-visible: rgba(0, 0, 0, 0.12);
    --border-accent: rgba(37, 99, 235, 0.4);

    --header-bg: rgba(255, 255, 255, 0.85);
    --header-border: rgba(0, 0, 0, 0.06);

    --hero-gradient-1: rgba(37, 99, 235, 0.04);
    --hero-gradient-2: rgba(37, 99, 235, 0.02);
    --hero-dots: rgba(0, 0, 0, 0.03);

    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);

    /* Typography */
    --font-display: "Bricolage Grotesque", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --spacing-3xl: 6rem;

    --max-width: 1200px;
    --header-height: 72px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Color scheme for form elements */
    color-scheme: light;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0d0f12;
    --bg-elevated: #151820;
    --bg-hover: #1c2029;
    --bg-input: #1a1d24;

    --text-primary: #e8e6e3;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;

    --accent-primary: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-subtle: rgba(245, 158, 11, 0.12);
    --accent-glow: rgba(245, 158, 11, 0.25);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-visible: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(245, 158, 11, 0.4);

    --header-bg: rgba(13, 15, 18, 0.85);
    --header-border: rgba(255, 255, 255, 0.06);

    --hero-gradient-1: rgba(245, 158, 11, 0.08);
    --hero-gradient-2: rgba(245, 158, 11, 0.04);
    --hero-dots: rgba(255, 255, 255, 0.03);

    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
}

/* System preference dark mode (when no explicit theme set) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0d0f12;
        --bg-elevated: #151820;
        --bg-hover: #1c2029;
        --bg-input: #1a1d24;

        --text-primary: #e8e6e3;
        --text-secondary: #9ca3af;
        --text-tertiary: #6b7280;

        --accent-primary: #f59e0b;
        --accent-hover: #fbbf24;
        --accent-subtle: rgba(245, 158, 11, 0.12);
        --accent-glow: rgba(245, 158, 11, 0.25);

        --border-subtle: rgba(255, 255, 255, 0.06);
        --border-visible: rgba(255, 255, 255, 0.12);
        --border-accent: rgba(245, 158, 11, 0.4);

        --header-bg: rgba(13, 15, 18, 0.85);
        --header-border: rgba(255, 255, 255, 0.06);

        --hero-gradient-1: rgba(245, 158, 11, 0.08);
        --hero-gradient-2: rgba(245, 158, 11, 0.04);
        --hero-dots: rgba(255, 255, 255, 0.03);

        --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);

        color-scheme: dark;
    }
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition:
        background-color var(--transition-base),
        color var(--transition-base);
}

::selection {
    background-color: var(--accent-subtle);
    color: var(--accent-primary);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

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

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: transparent;
    z-index: 1000;
    transition:
        background-color var(--transition-base),
        backdrop-filter var(--transition-base);
}

.header.scrolled {
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--header-border);
}

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

.logo {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.logo:hover {
    color: var(--accent-primary);
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
}

.nav-link {
    position: relative;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-primary);
    transition: width var(--transition-base);
}

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

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

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

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-visible);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-left: var(--spacing-sm);
}

.theme-toggle:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background-color: var(--accent-subtle);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: none;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-btn span {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: all var(--transition-fast);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-visible);
}

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

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
    padding-bottom: var(--spacing-3xl);
    background:
        radial-gradient(
            ellipse 80% 50% at 50% -20%,
            var(--hero-gradient-1),
            transparent
        ),
        radial-gradient(
            ellipse 60% 40% at 80% 60%,
            var(--hero-gradient-2),
            transparent
        ),
        var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--hero-dots) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--spacing-2xl);
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    max-width: 600px;
    line-height: 1.6;
}

.hero-credentials {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    margin-bottom: var(--spacing-lg);
    letter-spacing: 0.01em;
    opacity: 0.9;
}

.hero-cta {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.hero-image {
    display: flex;
    justify-content: center;
}

.headshot {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: var(--border-radius-lg);
    box-shadow:
        0 0 0 1px var(--border-subtle),
        var(--shadow-lg);
}

/* Animation Classes */
.animate-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: calc(var(--delay, 0) * 0.1s);
}

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

/* Scroll Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

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

/* Section Styles */
section {
    padding: var(--spacing-3xl) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    position: relative;
}

.section-title::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: var(--accent-primary);
    margin: var(--spacing-sm) auto 0;
    border-radius: 2px;
}

/* Problem Section */
.problem-section {
    background-color: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.problem-section .section-title {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--text-primary);
}

.problem-section .section-title::after {
    display: none;
}

.problem-text {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Services Section */
.services-section {
    background-color: var(--bg-primary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.service-card {
    padding: var(--spacing-lg);
    background-color: var(--bg-elevated);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--card-shadow);
    transition:
        border-color var(--transition-base),
        transform var(--transition-base),
        box-shadow var(--transition-base);
}

.service-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.service-title {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-size: 1.15rem;
}

.service-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.7;
}

.services-note {
    text-align: center;
    font-style: italic;
    color: var(--text-tertiary);
}

/* About Section */
.about-section {
    background-color: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-content p:first-of-type::first-line {
    color: var(--text-primary);
    font-weight: 500;
}

/* Work Section */
.work-section {
    background-color: var(--bg-primary);
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.work-card {
    padding: var(--spacing-md);
    background-color: var(--bg-elevated);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--card-shadow);
    transition:
        border-color var(--transition-base),
        transform var(--transition-base),
        box-shadow var(--transition-base);
}

.work-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.work-card a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.work-card a:hover .work-title {
    color: var(--accent-primary);
}

.work-title {
    font-size: 1.05rem;
    margin-bottom: var(--spacing-xs);
    transition: color var(--transition-fast);
    color: var(--text-primary);
}

.work-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.work-year {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.publications-link {
    display: block;
    text-align: center;
    font-weight: 500;
    color: var(--accent-primary);
    transition: color var(--transition-fast);
}

.publications-link:hover {
    color: var(--accent-hover);
}

/* Contact Section */
.contact-section {
    background-color: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}

.contact-intro {
    text-align: center;
    max-width: 600px;
    margin: 0 auto var(--spacing-xl);
    color: var(--text-secondary);
}

.contact-form {
    max-width: 700px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-visible);
    border-radius: var(--border-radius);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

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

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

[data-theme="dark"] .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.form-group select option {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 140px;
}

.contact-form .btn {
    width: 100%;
    margin-top: var(--spacing-sm);
    padding: 1rem 2rem;
    font-size: 1.05rem;
}

.schedule-direct {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

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

/* Footer */
.footer {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

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

.nostr-link {
    display: flex;
    align-items: center;
}

.nostr-link svg {
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.nostr-link:hover svg {
    opacity: 1;
}

.copyright {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin: 0;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-cta {
        justify-content: center;
    }

    .hero-image {
        order: -1;
    }

    .headshot {
        width: 220px;
        height: 220px;
    }

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

@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    body {
        font-size: 16px;
    }

    section {
        padding: var(--spacing-2xl) 0;
    }

    .nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: var(--header-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--header-border);
        padding: var(--spacing-md);
        flex-direction: column;
        align-items: stretch;
    }

    .nav.active {
        display: flex;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
    }

    .nav-link {
        display: block;
        padding: var(--spacing-sm) 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-link::after {
        display: none;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .theme-toggle {
        margin: var(--spacing-sm) 0 0 0;
        align-self: flex-start;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .work-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .footer-links {
        gap: var(--spacing-md);
    }

    .hero {
        min-height: auto;
        padding-top: calc(var(--header-height) + var(--spacing-2xl));
        padding-bottom: var(--spacing-2xl);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero-cta .btn {
        width: 100%;
    }

    .btn {
        padding: 0.75rem 1.5rem;
    }

    .headshot {
        width: 180px;
        height: 180px;
    }
}

/* Print Styles */
@media print {
    .header,
    .hero-cta,
    .contact-form,
    .footer,
    .theme-toggle {
        display: none;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }

    a {
        color: #000;
        text-decoration: underline;
    }
}
