/* Base Styles */
html {
    scroll-behavior: smooth;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

/* Fixed Header Styles */
header.fixed {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Ensure content is not hidden behind fixed header */
body {
    padding-top: 0;
}

body {
    background: linear-gradient(to bottom, #0f172a, #020617) fixed;
    color: #e0e0e0;
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    position: relative;
    z-index: 0;
}

/* Add a pseudo-element for a consistent background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #0f172a, #020617);
    z-index: -1;
}

/* Definition List Styles */
dt {
    font-weight: 600;
    color: #38bdf8;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.1em;
}

dd {
    margin-left: 0;
    margin-bottom: 1.5rem;
    padding-left: 0;
}

dd ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style-type: none;
}

dd li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

dd li strong {
    color: #94a3b8;
    margin-right: 0.5rem;
}

/* Section Snapping */
section {
    scroll-snap-align: start;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 10;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Gradient Border */
.gradient-border {
    position: relative;
    border-radius: 0.5rem;
    background: linear-gradient(to right, #0f172a, #020617);
}

.gradient-border::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    border-radius: 0.6rem;
    z-index: -1;
}

/* Card Hover Effects */
.card {
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Badge Styling */
.badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
    margin: 0.25rem;
    transition: all 0.2s ease;
}

.badge:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

/* Particles Container */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

/* Typing Animation */
.typing-container {
    height: 1.5em;
    overflow: hidden;
}

.typing-text {
    display: inline-block;
    white-space: nowrap;
    margin: 0;
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink-caret {
    from,
    to {
        border-color: transparent;
    }
    50% {
        border-color: #818cf8;
    }
}

/* Section Reveal Animation */
.section-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}

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

/* Expandable Timeline Styling */
.timeline-expand-header {
    text-align: center;
    margin-bottom: 1rem;
}

#toggle-timeline {
    transition: all 0.3s ease;
}

#toggle-timeline:hover {
    transform: translateY(-2px);
}

#timeline-chevron {
    transition: transform 0.3s ease;
}

#toggle-timeline.expanded #timeline-chevron {
    transform: rotate(180deg);
}

.timeline-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.8s ease-in-out;
    opacity: 0;
}

.timeline-content.expanded {
    max-height: 5000px; /* Much larger to ensure all content is visible */
    opacity: 1;
    padding-bottom: 3rem; /* Add padding at the bottom to ensure last items are visible */
}

/* Better integration with page gradient */
#timeline-container {
    position: relative;
    z-index: 1;
    padding: 0;
    margin-top: 2rem;
}

/* Remove any background that might interfere with the main gradient */
#experience {
    background: none;
    position: relative;
    overflow: visible;
}

/* Ensure the timeline content has proper spacing */
.timeline-content {
    padding: 0 1rem;
}

.timeline-content.expanded {
    padding: 1rem 1rem 4rem 1rem;
}

/* Add a subtle separator when expanded */
.timeline-content.expanded::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(99, 102, 241, 0.3),
        transparent
    );
}

/* Improved modal content */
.modal-content {
    background: linear-gradient(to bottom, #1e293b, #0f172a);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
}

#experience-modal.active .modal-content {
    transform: translateY(0);
}

/* Close button styling */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #e0e0e0;
    border-radius: 9999px;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: rotate(90deg);
}

/* Timeline Styling */
.timeline-item {
    position: relative;
    padding-left: 1.5rem;
    border-left: 2px solid #0ea5e9;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

.timeline-item:hover {
    transform: translateX(5px);
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -0.5rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.timeline-company {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: white;
    margin-bottom: 0.25rem;
}

.timeline-role {
    color: #38bdf8;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.timeline-period {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.timeline-period svg {
    margin-right: 0.25rem;
    height: 0.875rem;
    width: 0.875rem;
}

.timeline-description {
    color: #e2e8f0;
    margin-bottom: 1rem;
}

.timeline-bullets {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.timeline-bullets li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
    color: #94a3b8;
}

.timeline-bullets li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #38bdf8;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .grid-cols-3 {
        grid-template-columns: 1fr;
    }

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

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 40;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #e0e0e0;
    border-radius: 9999px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

.dark-mode-toggle svg {
    fill: currentColor;
    stroke: currentColor;
    opacity: 1;
    display: block;
}

.dark-mode-toggle:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

/* ============================================
   LIGHT MODE OVERRIDES - COMPREHENSIVE EDITION
   ============================================ */

html.light body {
    background: linear-gradient(to bottom, #ffffff, #f8fafc) !important;
    color: #1e293b !important;
}

html.light body::before {
    background: linear-gradient(to bottom, #ffffff, #f8fafc) !important;
}

/* Header and Navigation */
html.light header {
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom-color: #e2e8f0 !important;
    backdrop-filter: blur(12px);
}

/* Text Colors - Comprehensive */
html.light .text-white,
html.light h1,
html.light h2,
html.light h3,
html.light .timeline-company,
html.light .font-heading {
    color: #0f172a !important;
}

html.light .text-gray-300,
html.light .timeline-description {
    color: #374151 !important;
}

html.light .text-gray-400,
html.light .timeline-period,
html.light .timeline-bullets li {
    color: #6b7280 !important;
}

html.light .text-gray-500 {
    color: #9ca3af !important;
}

/* Navigation Links */
html.light nav a {
    color: #6b7280 !important;
}

html.light nav a:hover,
html.light .hover\:text-primary-400:hover {
    color: #0ea5e9 !important;
}

/* Backgrounds and Cards */
html.light .bg-slate-800\/50,
html.light .bg-slate-800\/40,
html.light .card {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid #e5e7eb !important;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

html.light .bg-slate-900\/50,
html.light .bg-slate-900\/40 {
    background: rgba(248, 250, 252, 0.9) !important;
}

/* Light mode card hover */
html.light .card:hover {
    transform: translateY(-5px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.15),
        0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* Borders */
html.light .border-slate-700,
html.light .border-slate-800 {
    border-color: #e5e7eb !important;
}

/* Badges */
html.light .badge {
    background: rgba(99, 102, 241, 0.1) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    color: #4f46e5 !important;
}

/* Timeline */
html.light .timeline-item {
    border-left-color: #0ea5e9 !important;
}

html.light .timeline-item::before {
    background: linear-gradient(135deg, #38bdf8, #818cf8) !important;
}

html.light .timeline-role {
    color: #0284c7 !important;
}

/* Dark Mode Toggle in Light Mode */
html.light .dark-mode-toggle {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid #e5e7eb !important;
    color: #374151 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

html.light .dark-mode-toggle:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #4f46e5 !important;
}

/* Particles Background for Light Mode */
html.light .particles-container {
    opacity: 1 !important;
}

/* Gradient Text in Light Mode */
html.light .gradient-text {
    background: linear-gradient(90deg, #0ea5e9, #6366f1) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
}

/* Links and Interactive Elements */
html.light .text-primary-400,
html.light a[class*="text-primary"] {
    color: #0284c7 !important;
}

html.light .text-primary-300 {
    color: #0ea5e9 !important;
}

/* Button Styles */
html.light .bg-gradient-to-r {
    background: linear-gradient(to right, #0ea5e9, #6366f1) !important;
}

html.light .border-primary-500 {
    border-color: #0ea5e9 !important;
}

html.light .text-primary-400 {
    color: #0284c7 !important;
}

/* Hover States */
html.light .hover\:text-accent-400:hover {
    color: #6366f1 !important;
}

html.light .hover\:bg-primary-500\/10:hover {
    background: rgba(14, 165, 233, 0.1) !important;
}

/* Button hover states in light mode */
html.light .border-primary-400 {
    border-color: #38bdf8 !important;
}

html.light .border-primary-400:hover {
    background: rgba(14, 165, 233, 0.1) !important;
}

/* Timeline bullets in light mode */
html.light .timeline-bullets li::before {
    color: #0ea5e9 !important;
}

/* Additional comprehensive text color overrides */
html.light .text-primary-300 {
    color: #0ea5e9 !important;
}

html.light .text-primary-500 {
    color: #0284c7 !important;
}

html.light .text-accent-400 {
    color: #6366f1 !important;
}

html.light .text-accent-500 {
    color: #4f46e5 !important;
}

/* Button and interactive element overrides */
html.light .bg-primary-500 {
    background-color: #0ea5e9 !important;
}

html.light .from-primary-500 {
    --tw-gradient-from: #0ea5e9 !important;
}

html.light .to-accent-500 {
    --tw-gradient-to: #6366f1 !important;
}

/* Footer and additional text elements */
html.light footer {
    border-top-color: #e5e7eb !important;
}

html.light footer .text-gray-400 {
    color: #9ca3af !important;
}

/* Additional utility class overrides */
html.light .border-primary-500 {
    border-color: #0ea5e9 !important;
}

html.light .hover\:bg-primary-500\/10:hover {
    background-color: rgba(14, 165, 233, 0.1) !important;
}

/* Article/blog post styling */
html.light article {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: #e5e7eb !important;
}

html.light article:hover {
    background: rgba(248, 250, 252, 0.95) !important;
}

/* Ensure all text variants are covered */
html.light .text-sm {
    color: inherit !important;
}

html.light .text-xs {
    color: inherit !important;
}

html.light .text-lg {
    color: inherit !important;
}

html.light .text-xl {
    color: inherit !important;
}

html.light .text-2xl {
    color: inherit !important;
}

/* Typing animation text in light mode */
html.light .typing-text,
html.light .text-primary-300 {
    color: #0284c7 !important;
}

/* Ensure proper contrast for all interactive elements */
html.light .hover\:shadow-lg:hover {
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* Make sure gradient buttons are visible in light mode */
html.light .bg-gradient-to-r.from-primary-500.to-accent-500 {
    background: linear-gradient(to right, #0ea5e9, #6366f1) !important;
    color: white !important;
}

/* Prose Typography Styles */
.prose {
    color: #d1d5db;
    max-width: 65ch;
    line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    color: #f8fafc;
    font-weight: 600;
    line-height: 1.25;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
}

.prose h1 {
    font-size: 2.25em;
    margin-top: 0;
    margin-bottom: 0.8888889em;
}

.prose h2 {
    font-size: 1.5em;
    margin-top: 2em;
    margin-bottom: 1em;
}

.prose h3 {
    font-size: 1.25em;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
}

.prose h4 {
    font-size: 1.125em;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    color: #f8fafc;
}

.prose p {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
}

.prose strong {
    color: #f8fafc;
    font-weight: 600;
}

.prose a {
    color: #38bdf8;
    text-decoration: underline;
    font-weight: 500;
}

.prose a:hover {
    color: #0ea5e9;
}

.prose ul,
.prose ol {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose ul {
    list-style-type: disc;
    list-style-position: outside;
}

.prose ol {
    list-style-type: decimal;
    list-style-position: outside;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose li::marker {
    color: #38bdf8;
}

.prose blockquote {
    font-weight: 500;
    font-style: italic;
    color: #d1d5db;
    border-left-width: 0.25rem;
    border-left-color: #374151;
    quotes: "\201C" "\201D" "\2018" "\2019";
    margin-top: 1.6em;
    margin-bottom: 1.6em;
    padding-left: 1em;
}

.prose code {
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.875em;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.prose pre {
    color: #e5e7eb;
    background-color: #1f2937;
    overflow-x: auto;
    font-weight: 400;
    font-size: 0.875em;
    line-height: 1.7142857;
    margin-top: 1.7142857em;
    margin-bottom: 1.7142857em;
    border-radius: 0.375rem;
    padding: 0.8571429em 1.1428571em;
}

.prose pre code {
    background-color: transparent;
    border-width: 0;
    border-radius: 0;
    padding: 0;
    font-weight: inherit;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

.prose-invert {
    --tw-prose-body: #d1d5db;
    --tw-prose-headings: #f8fafc;
    --tw-prose-lead: #9ca3af;
    --tw-prose-links: #38bdf8;
    --tw-prose-bold: #f8fafc;
    --tw-prose-counters: #9ca3af;
    --tw-prose-bullets: #6b7280;
    --tw-prose-hr: #374151;
    --tw-prose-quotes: #f3f4f6;
    --tw-prose-quote-borders: #374151;
    --tw-prose-captions: #9ca3af;
    --tw-prose-code: #f8fafc;
    --tw-prose-pre-code: #d1d5db;
    --tw-prose-pre-bg: #1f2937;
    --tw-prose-th-borders: #374151;
    --tw-prose-td-borders: #4b5563;
}

/* Light mode prose overrides */
html.light .prose {
    color: #374151;
}

html.light .prose h1,
html.light .prose h2,
html.light .prose h3,
html.light .prose h4,
html.light .prose h5,
html.light .prose h6 {
    color: #111827;
    font-weight: 600;
}

html.light .prose strong {
    color: #111827;
}

html.light .prose a {
    color: #0284c7;
}

html.light .prose a:hover {
    color: #0369a1;
}

html.light .prose blockquote {
    color: #6b7280;
    border-left-color: #d1d5db;
}

html.light .prose code {
    color: #111827;
    background: rgba(99, 102, 241, 0.1);
}

html.light .prose pre {
    color: #374151;
    background-color: #f9fafb;
}

/* Max width overrides */
.prose.max-w-none {
    max-width: none;
}

/* Featured image styling for blog posts */
.prose img {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    margin-left: auto;
    margin-right: auto;
    display: block;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.prose img:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4);
}

/* Light mode image styling */
html.light .prose img {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

html.light .prose img:hover {
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.25);
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 1s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes slideUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Authorship badge — an integrity invariant (VOICE.md §6). Human and agent
   posts use visually distinct surfaces so attribution is unmissable. */
.author-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 9999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

/* Tim — sky/primary surface */
.author-badge--human {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.45);
    color: #7dd3fc;
}

/* Agent — violet/accent surface, deliberately different from Tim's */
.author-badge--agent {
    background: rgba(99, 102, 241, 0.14);
    border: 1px solid rgba(99, 102, 241, 0.5);
    color: #a5b4fc;
}

html.light .author-badge--human {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
}

html.light .author-badge--agent {
    background: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
}
