/* ============================================
   MARTIN LAVIGNE - TRIATHLETE WEBSITE
   Dark theme, modern athlete portfolio
   ============================================ */

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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    --accent: #e63946;
    --accent-hover: #ff4d5a;
    --border: #222222;
    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Navigation --- */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: transparent;
    transition: background var(--transition), box-shadow var(--transition);
}

#navbar.scrolled {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-primary);
}

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

.nav-links a {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    position: relative;
    padding: 4px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width var(--transition);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

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

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

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

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-video-container {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-video-fallback {
    display: block;
}

video.hero-video {
    z-index: 1;
}

video.hero-video + .hero-video-fallback {
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0.4) 0%,
        rgba(10, 10, 10, 0.6) 50%,
        rgba(10, 10, 10, 0.95) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 24px;
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 6px;
    color: var(--accent);
    margin-bottom: 16px;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: 4px;
    line-height: 0.95;
    margin-bottom: 24px;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.4s;
    opacity: 0;
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.6s;
    opacity: 0;
}

.hero-cta {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
    padding: 14px 40px;
    transition: var(--transition);
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.8s;
    opacity: 0;
}

.hero-cta:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.hero-scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 1.2s;
    opacity: 0;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-right: 1px solid var(--text-secondary);
    border-bottom: 1px solid var(--text-secondary);
    transform: rotate(45deg);
    animation: scrollBounce 2s infinite;
}

/* --- Sections --- */
.section {
    padding: 120px 0;
}

.section-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 4px;
    color: var(--accent);
    margin-bottom: 12px;
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 48px;
}

/* --- About Section --- */
.about {
    background: var(--bg-secondary);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 60px;
    align-items: center;
}

.about-image {
    position: relative;
    overflow: hidden;
}

.about-image img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    filter: grayscale(20%);
    transition: filter var(--transition);
}

.about-image:hover img {
    filter: grayscale(0%);
}

.about-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, var(--bg-secondary), transparent);
    pointer-events: none;
}

.about-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    font-weight: 300;
}

.about-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--accent);
}

.stat-label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Results Section --- */
.results {
    background: var(--bg-primary);
}

.results-table {
    width: 100%;
}

.results-header {
    display: grid;
    grid-template-columns: 110px 1fr 80px 80px 80px 90px 100px;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 2px solid var(--accent);
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.result-row {
    display: grid;
    grid-template-columns: 110px 1fr 80px 80px 80px 90px 100px;
    gap: 12px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background var(--transition);
}

.result-row:hover {
    background: var(--bg-tertiary);
    padding-left: 8px;
}

.result-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-race {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.result-badge {
    font-size: 0.65rem;
    letter-spacing: 2px;
    padding: 2px 8px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 500;
    text-transform: uppercase;
}

.result-split {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.result-muted {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
}

.result-time {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.result-place {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.result-place small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 300;
    letter-spacing: 0;
    margin-top: 2px;
}

/* Upcoming goal line */
.upcoming-goal {
    font-size: 0.85rem !important;
    color: var(--accent) !important;
    margin-top: 4px;
}

@media (max-width: 1024px) {
    .results-header {
        display: none;
    }
    .result-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 20px 0;
    }
    .result-race {
        grid-column: 1 / -1;
        font-size: 1.1rem;
    }
    .result-split { font-size: 0.82rem; }
}

/* --- Gallery Section --- */
.gallery {
    background: var(--bg-secondary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
}

.gallery-item-tall {
    grid-row: span 2;
    aspect-ratio: auto;
}

.gallery-item-wide {
    grid-column: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), filter var(--transition);
    filter: grayscale(30%);
}

.gallery-item:hover img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 20px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
}

.gallery-caption span {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 1px;
    font-weight: 400;
}

/* --- Upcoming Section --- */
.upcoming {
    background: var(--bg-primary);
}

.upcoming-grid {
    display: grid;
    gap: 16px;
}

.upcoming-card {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    transition: var(--transition);
}

.upcoming-card:hover {
    border-left-color: var(--accent-hover);
    background: rgba(230, 57, 70, 0.05);
}

.upcoming-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.upcoming-month {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.upcoming-year {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.upcoming-info {
    flex: 1;
}

.upcoming-info h4 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.upcoming-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upcoming-location {
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
}

.upcoming-status {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 16px;
    white-space: nowrap;
}

/* --- Video Section --- */
.video-section {
    background: var(--bg-secondary);
}

.video-placeholder {
    aspect-ratio: 16/9;
    max-height: 500px;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-placeholder-content {
    text-align: center;
    color: var(--text-muted);
}

.video-placeholder-content svg {
    margin-bottom: 20px;
    opacity: 0.3;
}

.video-placeholder-content p {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.video-sub {
    font-family: var(--font-body) !important;
    font-size: 0.85rem !important;
    letter-spacing: 0 !important;
    margin-bottom: 24px !important;
}

/* --- Sponsors Section --- */
.sponsors {
    background: var(--bg-primary);
    text-align: center;
}

.sponsors-intro {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 600px;
    margin: -24px auto 48px;
    font-weight: 300;
    line-height: 1.8;
}

.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.sponsor-slot {
    aspect-ratio: 2/1;
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    transition: var(--transition);
}

.sponsor-slot:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --- TikTok Embed --- */
.tiktok-video-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.tiktok-video-wrap iframe {
    width: 325px;
    height: 740px;
    border: none;
    display: block;
}

.video-follow {
    text-align: center;
    margin-top: 24px;
}

/* --- Strava Section --- */
.strava-section {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.strava-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.strava-text .section-title {
    margin-bottom: 16px;
}

.strava-text p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 300;
    max-width: 520px;
}

.btn-strava {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fc4c02;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 14px 32px;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-strava:hover {
    background: #e04400;
}

@media (max-width: 768px) {
    .strava-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- Contact Section --- */
.contact {
    background: var(--bg-secondary);
    text-align: center;
}

.contact-intro {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 500px;
    margin: -24px auto 48px;
    font-weight: 300;
}

.contact-form {
    max-width: 640px;
    margin: 0 auto;
    text-align: left;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

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

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-form select {
    color: var(--text-muted);
    cursor: pointer;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

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

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 14px 40px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-outline:hover {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Footer --- */
.footer {
    background: var(--bg-primary);
    padding: 60px 0 30px;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
}

.footer-brand p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.footer-social {
    display: flex;
    gap: 20px;
}

.footer-social a {
    color: var(--text-muted);
    transition: color var(--transition);
}

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

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.footer-bottom {
    padding-top: 24px;
    text-align: center;
}

.footer-bottom p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.5rem;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 2001;
    line-height: 1;
    transition: color var(--transition);
}

.lightbox-close:hover {
    color: var(--accent);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 20px;
    transition: color var(--transition);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    color: var(--text-primary);
}

.lightbox-prev {
    left: 10px;
}

.lightbox-next {
    right: 10px;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scrollBounce {
    0%, 100% {
        transform: rotate(45deg) translateY(0);
    }
    50% {
        transform: rotate(45deg) translateY(8px);
    }
}

/* Scroll reveal animation */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* --- Responsive --- */
@media (max-width: 1024px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-image img {
        height: 400px;
    }

    .results-header,
    .result-row {
        grid-template-columns: 100px 1fr 100px 100px 100px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 80px 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 32px;
        transition: right var(--transition);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.2rem;
        letter-spacing: 4px;
    }

    .about-image img {
        height: 350px;
    }

    .about-stats {
        flex-wrap: wrap;
        gap: 24px;
    }

    .results-header {
        display: none;
    }

    .result-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 20px 0;
    }

    .result-race {
        grid-column: 1 / -1;
        font-size: 1.2rem;
    }

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

    .gallery-item-tall {
        grid-row: span 1;
        aspect-ratio: 4/3;
    }

    .gallery-item-wide {
        grid-column: span 1;
    }

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

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

    .upcoming-card {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .footer-content {
        flex-direction: column;
        gap: 24px;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 3.5rem;
    }

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

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

    .result-race {
        grid-column: 1;
    }
}
