/* ==========================================================================
   BASE / RESET
   Global defaults inherited by ASP.NET Core's default project template.
   ========================================================================== */


@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Smooth scrolling for in-page anchors (hero scroll-down arrow, back to top),
   but only for users who haven't turned off animations in their OS */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

html {
    font-size: 14px;
    background: var(--color-bg-alt);
}

/* Default focus ring for form controls and buttons (accessibility) */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
    background-color: black;
    color: var(--color-text);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* ==========================================================================
   PAGE BACKGROUND
   Dark navy gradient theme applied to the whole site.
   ========================================================================== */

/* Fonts are loaded via the Google Fonts link in _Layout.cshtml */
:root {
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}


/* ==========================================================================
   THEME COLORS
   Every color on the site comes from these variables. A theme is just a
   new set of values for the same variables, so no other rule has to know
   that themes exist. The theme is set as data-theme on <html> by the small
   script in _Layout.cshtml (before the page is drawn) and by site.js.
   ========================================================================== */

/* Dark (default) */
:root {
    color-scheme: dark; /* Native parts (scrollbars, form controls) follow the theme */

    --color-bg: #050914;
    --color-bg-alt: #0d1b3a;
    --color-bg-deep: #000000;

    --color-text: #ffffff;
    --color-text-soft: #d8dce6;
    --color-text-muted: #a9b4d0;
    --color-text-faint: rgba(255, 255, 255, 0.6);
    --color-divider: rgba(255, 255, 255, 0.3);

    --color-accent: #22d3ee;
    --color-accent-2: #a855f7;
    --gradient-accent: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
    /* Text on the accent gradient. Dark text: white on cyan is only 1.8:1,
       dark navy is 11:1 on cyan and 5:1 on purple */
    --color-on-accent: #050914;

    --color-surface: rgba(13, 27, 58, 0.55);
    --color-surface-solid: rgba(8, 14, 32, 0.92);
    --color-border: rgba(139, 92, 246, 0.25);
    --color-border-strong: rgba(139, 92, 246, 0.6);
    --color-border-neutral: rgba(255, 255, 255, 0.25);
    --color-border-neutral-strong: rgba(255, 255, 255, 0.5);
    --color-shadow: rgba(0, 0, 0, 0.3);
    --color-shadow-strong: rgba(0, 0, 0, 0.4);

    --color-tag-text: #d8b4fe;
    --color-tag-bg: rgba(139, 92, 246, 0.18);
    --color-tag-border: rgba(139, 92, 246, 0.4);

    --color-track: rgba(255, 255, 255, 0.08);

    --color-error: #f87171;
    --color-error-text: #fca5a5;
    --color-error-bg: rgba(248, 113, 113, 0.15);
    --color-error-border: rgba(248, 113, 113, 0.4);
    --color-success-text: #a5f3fc;
    --color-success-bg: rgba(34, 211, 238, 0.15);
    --color-success-border: rgba(34, 211, 238, 0.4);
}

/* Light. Warm greige accents (not the dark theme's cyan/purple, which look out
   of place on a light background): kept dark enough for 4.5:1 contrast, both as
   text and under the white button text on the accent gradient. */
:root[data-theme="light"] {
    color-scheme: light;

    --color-bg: #f5f7fb;
    --color-bg-alt: #e6ebf5;
    --color-bg-deep: #dde4f2;

    --color-text: #0d1b3a;
    --color-text-soft: #2a3550;
    --color-text-muted: #4a5675;
    --color-text-faint: rgba(13, 27, 58, 0.7);
    --color-divider: rgba(13, 27, 58, 0.3);

    --color-accent: #7a6b56;
    --color-accent-2: #574d3f;
    --color-on-accent: #ffffff;

    --color-surface: rgba(255, 255, 255, 0.7);
    --color-surface-solid: rgba(255, 255, 255, 0.97);
    --color-border: rgba(87, 77, 63, 0.3);
    --color-border-strong: rgba(87, 77, 63, 0.6);
    --color-border-neutral: rgba(13, 27, 58, 0.3);
    --color-border-neutral-strong: rgba(13, 27, 58, 0.6);
    --color-shadow: rgba(13, 27, 58, 0.12);
    --color-shadow-strong: rgba(13, 27, 58, 0.18);

    --color-tag-text: #574d3f;
    --color-tag-bg: rgba(122, 107, 86, 0.14);
    --color-tag-border: rgba(122, 107, 86, 0.4);

    --color-track: rgba(13, 27, 58, 0.12);

    --color-error: #b91c1c;
    --color-error-text: #991b1b;
    --color-error-bg: rgba(185, 28, 28, 0.08);
    --color-error-border: rgba(185, 28, 28, 0.4);
    --color-success-text: #155e75;
    --color-success-bg: rgba(21, 94, 117, 0.1);
    --color-success-border: rgba(21, 94, 117, 0.4);
}

body {
    margin: 0px;
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 50%, var(--color-bg) 100%);
    color: var(--color-text);
    font-family: var(--font-body);
}

    body > .container {
        flex: 1 0 auto;
    }


/* ==========================================================================
   NAVBAR
   ========================================================================== */

.navbar-themed {
    background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
    border-bottom-color: var(--color-border) !important;
}

.navbar-logo {
    height: 42px;
    width: auto;
}

/* Base nav link/text colors - monospace, "code style" */
.nav-item {
    color: var(--color-text-muted);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 20px;
    border: none;
    background: none;
    font-weight: 500;
}

.navbar, .navbar-nav, .nav-link {
    color: var(--color-text-muted);
}

.navbar-light .navbar-nav .nav-link,
.navbar-dark .navbar-nav .nav-link {
    color: var(--color-text-muted);
}

.navbar-brand {
    color: var(--color-text-muted);
    font-size: 25px !important;
    font-weight: 600 !important;
    font-family: var(--font-body) !important;
}

/* Highlights whichever page is currently active (set dynamically in _Layout.cshtml) */
.nav-link.active {
    color: var(--color-accent) !important;
}

/* The purple "./" in front of the active page, like a path in a terminal */
.nav-prefix {
    display: none;
    color: var(--color-accent-2);
}

.nav-link.active .nav-prefix {
    display: inline;
}


/* ==========================================================================
   HERO SECTION (Index page)
   Full-bleed dark landing area with logo, tagline, divider, and scroll cue.
   ========================================================================== */

.hero-landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    background: radial-gradient(ellipse at 50% 35%, var(--color-bg-alt) 0%, var(--color-bg) 55%, var(--color-bg-deep) 100%);
    padding: 40px 20px;
    /* "Breaks out" of the Bootstrap .container so the hero spans the full
       viewport width, even though it's nested inside the layout's container. */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.hero-landing__logo {
    width: min(60%, 300px);
    height: auto;
    margin-bottom: 24px;
}

/* Theme-swapped images: the bright cyan logo (or dark screenshot) for dark, the
   warm greige logo (or light screenshot) for light. Only the matching variant is
   shown; the other is display:none (so it isn't announced to screen readers
   either). Used by the hero/navbar logos and the project card thumbnails. */
.theme-logo--light,
.theme-img--light {
    display: none;
}

:root[data-theme="light"] .theme-logo--dark,
:root[data-theme="light"] .theme-img--dark {
    display: none;
}

:root[data-theme="light"] .theme-logo--light,
:root[data-theme="light"] .theme-img--light {
    display: revert;
}

/* The name is real text (not part of the logo image): it follows the theme,
   can be zoomed and translated, and is read by screen readers (WCAG 1.4.5).
   Wide letter spacing to match the look of the old logo text. */
.hero-landing__name {
    margin: 0 0 16px;
    font-size: clamp(1.75rem, 7vw, 3.25rem);
    font-weight: 300;
    letter-spacing: 0.3em;
    padding-left: 0.3em; /* letter-spacing also adds space after the last letter; this evens out the centering */
    text-transform: uppercase;
    color: var(--color-text);
}

.hero-landing__tagline {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 1.05rem;
    letter-spacing: 0;
    margin-bottom: 24px;
}

.hero-landing__divider {
    width: 130px;
    height: 4px;
    border-radius: 2px;
    margin: 0 auto;
    background: var(--gradient-accent);
}

/* Bouncing "scroll down" button pinned to the bottom of the hero */
.hero-landing__scroll {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    text-decoration: none;
    animation: bounce-arrow 2s infinite;
}

    .hero-landing__scroll:hover {
        color: var(--color-text);
        border-color: var(--color-accent-2);
    }

@media (prefers-reduced-motion: reduce) {
    .hero-landing__scroll {
        animation: none;
    }
}

@keyframes bounce-arrow {
    0%, 100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, 8px);
    }
}


/* ==========================================================================
   FLIP PROJECT CARDS (used on the Home page, via _ProjectCard.cshtml)

   Split into two elements on purpose:
   - .card-shell handles background, blur (glassmorphism) and hover scale.
   - .card handles the 3D flip animation (perspective + rotateX).
   These MUST stay on separate elements: combining backdrop-filter and a 3D
   transform on the same element causes rendering glitches in some browsers.
   ========================================================================== */

.card-shell {
    width: 300px;
    min-height: 280px;
    border-radius: 14px;
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 30px var(--color-shadow);
    overflow: hidden;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

    .card-shell:hover {
        transform: scale(1.05);
        border-color: var(--color-border-strong);
        box-shadow: 0 8px 30px var(--color-shadow-strong);
    }

.card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    perspective: 1000px; /* Enables the 3D flip effect for .card__content */
}

    /* Front-of-card fallback icon, shown when a project has no ImageUrl */
    .card svg {
        width: 48px;
        fill: var(--color-text);
        transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

.card-shell:hover svg,
.card-shell:focus-within svg {
    scale: 0;
}

/* Front-of-card image, shown when a project has an ImageUrl */
.card__image {
    width: 100%;
    height: 100%;
}

/* Back-of-card panel: title, description, tech tags, links.
   Deliberately solid (no backdrop-filter) — see note above. */
.card__content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    background-color: var(--color-surface-solid);
    transform: rotateX(-90deg);
    transform-origin: bottom;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* never let long content spill past the card edge */
}

.card-shell:hover .card__content,
.card-shell:focus-within .card__content {
    /* focus-within: keyboard users tabbing to the links see the back of the card too,
       otherwise they would be focusing links that are flipped out of view */
    transform: rotateX(0deg);
}

.card__title {
    margin: 0;
    font-size: 20px;
    color: var(--color-text);
    font-weight: 700;
}

.card__description {
    margin: 8px 0;
    font-size: 12px;
    color: var(--color-text-soft);
    line-height: 1.4;
    /* Clamp long descriptions so the buttons always fit inside the card */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card__button {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Live Demo / primary action: an outline at rest, fills with the accent on hover
   (no solid accent block until you interact with it) */
.card__button:not(.secondary) {
    background: transparent;
    border-color: var(--color-accent);
    color: var(--color-accent);
}

    .card__button:not(.secondary):hover {
        background: var(--gradient-accent);
        border-color: transparent;
        color: var(--color-on-accent);
    }

/* Source Code / secondary (outline) action button */
.secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-neutral);
}

    .secondary:hover {
        color: var(--color-text);
        border-color: var(--color-border-neutral-strong);
    }


/* ==========================================================================
   TECHNOLOGY TAGS
   Small pill-shaped badges listing a project's tech stack.
   Shared by both flip cards and showcase cards.
   ========================================================================== */

.technology {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    border-radius: 20px;
    background: var(--color-tag-bg);
    border: 1px solid var(--color-tag-border);
    color: var(--color-tag-text);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
}

.technology-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 20px;
}

.project_technologies {
    margin-top: 10px;
    color: var(--color-text);
}

.project_links {
    display: flex;
    gap: 8px; /* Keep all buttons on one row, even when there are three */
    margin-top: auto; /* pin the buttons to the bottom of the card */
    padding-top: 10px;
}


/* ==========================================================================
   PROJECT SHOWCASE GRID (used on the Projects page, via _ProjectShowcaseCard.cshtml)
   Static (non-flip) cards laid out in a responsive grid.
   ========================================================================== */

.project-showcase-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Drop to two columns below 1200px: three columns only when the cards are wide
   enough to fit all three action buttons on one row with comfortable spacing. */
@media (max-width: 1199px) {
    .project-showcase-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .project-showcase-grid {
        grid-template-columns: 1fr;
    }
}

.showcase-card {
    background-color: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 45px 35px;
    min-height: 520px;
    box-shadow: 0 8px 30px var(--color-shadow);
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

    .showcase-card:hover {
        border-color: var(--color-border-strong);
        transform: translateY(-4px);
    }

.showcase-card__header {
    margin-bottom: 35px;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.showcase-card__logo {
    max-height: 50px;
    max-width: 100%;
}

/* Fallback avatar (first letter of project title) shown when no logo is set */
.showcase-card__logo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: var(--color-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.showcase-card__title {
    color: var(--color-text);
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 18px;
}

.showcase-card__description {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.8;
    flex-grow: 1; /* Pushes tags/buttons to the bottom regardless of text length */
}

.showcase-card__btn {
    flex: 1 1 0; /* Every button gets an equal share of the row, so they're all the same width */
    min-width: 0; /* Allow the equal split to shrink the buttons instead of overflowing the card */
    max-width: 50%; /* A lone button stops at half width instead of filling the whole row */
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap; /* Never break a label like "Read more" onto two lines */
}

.showcase-card__btn--primary {
    background: var(--gradient-accent);
    color: var(--color-on-accent);
    border: none;
}

.showcase-card__btn--secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-neutral);
}

    .showcase-card__btn--secondary:hover {
        color: var(--color-text);
        border-color: var(--color-border-neutral-strong);
    }


/* ==========================================================================
   FOOTER
   ========================================================================== */

.footer {
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 100%);
    width: 100%;
}

.footer-text {
    color: var(--color-text-faint);
    font-family: var(--font-body);
}

.footer-link {
    color: var(--color-text-faint) !important;
    text-decoration: none;
    font-family: var(--font-body);
    transition: color 0.3s ease;
}

    .footer-link:hover {
        color: var(--color-text) !important;
    }

/* Vertical divider "|" between copyright and privacy policy link */
.footer .mx-2 {
    color: var(--color-divider);
}

/* LinkedIn / GitHub icon buttons */
.social-icon-btn {
    color: var(--color-text-faint);
    font-size: 22px;
    transition: all 0.3s ease;
    display: inline-block;
}

    .social-icon-btn:hover {
        color: var(--color-text);
        transform: translateY(-3px);
    }

/* "Back to top" button — styled to match the hero's scroll-down indicator */
.back-to-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-border-strong);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

    .back-to-top-btn:hover {
        color: var(--color-text);
        border-color: var(--color-accent-2);
        transform: translateY(-3px);
    }

    .back-to-top-btn i {
        color: inherit !important; /* Overrides the global Bootstrap Icons color rule below */
    }

/* On the light theme the muted text colour is a slate blue that clashes with the
   warm greige circle; use the warm accent so the arrow matches the ring. */
:root[data-theme="light"] .back-to-top-btn {
    color: var(--color-accent);
}

    :root[data-theme="light"] .back-to-top-btn:hover {
        color: var(--color-accent-2);
    }

/* Ensures Bootstrap Icons render correctly and default to the text color
   (overridden selectively where needed, e.g. .back-to-top-btn i above) */
.bi, [class^="bi-"], [class*=" bi-"] {
    font-family: "bootstrap-icons" !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    line-height: 1 !important;
    display: inline-block !important;
    color: var(--color-text) !important;
}

/* ==========================================================================
   ABOUT PAGE
   ========================================================================== */

.about-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px 20px;
    text-align: left;
}

.about-photo-placeholder {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-tag-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .about-photo-placeholder i {
        font-size: 72px;
        color: var(--color-text-muted);
    }

.about-intro__title {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.about-intro__subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

.about-bio {
    max-width: 700px;
    margin: 20px auto 60px;
    padding: 0 20px;
    color: var(--color-text-soft);
    line-height: 1.8;
    font-size: 1.05rem;
}

.about-highlights {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

.about-highlight-card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 25px 20px;
    text-align: center;
}

    .about-highlight-card i {
        font-size: 28px;
        color: var(--color-accent);
        margin-bottom: 12px;
        display: block;
    }

    .about-highlight-card p {
        color: var(--color-text-muted);
        font-size: 13px;
        line-height: 1.5;
        margin: 0;
    }

@media (max-width: 900px) {
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .about-hero {
        flex-direction: column;
        text-align: center;
    }

    .about-highlights {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   SKILLS (About page)
   ========================================================================== */

.skills {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

.skills__title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 8px;
}

.skills__intro {
    color: var(--color-text-muted);
    text-align: center;
    max-width: 60ch;
    margin: 0 auto 30px;
}

/* As many columns as fit, each at least 280px - no media queries needed */
.skills__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}

.skill-category {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 25px;
}

.skill-category__title {
    font-size: 1.2rem;
    color: var(--color-accent);
    margin-bottom: 18px;
}

.skill-category__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skill__label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 6px;
}

.skill__name {
    color: var(--color-text-soft);
    font-weight: 500;
}

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

.skill__track {
    height: 10px;
    background: var(--color-track);
    border-radius: 999px;
    overflow: hidden;
}

/* --skill-scale is set per bar by the server (0.2 - 1).
   Without JavaScript the bars are simply shown full - nothing breaks. */
.skill__fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: inherit;
    transform-origin: left;
    transform: scaleX(var(--skill-scale));
    transition: transform 1s ease-out;
}

/* Added by site.js: start empty, then fill when scrolled into view */
.skill-category.is-pending .skill__fill {
    transform: scaleX(0);
}

@media (prefers-reduced-motion: reduce) {
    .skill__fill {
        transition: none;
    }
}

/* ==========================================================================
   CONTACT PAGE
   ========================================================================== */

.contact-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 20px 100px;
}

.contact-subtitle {
    color: var(--color-text-muted);
}

.contact-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .contact-field label {
        color: var(--color-text-muted);
        font-size: 14px;
        font-weight: 500;
    }

.contact-input {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 14px;
}

    /* The ring itself comes from the global :focus-visible rule */
    .contact-input:focus {
        border-color: var(--color-border-strong);
    }

.contact-textarea {
    resize: vertical;
}

.contact-error {
    color: var(--color-error);
    font-size: 12px;
}

.contact-submit {
    align-self: flex-start;
    cursor: pointer;
    font-family: var(--font-body);
    margin-top: 10px;
}

.contact-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.contact-alert--success {
    background: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success-text);
}

.contact-alert--error {
    background: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    color: var(--color-error-text);
}

.contact-links {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.contact-link-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 24px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

    .contact-link-card:hover {
        color: var(--color-text);
        border-color: var(--color-border-strong);
        transform: translateY(-3px);
    }

    .contact-link-card i {
        font-size: 20px;
    }

/* ==========================================================================
   PRIVACY / LEGAL PAGES
   ========================================================================== */

.legal-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 20px 80px;
}

.legal-page__title {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

.legal-page__updated {
    color: var(--color-text-muted);
    font-size: 13px;
    margin-bottom: 30px;
}

.legal-page h2 {
    color: var(--color-text);
    font-size: 1.25rem;
    margin-top: 30px;
    margin-bottom: 10px;
}


/* ==========================================================================
   ACCESSIBILITY HELPERS
   ========================================================================== */

/* One visible focus ring for everything you can tab to */
:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* Skip link: hidden above the screen, slides in when it gets keyboard focus (WCAG 2.4.1).
   Not display:none, because then it couldn't be tabbed to. */
.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--color-on-accent);
    background: var(--gradient-accent);
    border-radius: 8px;
    text-decoration: none;
    transform: translateY(-200%);
}

    .skip-link:focus {
        transform: translateY(0);
        color: var(--color-on-accent);
    }

/* main and the nav only get focus from the skip link / back-to-top link.
   They are not interactive, so no focus ring. */
main:focus,
#top:focus {
    outline: none;
}


/* ==========================================================================
   THEME TOGGLE (navbar)
   ========================================================================== */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: 0.5rem;
    padding: 0;
    font-size: 1.25rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

    .theme-toggle:hover {
        background: var(--color-tag-bg);
    }

    .theme-toggle i {
        color: var(--color-text-muted) !important; /* Overrides the global Bootstrap Icons color rule */
    }

    .theme-toggle:hover i {
        color: var(--color-text) !important;
    }

/* Show the icon for the theme you would switch TO. Done in CSS (not JS),
   so the right icon is there from the first paint. */
.theme-toggle__moon,
:root[data-theme="light"] .theme-toggle__sun {
    display: none !important;
}

:root[data-theme="light"] .theme-toggle__moon {
    display: inline-block !important;
}

/* Bootstrap's .navbar-dark draws a light hamburger icon; make it dark in the light theme */
.navbar-themed .navbar-toggler {
    border-color: var(--color-border-strong);
}

:root[data-theme="light"] .navbar-themed .navbar-toggler-icon {
    filter: invert(1);
}


/* ==========================================================================
   PROJECT FILTER (Projects page)
   The buttons are rendered with the hidden attribute and shown by site.js,
   so visitors without JavaScript don't see buttons that do nothing.
   ========================================================================== */

.project-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 16px;
    padding: 0 20px;
    list-style: none;
}

.project-filter__button {
    min-height: 44px;
    padding: 0 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--color-border-neutral);
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}

    .project-filter__button:hover {
        color: var(--color-text);
        border-color: var(--color-border-neutral-strong);
    }

    /* The active filter is styled from the aria state, so the look and
       what screen readers hear can never disagree */
    .project-filter__button[aria-pressed="true"] {
        color: var(--color-on-accent);
        background: var(--gradient-accent);
        border-color: transparent;
    }

.project-filter__count {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 30px;
}


/* ==========================================================================
   PROJECT DIALOG ("Read more", Projects page)
   Native <dialog> opened with showModal(): focus is trapped inside,
   Escape closes it, and the page behind becomes inert.
   ========================================================================== */

.showcase-card__more {
    font-family: var(--font-body);
    cursor: pointer;
}

.project-dialog {
    width: min(92vw, 640px);
    max-height: 85vh;
    padding: 0; /* Padding is on the inner div, so a click on the dialog element itself is a backdrop click */
    color: var(--color-text);
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border-strong);
    border-radius: 14px;
    box-shadow: 0 8px 30px var(--color-shadow-strong);
}

    .project-dialog::backdrop {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
    }

.project-dialog__content {
    padding: 32px;
}

.project-dialog__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.project-dialog__details {
    color: var(--color-text-soft);
    line-height: 1.7;
}

.project-dialog__subtitle {
    font-size: 1.1rem;
    color: var(--color-accent);
    margin: 24px 0 10px;
}

.project-dialog__highlights {
    color: var(--color-text-soft);
    line-height: 1.6;
    padding-left: 1.2rem;
}

.project-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.project-dialog__close {
    margin-left: auto;
    font-family: var(--font-body);
    cursor: pointer;
}

/* Stop the page behind an open dialog from scrolling */
body:has(dialog[open]) {
    overflow: hidden;
}

