/* Sticky nav implementation */
:root {
    scroll-behavior: smooth;
    /* Modular scale (ratio 1.25) variables */
    --ms-ratio: 1.25;
    --ms-0: 1;
    /* base */
    --ms-1: 1.25;
    /* 1 * 1.25 */
    --ms-2: 1.5625;
    /* 1.25^2 */
    --ms-3: 1.953125;
    /* 1.25^3 */
    --ms-4: 2.44140625;
    /* 1.25^4 */
    --base: 1rem;
    /* multiply scale by this (1rem == root font-size)
                            root font-size itself is responsive below */
    /* Dark theme — warmer, richer tones */
    /* Distribution: 60% primary (UI surfaces), 30% secondary (large surfaces), 10% accent */
    --color-bg: #170e1f;
    /* deeper warm chocolate */
    --color-surface: #232b21;
    /* slightly warmer surface */

    --color-primary: #B25A21;
    /* richer warm orange (primary) */
    --color-on-primary: #FFFFFF;
    /* text on primary */
    --color-primary-dark: #B25A21;
    /* darker primary for emphasis */

    --color-secondary: #1d241b;
    /* warmer dark secondary surface (hero) */
    --color-on-secondary: #F8EFEA;
    /* soft warm text on secondary */

    --color-accent: #FFBE6A;
    /* slightly richer golden accent */
    --color-on-accent: #2b1306;
    /* dark text on accent */

    --color-text: #F6EEE9;
    /* main body text (light warm) */
    --card-bg: #334f48;
    /* cards/slides background, warmer */
    --muted: #d2c5bd;
    /* muted warm text */
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
        "Helvetica Neue", sans-serif;
    font-weight: 500;
    line-height: 1.6;
    /* Responsive base font-size: scales between mobile and desktop */
    /* min 16px, preferred ~ (viewport-driven), max 20px */
    font-size: clamp(16px, 1.5vw + 12px, 20px);
    color: var(--color-text);
    background: var(--color-bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* Hero and sections should all be full screen */
.hero,
section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
}

/* Hero styling */
.hero {
    background: var(--color-secondary);
    text-align: center;
    padding: 40px 20px;
    color: var(--color-on-secondary);
}

/* Typography: responsive headings and body sizes using clamp() */
h1 {
    /* use modular scale step 3 for h1 */
    font-size: calc(var(--ms-3) * var(--base));
    line-height: 1.12;
    /* slightly tight for display headings */
    margin: 0 0 0.5rem 0;
}

h2 {
    /* step 2 */
    font-size: calc(var(--ms-2) * var(--base));
    line-height: 1.18;
    /* comfortable for subheads */
    margin: 0 0 0.5rem 0;
}

h3 {
    /* step 1 */
    font-size: calc(var(--ms-1) * var(--base));
    line-height: 1.28;
    /* tighter than body but readable */
    margin: 0 0 0.5rem 0;
}

p {
    /* base */
    font-size: calc(var(--ms-0) * var(--base));
}

/* Sticky navbar */
#myHeader {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Navbar layout: title left, items to the right */
#navbar {
    background: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
}

.navbar-title {
    color: var(--color-on-primary);
    font-weight: 700;
    font-size: 1rem;
    margin-right: auto;
    /* push items to the right */
}

.navbar-items {
    display: flex;
    gap: 8px;
}

.navbar-items a {
    color: var(--color-on-primary);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 1rem;
    /* slightly larger nav text */
}

.navbar-items a:hover {
    background: var(--color-accent);
    color: var(--color-on-accent);
}

/* Layout */
main {
    /* max-width: 1000px; */
    margin: 0 auto;
}

section {
    text-align: center;
    /* default text color; sections override background/text as needed */
    color: var(--color-text);
    background: transparent;
}

/* Alternating section contrasts: group selectors to avoid duplicated rules */
/* Use secondary for 'hero' and 'projects' to feel a bit more prominent */
#home,
#projects {
    background: var(--color-secondary);
    color: var(--color-on-secondary);
}

/* Use surface for 'about' and 'contact' for a different, slightly lighter dark surface */
#about,
#contact {
    background: var(--color-surface);
    color: var(--color-text);
}

/* Scroll down arrow */
.scroll-down {
    margin-top: 40px;
    font-size: 2.5rem;
    color: var(--color-accent);
    text-decoration: none;
    animation: bounce 2s infinite;
}

.scroll-down:hover {
    color: var(--color-primary-dark);
}

.active {
    scroll-snap-type: unset;
}

/* --- Carousel styles --- */
.carousel-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
    /* for absolutely positioned buttons */
}

/* Dots pagination for the carousel */
.carousel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 1rem; /* place dots beneath the carousel */
    margin-left: 0;
    position: static; /* ensure centered in column layout */
    transform: none;
}

.carousel-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--muted);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.carousel-dots .dot.active {
    background: var(--color-accent);
    transform: scale(1.25);
}

.carousel-dots .dot:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.carousel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    /* place the dots in normal document flow directly beneath the cards */
    position: static;
    transform: none;
    margin-top: 12px;
    z-index: auto;
}


.carousel-btn.prev {
    left: 8px;
}

.carousel-btn.next {
    right: 8px;
}

.gallery {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 1000px;
    height: auto;
    /* allow slides to define height via aspect-ratio */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* hide native scrollbars but keep scrolling enabled */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.gallery:focus {
    outline: none;
}

/* WebKit browsers (Chrome, Safari) - hide scrollbar track */
.gallery::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.gallery .slide {
    scroll-snap-align: center;
    flex: 0 0 80%;
    /* Make slides square */
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 8px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card {
    padding: 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
    color: var(--color-text);
    background: transparent;
}

.card h3 {
    margin: 0 0 0.5rem 0;
}

.card p {
    margin: 0;
}

/* --- Responsive breakpoints --- */
/* Mobile: each slide is full width (use native swipe and scroll-snap) */
@media (max-width: 599px) {
    .gallery {
        height: auto;
        padding: 0;
        gap: 0; /* ensure only one slide visible at a time */
    }

    /* Stack gallery and dots vertically on mobile */
    .carousel-wrapper {
        flex-direction: column;
        align-items: center;
    }

    /* Hide navbar title on small screens to save space */
    .navbar-title {
        display: none;
    }

    /* Make each slide exactly the viewport width so aspect-ratio produces a square */
    .gallery .slide {
        /* each slide occupies the full viewport width on mobile */
        flex: 0 0 100vw;
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
        border-radius: 0;
    }

    /* Center nav items when title is hidden */
    #navbar {
        justify-content: center;
    }

    .carousel-btn {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    /* Hide navbar title on small screens to save space */
    .navbar-title {
        display: none;
    }
}

/* Tablet: show larger slide but still mostly single */
@media (min-width: 600px) and (max-width: 899px) {
    .gallery .slide {
        flex: 0 0 80%;
    }

    .carousel-btn {
        width: 56px;
        height: 56px;
    }
}

/* Desktop: show two slides */
@media (min-width: 900px) and (max-width: 1199px) {
    .gallery .slide {
        flex: 0 0 45%;
    }
}

/* Large desktop: show three slides */
@media (min-width: 1200px) {
    .gallery .slide {
        flex: 0 0 30%;
    }
}

/* On desktop (>=900px) show all cards in a grid instead of a scrolling carousel */
@media (min-width: 900px) {
    .gallery {
        display: grid;
        grid-template-columns: repeat(4, minmax(200px, 1fr));
        gap: 1rem;
        overflow: visible; /* show all cards, no horizontal scrolling */
        max-width: none;
        padding: 0.5rem 1rem;
        scroll-snap-type: none;
    }

    .gallery .slide {
        /* let grid control sizing */
        flex: none;
        width: 100%;
        min-width: auto;
        max-width: none;
        border-radius: 8px;
    }

    /* Hide carousel controls and dots on desktop since all cards are visible */
    .carousel-btn,
    .carousel-dots {
        display: none !important;
    }
}



/* Small bounce animation for the arrow */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(8px);
    }

    60% {
        transform: translateY(4px);
    }
}