/* --- GLOBAL STYLES --- */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh; 
    font-family: 'Outfit', sans-serif;
    color: #fff;
    /* clip (not hidden) so body doesn't become a scroll container, which would break position: sticky */
    overflow-x: hidden;
    overflow-x: clip;
    padding-top: 60px;
}

/* --- BACKGROUND: AMBIENT GLOW + CAD VIEWPORT GRID --- */
/* Base colour for overscroll and anything outside the fixed layers */
html { background-color: #1c1c1c; }

/* Both layers are fixed to the viewport, behind all content, and static */
body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

/* Ambient glow: deep charcoal to dark forest, lit by soft sage from the
   upper left, with a faint grain so the gradients don't band */
body::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.06 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        radial-gradient(60% 55% at 12% 0%, rgba(163, 197, 133, 0.13), transparent 70%), /* Sage key light */
        radial-gradient(55% 50% at 95% 100%, rgba(120, 160, 110, 0.09), transparent 70%), /* Forest fill */
        radial-gradient(90% 70% at 60% 40%, rgba(36, 44, 36, 0.7), transparent 75%),
        linear-gradient(160deg, #1a1b1a 0%, #1d211d 50%, #222922 100%);
}

/* Viewport grid, like a Rhino/CAD drawing plane: minor lines every 24px, a
   major line every 5th, and sage world axes through the origin, faded out
   toward the edges so it reads as a plane rather than graph paper. The origin
   sits on the content's left edge, so the Y axis doubles as a margin line. */
body::after {
    --grid-minor: 24px;
    --grid-major: 120px;
    --origin-x: max(40px, calc((100vw - 1400px) / 2 + 40px));
    --origin-y: 112px;
    background-image:
        linear-gradient(rgba(163, 197, 133, 0.16), rgba(163, 197, 133, 0.16)), /* Y axis */
        linear-gradient(rgba(163, 197, 133, 0.16), rgba(163, 197, 133, 0.16)), /* X axis */
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size:
        1px 100%,
        100% 1px,
        var(--grid-major) var(--grid-major),
        var(--grid-major) var(--grid-major),
        var(--grid-minor) var(--grid-minor),
        var(--grid-minor) var(--grid-minor);
    background-position:
        var(--origin-x) 0,
        0 var(--origin-y),
        var(--origin-x) var(--origin-y),
        var(--origin-x) var(--origin-y),
        var(--origin-x) var(--origin-y),
        var(--origin-x) var(--origin-y);
    background-repeat: no-repeat, no-repeat, repeat, repeat, repeat, repeat;
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 35% 30%, #000 25%, transparent 100%);
    mask-image: radial-gradient(ellipse 85% 75% at 35% 30%, #000 25%, transparent 100%);
}

/* --- MODERN HEADER & NAV --- */
header {
    width: 100%;
    border-bottom: 1px solid rgba(163, 197, 133, 0.1); /* Sage Green border */
    position: fixed; 
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: rgba(28, 28, 28, 0.9); /* Dark background match */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 0;
    transition: all 0.3s ease;
}

nav {
    color: #fff;
    padding: 0 40px; 
    max-width: 1400px; 
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.name {
    /* Adjust this value (e.g. 3em for larger, 1.8em for smaller) */
    font-size: 2em; 
    font-weight: 700; 
    letter-spacing: normal; 
}

.name a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s;
}
.name a:hover {
    color: #A3C585; /* Sage Green Accent */
    opacity: 1;
}

/* Home: the name stays tucked away while the hero's big name is on screen,
   then fades in once it scrolls under the header (toggled in script.js) */
.name {
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}

header.name-tucked .name {
    opacity: 0;
    transform: translateY(8px);
    visibility: hidden;
    /* Stay visible until the fade-out finishes */
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.4s;
}

/* First placement on load shouldn't animate */
header.name-instant .name { transition: none; }

@media (prefers-reduced-motion: reduce) {
    header.name-tucked .name { transform: none; }
}

/* Navigation List */
header ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 40px; 
}

header li {
    margin: 0; 
}

header a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7); 
    padding: 5px 0;
    display: block;
    font-size: 1.2em; 
    font-weight: 500;
    letter-spacing: 0.05em; 
    position: relative;
    transition: color 0.3s ease;
}

/* Modern Underline Animation */
header a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #A3C585; /* Sage Green Accent */
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

header a:hover, header a.active {
    color: #A3C585; /* Sage Green Accent */
    background-color: transparent; 
    padding-left: 0; 
}

header a:hover::after, header a.active::after {
    width: 100%;
}

/* --- MOBILE DOCK (floating glass pill, enabled below 768px) --- */
.mobile-dock {
    display: none;
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 1000;
    align-items: center;
    padding: 4px;
    border-radius: 999px;
    background-color: rgba(28, 28, 28, 0.72); /* Header tint, a touch lighter */
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(163, 197, 133, 0.18); /* Sage Green border */
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.mobile-dock a {
    position: relative;
    z-index: 1;
    padding: 10px 20px;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.3s ease;
}

.mobile-dock a.active { color: #fff; }

.mobile-dock a:focus-visible {
    outline: 2px solid #A3C585;
    outline-offset: 2px;
}

/* Sage pill that slides under the active tab; script.js sets its width and offset */
.dock-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    border-radius: 999px;
    background-color: rgba(163, 197, 133, 0.2);
    border: 1px solid rgba(163, 197, 133, 0.45);
    opacity: 0;
}

/* Only animate once the indicator has been placed, so it doesn't slide in on load */
.mobile-dock.ready .dock-indicator {
    opacity: 1;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .mobile-dock.ready .dock-indicator { transition: none; }
}

/* --- PAGE SECTIONS LOGIC & ANIMATIONS --- */
.page-content {
    display: none;
    padding: 0;
    margin: 0 auto;
    width: 100%;
}

.page-content.active-section {
    display: block; 
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.page-content.active-section .hero-text,
.page-content.active-section .hero-portrait,
.page-content.active-section .about-row,
.page-content.active-section .featured-work,
.page-content.active-section .contact-section,
.page-content.active-section .resume-layout,
.page-content.active-section .portfolio-feature,
.page-content.active-section .spreads-header,
.page-content.active-section .spreads,
.page-content.active-section .resume-header,
.page-content.active-section .portfolio-header,
.page-content.active-section .projects-header,
.page-content.active-section .filter-container,
.page-content.active-section .projects-grid {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.page-content.active-section .hero-text { animation-delay: 0.1s; }
.page-content.active-section .hero-portrait { animation-delay: 0.25s; }
.page-content.active-section .about-row { animation-delay: 0.4s; }
.page-content.active-section .featured-work { animation-delay: 0.5s; }
.page-content.active-section .contact-section { animation-delay: 0.6s; }

.page-content.active-section .resume-header,
.page-content.active-section .portfolio-header,
.page-content.active-section .projects-header { animation-delay: 0.2s; }

.page-content.active-section .filter-container { animation-delay: 0.3s; }

.page-content.active-section .resume-layout,
.page-content.active-section .portfolio-feature,
.page-content.active-section .projects-grid { animation-delay: 0.3s; }

.page-content.active-section .spreads-header,
.page-content.active-section .spreads { animation-delay: 0.45s; }

.page-content.portfolio.active-section {
    display: block; 
    min-height: calc(100vh - 100px); 
    min-height: calc(100dvh - 100px); /* Tracks mobile browser toolbars */
}

/* --- ABOUT SECTION STYLES --- */
.about {
    width: 100%;
}

.introduction {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 40px;
}

/* Shared stroke icon used across the About page */
.icon {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Hero: name + statement on the left, framed portrait on the right */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    gap: 80px;
    align-items: center;
    min-height: min(760px, calc(100vh - 140px));
    padding-bottom: 60px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid rgba(163, 197, 133, 0.3);
    background: rgba(163, 197, 133, 0.08);
    color: #e6e6dd;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.status-badge .icon { color: #A3C585; }
.status-badge .dot-sep { color: #A3C585; }

.hero-name {
    margin: 28px 0 24px 0;
    font-size: clamp(3rem, 7vw, 6rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: #fff;
}

.hero-statement {
    margin: 0;
    max-width: 640px;
    font-size: clamp(1.15rem, 1.6vw, 1.4rem);
    font-weight: 400;
    line-height: 1.6;
    color: #e6e6dd; /* Warm Stone Grey */
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
}

/* Match both buttons' size, and stop the base hover from shifting padding */
.hero-actions .contact-button,
.hero-actions .contact-button:hover {
    margin-top: 0;
    font-size: 1em;
    padding: 12px 28px;
}

.hero-portrait {
    position: relative;
    isolation: isolate;
    justify-self: end;
    width: 100%;
    max-width: 440px;
}

/* Offset outline frame */
.hero-portrait::before {
    content: '';
    position: absolute;
    inset: 18px -18px -18px 18px;
    border: 1px solid rgba(163, 197, 133, 0.35);
    border-radius: 16px;
    z-index: -1;
}

/* Dot-grid detail, a nod to the computational work */
.hero-portrait::after {
    content: '';
    position: absolute;
    top: -28px;
    left: -28px;
    width: 140px;
    height: 140px;
    background: radial-gradient(rgba(163, 197, 133, 0.45) 1.5px, transparent 1.6px) 0 0 / 14px 14px;
    z-index: -1;
}

.profile-image {
    display: block;
    width: 100%;
    height: auto; /* natural 3:4, so the model isn't cropped */
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.profile-image:hover {
    transform: scale(1.02);
}

/* Bio + Off the Clock card */
.about-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 60px;
    align-items: start;
    padding: 80px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.about-title {
    margin: 0 0 24px 0;
    max-width: 20ch;
    font-size: 2em;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.about-bio p:not(.eyebrow) {
    max-width: 680px;
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    line-height: 1.75;
    font-weight: 400;
    color: #e6e6dd;
}

.about-bio a,
.off-clock a {
    color: #A3C585; /* Sage Green Accent */
    text-decoration: none;
    border-bottom: 1px solid rgba(163, 197, 133, 0.3);
    transition: border-color 0.3s;
}

.about-bio a:hover,
.off-clock a:hover {
    border-bottom-color: #A3C585;
}

.about-stats {
    max-width: 520px;
    margin: 32px 0;
}

.tool-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.off-clock {
    background: rgba(35, 39, 35, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(163, 197, 133, 0.15);
    border-radius: 14px;
    padding: 30px;
}

.off-clock h3 {
    margin: 0 0 12px 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #fff;
}

.off-clock-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.off-clock-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    color: #e6e6dd;
    font-size: 0.95em;
    line-height: 1.5;
}

.off-clock-list li:last-child { border-bottom: none; padding-bottom: 0; }

.off-clock-list .icon {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    color: #A3C585;
}

/* Featured work card */
.featured-work {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 56px;
    align-items: center;
    padding: 36px;
    background: rgba(35, 39, 35, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(163, 197, 133, 0.15);
    border-radius: 18px;
}

.featured-media {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.featured-media img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.featured-media:hover img { transform: scale(1.03); }

.featured-media:focus-visible,
.contact-chip:focus-visible {
    outline: 2px solid #A3C585;
    outline-offset: 3px;
}

.featured-body h2 {
    margin: 0 0 8px 0;
    font-size: 2.4em;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
}

.featured-subtitle {
    margin: 0 0 18px 0;
    font-size: 1.1em;
    font-weight: 500;
    color: #fff;
}

.featured-body p:not(.eyebrow):not(.featured-subtitle) {
    margin: 0 0 24px 0;
    line-height: 1.7;
    color: #e6e6dd;
}

.featured-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    margin-top: 30px;
}

/* --- CONTACT SECTION STYLES --- */
.contact-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    margin-top: 80px;
    padding: 48px 0 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.contact-intro h2 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    color: #fff;
}

.contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.contact-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    font-family: inherit;
    font-size: 0.95em;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s;
}

.contact-chip .icon { color: #A3C585; }

.contact-chip:hover {
    color: #A3C585;
    border-color: rgba(163, 197, 133, 0.6);
    background: rgba(163, 197, 133, 0.08);
    transform: translateY(-2px);
}

.contact-chip span { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
    .profile-image:hover,
    .featured-media:hover img,
    .contact-chip:hover { transform: none; }
}

/* --- EMAIL TOAST (fallback when no mail app handles mailto:) --- */
.email-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 20px);
    max-width: calc(100% - 32px);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 14px 20px;
    background: rgba(28, 28, 28, 0.95);
    border: 1px solid rgba(163, 197, 133, 0.5);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 3000;
}

.email-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.email-toast a {
    color: #A3C585; /* Sage Green Accent */
    text-decoration: none;
    font-weight: 600;
}

.email-toast a:hover {
    text-decoration: underline;
}

/* --- MESSAGE PANEL (drafting-sheet form below the contact chips) --- */
/* Grid rows animate 0fr -> 1fr so the panel expands to its natural height */
.msg-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.msg-panel.open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.msg-panel-inner {
    min-height: 0;
    overflow: hidden;
}

.msg-sheet {
    --msg-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;
    position: relative;
    margin: 28px 0 8px;
    padding: 0 32px 28px;
    background: #222622;
    border: 1px solid rgba(163, 197, 133, 0.25);
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35);
    transform: translateY(-12px);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-panel.open .msg-sheet { transform: none; }

/* Title block strip across the top, like a drawing sheet's header */
.msg-titleblock {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 -32px 28px;
    padding: 12px 16px 12px 32px;
    border-bottom: 1px solid rgba(163, 197, 133, 0.2);
    font-family: var(--msg-mono);
    font-size: 0.72em;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.msg-ref {
    padding: 3px 8px;
    border: 1px solid rgba(163, 197, 133, 0.5);
    border-radius: 3px;
    color: #A3C585;
}

.msg-owner {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.45);
}

.msg-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.msg-close:hover {
    color: #A3C585;
    background: rgba(163, 197, 133, 0.12);
}

.msg-botcheck { display: none; }

.msg-label {
    display: block;
    margin-bottom: 8px;
    padding: 0;
    font-family: var(--msg-mono);
    font-size: 0.72em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.2s;
}

/* Topic pills */
.msg-topics {
    margin: 0 0 28px;
    padding: 0;
    border: none;
}

.msg-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.msg-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.msg-pill span {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.92em;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.msg-pill:hover span { border-color: rgba(163, 197, 133, 0.6); }

.msg-pill input:checked + span {
    color: #1c1c1c;
    background: #A3C585;
    border-color: #A3C585;
    font-weight: 600;
}

.msg-pill input:focus-visible + span {
    outline: 2px solid #A3C585;
    outline-offset: 3px;
}

/* Fields: underlined inputs, like annotation lines on a sheet */
.msg-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px 32px;
}

.msg-field-wide { grid-column: 1 / -1; }

.msg-field input,
.msg-field textarea {
    width: 100%;
    padding: 6px 0 10px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 1.05em;
    transition: border-color 0.2s;
}

.msg-field textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}

.msg-field input:focus,
.msg-field textarea:focus {
    outline: none;
    border-bottom-color: #A3C585;
}

.msg-field:focus-within .msg-label { color: #A3C585; }

.msg-field input:user-invalid,
.msg-field textarea:user-invalid { border-bottom-color: #e0907e; }

.msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-top: 28px;
}

.msg-status {
    margin: 0 auto 0 0;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.6);
}

.msg-status.error { color: #e0907e; }

.msg-status a {
    color: #A3C585;
    font-weight: 600;
    text-decoration: none;
}

.msg-status a:hover { text-decoration: underline; }

.msg-send {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    border: 1px solid #A3C585;
    border-radius: 50px;
    background: #A3C585;
    color: #1c1c1c;
    font-family: inherit;
    font-size: 1em;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(163, 197, 133, 0.2);
    transition: transform 0.25s, box-shadow 0.25s;
}

.msg-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(163, 197, 133, 0.3);
}

.msg-send:focus-visible {
    outline: 2px solid #A3C585;
    outline-offset: 3px;
}

.msg-send .msg-send-arrow { transition: transform 0.25s; }
.msg-send:hover .msg-send-arrow { transform: translateX(3px); }

/* Sending: label and arrow fade out, spinner takes their place */
.msg-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(28, 28, 28, 0.25);
    border-top-color: #1c1c1c;
    border-radius: 50%;
    opacity: 0;
}

.msg-send.sending { cursor: progress; transform: none; }
.msg-send.sending .msg-send-label,
.msg-send.sending .msg-send-arrow { visibility: hidden; }
.msg-send.sending .msg-spinner {
    opacity: 1;
    animation: msgSpin 0.8s linear infinite;
}

@keyframes msgSpin { to { transform: rotate(360deg); } }

/* Success: the check draws itself as a single line */
.msg-success {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 0;
    outline: none;
}

.msg-success[hidden] { display: none; }

.msg-check {
    flex: none;
    width: 52px;
    height: 52px;
    fill: none;
    stroke: #A3C585;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.msg-check circle {
    stroke-dasharray: 132;
    stroke-dashoffset: 132;
    animation: msgDraw 0.6s ease-out forwards;
}

.msg-check path {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    animation: msgDraw 0.4s ease-out 0.5s forwards;
}

@keyframes msgDraw { to { stroke-dashoffset: 0; } }

.msg-success-title {
    margin: 0 0 4px;
    font-size: 1.25em;
    font-weight: 600;
}

.msg-success-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

.msg-again {
    margin-left: auto;
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 0.92em;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s;
}

.msg-again:hover {
    color: #A3C585;
    border-color: #A3C585;
}

@media (prefers-reduced-motion: reduce) {
    .msg-panel,
    .msg-sheet { transition: opacity 0.2s ease; }
    .msg-sheet { transform: none; }
    .msg-send:hover,
    .msg-send:hover .msg-send-arrow { transform: none; }
    .msg-check circle,
    .msg-check path { animation: none; stroke-dashoffset: 0; }
}

.contact-button {
    display: inline-block;
    margin-top: 25px;
    background-color: #fff;
    color: #1c1c1c !important; /* Dark text */
    font-size: 1.1em;
    text-decoration: none;
    border: 2px solid #fff;
    padding: 14px 40px;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 15px rgba(255,255,255,0.15);
}

.contact-button:hover {
    background-color: transparent;
    color: #A3C585 !important; /* Green Accent */
    border-color: #A3C585;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(163, 197, 133, 0.2); /* Green Glow */
    padding-left: 40px;
}

.contact-button.outline {
    background-color: transparent;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
    margin-top: 0;
}

.contact-button.outline:hover {
    background-color: rgba(163, 197, 133, 0.1);
    color: #A3C585 !important;
    border-color: #A3C585;
    box-shadow: 0 5px 20px rgba(163, 197, 133, 0.2);
}

/* --- SITE FOOTER (title-block sign-off on every page) --- */
.site-footer {
    max-width: 1400px;
    margin: 40px auto 0;
    padding: 0 40px 28px;
    font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;
    font-size: 0.72em;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.site-footer-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer-clock {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid rgba(163, 197, 133, 0.25);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.75);
}

.site-footer-clock time {
    color: #A3C585;
    font-variant-numeric: tabular-nums;
}

.site-footer-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #A3C585;
    animation: footerPulse 2.4s ease-out infinite;
}

/* A ring that swells out from the dot and fades, like a live indicator */
@keyframes footerPulse {
    0% { box-shadow: 0 0 0 0 rgba(163, 197, 133, 0.55); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(163, 197, 133, 0); }
}

.site-footer-note { justify-self: end; }

.site-footer-coord { color: rgba(163, 197, 133, 0.6); }

/* Easter-egg sound switch: reads as footer text until it's switched on */
.site-footer-sound {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: color 0.2s ease;
}

.site-footer-sound:hover,
.site-footer-sound:focus-visible { color: rgba(255, 255, 255, 0.8); }

.site-footer-sound:focus-visible {
    outline: 1px solid rgba(163, 197, 133, 0.6);
    outline-offset: 4px;
    border-radius: 2px;
}

.site-footer-sound[aria-pressed="true"] .sound-state { color: #A3C585; }

/* Too narrow for three columns: stack and centre, coordinates on their own line */
@media (max-width: 1100px) {
    .site-footer-inner { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 12px; }
    .site-footer-note { justify-self: center; }
    .site-footer-coord { display: block; margin-top: 6px; }
    .site-footer-sep { display: none; }
    .site-footer-sound { display: block; margin: 10px auto 0; }
}

@media (prefers-reduced-motion: reduce) {
    .site-footer-dot {
        animation: none;
        box-shadow: 0 0 0 3px rgba(163, 197, 133, 0.18);
    }
}

/* --- RESUME, PORTFOLIO & PROJECTS SECTION STYLES --- */
.resume, .portfolio-introduction, .projects {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 40px;
    width: 100%;
}

.resume-header, .portfolio-header, .projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
}

.resume-header h1, .portfolio-header h1, .projects-header h1 {
    font-size: 2em; 
    font-weight: 700;
    margin: 0;
    letter-spacing: normal;
    color: #fff;
}

/* --- PROJECTS HEADER UNDERLINE --- */
.projects-header h1 {
    position: relative;
    display: inline-block;
}

.projects-header h1::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -10px;
    width: 60px;
    height: 3px;
    background-color: #A3C585; /* Sage Green Accent */
}

/* --- SHARED: RESUME & PORTFOLIO --- */
.eyebrow {
    margin: 0 0 10px 0;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #A3C585; /* Sage Green Accent */
}

/* Name above the Resume/Portfolio titles; only shown on mobile, where the header is hidden */
.page-owner { display: none; }

.contact-button.primary {
    margin-top: 0;
    background-color: #A3C585;
    border-color: #A3C585;
    color: #1c1c1c !important;
    font-size: 1em;
    padding: 12px 28px;
    box-shadow: 0 6px 20px rgba(163, 197, 133, 0.2);
}

.contact-button.primary:hover {
    background-color: transparent;
    color: #A3C585 !important;
    padding-left: 28px;
}

.file-meta {
    font-weight: 400;
    opacity: 0.65;
    margin-left: 6px;
    font-size: 0.85em;
}

.text-link {
    color: #e6e6dd;
    text-decoration: none;
    font-size: 0.95em;
    transition: color 0.3s;
}

.text-link:hover {
    color: #A3C585;
}

.block-title {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin: 0 0 28px 0;
    font-size: 1.5em;
    font-weight: 600;
    color: #fff;
}

.block-title span {
    font-size: 0.55em;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: #A3C585;
}

/* --- RESUME --- */
.resume-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 64px;
    align-items: start;
}

/* Let grid columns shrink below their content's width (the skill filter row
   scrolls sideways on mobile and would otherwise stretch the column) */
.resume-layout > *,
.portfolio-feature > * {
    min-width: 0;
}

.resume-aside {
    position: sticky;
    top: 100px;
}

.resume-card {
    background: rgba(35, 39, 35, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(163, 197, 133, 0.15);
    border-radius: 14px;
    padding: 30px;
}

.resume-card h2 {
    margin: 0 0 6px 0;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.2;
}

.resume-card-org {
    margin: 0;
    color: #e6e6dd;
    font-weight: 300;
}

.resume-card-loc {
    margin: 4px 0 0 0;
    color: #888;
    font-size: 0.9em;
}

.resume-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 26px 0;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.resume-stats dt {
    font-size: 1.7em;
    font-weight: 700;
    color: #A3C585;
    line-height: 1;
}

.resume-stats dd {
    margin: 6px 0 0 0;
    font-size: 0.75em;
    color: #999;
    line-height: 1.3;
}

.resume-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.resume-block {
    margin-bottom: 64px;
}

/* Experience timeline */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 28px;
}

.timeline-date {
    padding-top: 3px;
    font-size: 0.85em;
    font-weight: 500;
    color: #999;
    letter-spacing: 0.02em;
}

.timeline-body {
    position: relative;
    padding: 0 0 40px 32px;
    border-left: 1px solid rgba(163, 197, 133, 0.2);
}

.timeline-item:last-child .timeline-body {
    padding-bottom: 0;
    border-left-color: transparent;
}

/* Node on the line */
.timeline-body::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #1f231f;
    border: 2px solid rgba(163, 197, 133, 0.6);
    box-sizing: border-box;
    transition: background 0.3s, transform 0.3s;
}

.timeline-item:hover .timeline-body::before {
    background: #A3C585;
    transform: scale(1.2);
}

.timeline-item.current .timeline-body::before {
    background: #A3C585;
    border-color: #A3C585;
    box-shadow: 0 0 0 0 rgba(163, 197, 133, 0.5);
    animation: nodePulse 2.4s ease-out infinite;
}

.timeline-item.current .timeline-date {
    color: #A3C585;
}

@keyframes nodePulse {
    0% { box-shadow: 0 0 0 0 rgba(163, 197, 133, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(163, 197, 133, 0); }
    100% { box-shadow: 0 0 0 0 rgba(163, 197, 133, 0); }
}

.timeline-body h3 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #fff;
    transition: color 0.3s;
}

.timeline-item:hover .timeline-body h3 {
    color: #A3C585;
}

.timeline-org {
    margin: 0 0 14px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 0.95em;
}

.timeline-org a {
    color: #e6e6dd;
    text-decoration: none;
    border-bottom: 1px solid rgba(163, 197, 133, 0.3);
    transition: color 0.3s, border-color 0.3s;
}

.timeline-org a:hover {
    color: #A3C585;
    border-bottom-color: #A3C585;
}

.timeline-org span {
    color: #888;
}

.timeline-points {
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline-points li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 8px;
    color: #c5c6c7;
    font-weight: 300;
    line-height: 1.65;
}

.timeline-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 8px;
    height: 1px;
    background: #A3C585;
}

/* Education */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.edu-card {
    padding: 26px;
    border-radius: 12px;
    background: rgba(37, 37, 37, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.3s, transform 0.3s;
}

.edu-card:hover {
    border-color: rgba(163, 197, 133, 0.3);
    transform: translateY(-3px);
}

.edu-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.15em;
    font-weight: 600;
}

.edu-card h3 a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

.edu-card h3 a:hover {
    color: #A3C585;
}

.edu-degree {
    margin: 0 0 2px 0;
    color: #e6e6dd;
    font-weight: 400;
}

.edu-note {
    margin: 14px 0 0 0;
    font-size: 0.85em;
    color: #999;
    line-height: 1.55;
}

/* Skills */
.skill-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.skill-filter {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e6e6dd;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s;
}

.skill-filter span {
    opacity: 0.5;
    margin-left: 4px;
}

.skill-filter:not(.active):hover {
    border-color: #A3C585;
    color: #A3C585;
}

.skill-filter.active {
    background: #A3C585;
    border-color: #A3C585;
    color: #1c1c1c;
}

.skill-filter:focus-visible,
.spread-thumb:focus-visible {
    outline: 2px solid #A3C585;
    outline-offset: 3px;
}

.skill-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.skill-badge {
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e6e6dd;
    font-size: 0.9em;
    cursor: default;
    transition: opacity 0.35s, transform 0.25s, border-color 0.25s, color 0.25s, background 0.25s;
}

.skill-badge:hover {
    transform: translateY(-2px);
    border-color: rgba(163, 197, 133, 0.5);
    color: #A3C585;
}

.skill-cloud.filtered .skill-badge {
    opacity: 0.2;
}

.skill-cloud.filtered .skill-badge.match {
    opacity: 1;
    border-color: rgba(163, 197, 133, 0.5);
    background: rgba(163, 197, 133, 0.1);
    color: #A3C585;
}

/* Publications & certifications */
.resume-extras {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-list li {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    color: #e6e6dd;
    font-weight: 400;
}

.plain-list li:first-child {
    padding-top: 0;
}

.plain-list a {
    color: #e6e6dd;
    text-decoration: none;
    border-bottom: 1px solid rgba(163, 197, 133, 0.3);
    transition: color 0.3s;
}

.plain-list a:hover {
    color: #A3C585;
}

.plain-list span {
    display: block;
    margin-top: 4px;
    font-size: 0.85em;
    color: #888;
}

/* --- PORTFOLIO --- */
.portfolio-feature {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 56px;
    align-items: center;
    margin-bottom: 80px;
}

/* Cover with two spreads fanned out behind it, like a stack of prints */
.portfolio-stack {
    position: relative;
    display: block;
    margin: 4% 8% 4% 0;
}

.stack-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform-origin: bottom left;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.6s;
    filter: brightness(0.55);
}

.stack-back { transform: translate(9%, -2%) rotate(5deg); }
.stack-mid { transform: translate(4.5%, -1%) rotate(2.5deg); filter: brightness(0.7); }

.portfolio-stack:hover .stack-back { transform: translate(13%, -4%) rotate(8deg); filter: brightness(0.8); }
.portfolio-stack:hover .stack-mid { transform: translate(6.5%, -2%) rotate(4deg); filter: brightness(0.9); }

.portfolio-cover {
    position: relative;
    display: block;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.6s;
}

.portfolio-cover img {
    display: block;
    width: 100%;
    height: auto;
}

.portfolio-stack:hover .portfolio-cover {
    transform: translateY(-6px);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(163, 197, 133, 0.4), 0 0 40px rgba(163, 197, 133, 0.12);
}

.cover-badge {
    position: absolute;
    right: 16px;
    bottom: 16px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(28, 28, 28, 0.85);
    color: #A3C585;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.portfolio-details h2 {
    margin: 0 0 18px 0;
    font-size: 2.6em;
    font-weight: 700;
    line-height: 1.08;
    color: #fff;
}

.portfolio-summary {
    margin: 0 0 28px 0;
    color: #c5c6c7;
    font-weight: 300;
    line-height: 1.7;
    font-size: 1.05em;
}

.portfolio-meta {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 36px;
    margin: 0 0 32px 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.portfolio-meta dt {
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
}

.portfolio-meta dd {
    margin: 6px 0 0 0;
    color: #fff;
}

.portfolio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.portfolio-actions .contact-button.outline {
    font-size: 1em;
    padding: 12px 28px;
}

.spreads-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 24px;
    margin-bottom: 24px;
}

.spreads-header .block-title {
    margin: 0;
}

.spreads-header p {
    margin: 0;
    color: #888;
    font-size: 0.9em;
}

.spreads {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 28px 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.spread-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    border-radius: 6px;
    overflow: hidden;
    cursor: zoom-in;
    background: #333;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    transition: box-shadow 0.3s;
}

.spread-thumb img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.spread-thumb:hover {
    box-shadow: 0 0 0 1px rgba(163, 197, 133, 0.5), 0 15px 30px rgba(0, 0, 0, 0.4);
}

.spread-thumb:hover img {
    transform: scale(1.04);
}

.spread-caption {
    display: block;
    margin-top: 12px;
    text-decoration: none;
}

.spread-title {
    display: block;
    color: #fff;
    font-weight: 600;
    transition: color 0.3s;
}

.spread-caption:hover .spread-title {
    color: #A3C585;
}

.spread-caption:hover .spread-title::after {
    content: ' \2197';
}

.spread-meta {
    display: block;
    margin-top: 3px;
    font-size: 0.82em;
    color: #888;
}

/* --- REDESIGNED PROJECTS SECTION --- */
.projects-header {
    border-bottom: none; /* Removed border as filter container separates it */
    margin-bottom: 20px;
}

/* NEW: Filter Styles */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #e6e6dd;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9em;
    font-weight: 500;
}

.filter-btn:focus-visible,
.project-card:focus-visible {
    outline: 2px solid #A3C585;
    outline-offset: 3px;
}

.filter-btn.active {
    background: #A3C585;
    color: #1c1c1c;
    border-color: #A3C585;
}

.filter-btn:not(.active):hover {
    background: rgba(163, 197, 133, 0.1);
    color: #A3C585;
    border-color: #A3C585;
}

.projects-grid {
    display: grid;
    /* min() keeps a single column from overflowing on narrow phones */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 32px;
}

.project-card {
    background-color: #252525; /* Slightly lighter earth tone */
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, opacity 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    height: 100%; /* Equal height cards */
    position: relative;
}

.project-card.hidden {
    display: none; /* Hide filtered items */
}

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

.project-card:not(.hidden) {
    animation: cardIn 0.35s ease backwards;
}

/* Hover lift only on devices that can hover, so taps don't leave cards stuck raised */
@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3), 0 0 15px rgba(163, 197, 133, 0.1); /* Subtle green glow */
        border-color: rgba(163, 197, 133, 0.3);
    }
}

.project-image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    position: relative;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #333;
    transition: transform 0.5s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05); /* Zoom effect on hover */
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(28, 28, 28, 0.8));
    opacity: 0.6;
    transition: opacity 0.3s;
}

.project-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.project-tag {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgba(163, 197, 133, 0.1); /* Green tint */
    color: #A3C585;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.project-title {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #fff;
    line-height: 1.3;
    transition: color 0.3s;
}

.project-card:hover .project-title {
    color: #A3C585;
}

.project-description {
    font-size: 1em;
    color: #c5c6c7;
    line-height: 1.6;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.read-more-link {
    font-size: 0.9em;
    font-weight: 600;
    color: #A3C585;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.project-card:hover .read-more-link {
    opacity: 1;
    text-shadow: 0 0 8px rgba(163, 197, 133, 0.4);
}

/* --- MODAL STYLES (Shared & Extended) --- */

/* New Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(28, 28, 28, 0.95); /* Very dark earthy background */
    backdrop-filter: blur(8px);
    overflow-y: auto; /* Allow scrolling for tall content */
    
    /* Apply Fade In */
    animation: modalFadeIn 0.3s ease-out forwards;
}

/* Project Modal specific adjustments */
#projectModal .modal-content {
    background-color: #222622; /* Dark forest, matches the page gradient */
    margin: 5vh auto;
    padding: 0; /* Reset padding for image header */
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    color: #fff;
    border: 1px solid rgba(163, 197, 133, 0.2);
    position: relative;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    
    /* Apply Zoom/Slide */
    animation: modalContentZoom 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    background-color: #333;
    display: block;
    cursor: pointer; /* Clickable now */
}

.modal-body {
    padding: 40px;
}

.modal-title {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #fff;
    line-height: 1.2;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.modal-tag {
    background-color: rgba(163, 197, 133, 0.1);
    color: #A3C585;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.modal-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: #e6e6dd;
}

/* --- GALLERY STYLES --- */
.modal-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.gallery-item {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    background-color: #333;
}

.gallery-item:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

.close-modal {
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    position: absolute;
    top: 15px;
    right: 25px;
    cursor: pointer;
    z-index: 2001;
    background: rgba(0,0,0,0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    line-height: 1; /* Fix alignment */
    padding-bottom: 4px; /* Optical center */
}

.close-modal:hover {
    background: rgba(163, 197, 133, 0.2);
    color: #A3C585;
}

/* --- LIGHTBOX STYLES --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(28, 28, 28, 0.95);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(163, 197, 133, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #fff;
    font-size: 50px;
    font-weight: 300;
    cursor: pointer;
    z-index: 3001;
    transition: color 0.3s;
    line-height: 1;
}

.lightbox-close:hover {
    color: #A3C585;
}

/* NEW: Lightbox Navigation Arrows */
.lightbox-prev, .lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 40px;
    transition: 0.3s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    z-index: 3002;
    background-color: rgba(0,0,0,0.3); /* Slight background for visibility */
}

.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-prev {
    left: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background-color: rgba(163, 197, 133, 0.2);
    color: #A3C585;
}

/* --- RESPONSIVE: TABLET / SMALL LAPTOP --- */
/* Dates move above each role so the text column keeps a readable width */
@media (max-width: 1100px) {
    .timeline-item { grid-template-columns: 1fr; gap: 0; }
    .timeline-date { padding: 0 0 6px 32px; border-left: 1px solid rgba(163, 197, 133, 0.2); }
    .timeline-item:last-child .timeline-date { border-left-color: rgba(163, 197, 133, 0.2); }
    .timeline-body::before { top: -22px; }
}

/* Summary card sits above the resume instead of beside it */
@media (max-width: 960px) {
    .resume-layout { grid-template-columns: 1fr; gap: 48px; }
    .resume-aside { position: static; }
    .resume-card-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 20px; }
    .portfolio-feature { grid-template-columns: 1fr; gap: 36px; }

    /* About: photo leads at its natural proportion above the text; cards stack */
    .hero { grid-template-columns: 1fr; gap: 32px; min-height: 0; }
    .hero-portrait { order: -1; justify-self: stretch; max-width: none; }
    .hero-portrait::before,
    .hero-portrait::after { display: none; }
    .about-row { grid-template-columns: 1fr; gap: 40px; }
    .featured-work { grid-template-columns: 1fr; gap: 32px; }
}

/* --- RESPONSIVE / MOBILE STYLES --- */
@media (max-width: 768px) {
    /* --- MOBILE: no top header; the floating dock is the only navigation --- */
    header { display: none; }
    /* html carries the header offset (body's copy is 0 here); swap it for the notch inset */
    html { padding-top: env(safe-area-inset-top); }
    body { padding-top: 0; }

    .mobile-dock { display: flex; }

    /* Grid origin on the 20px content gutter, X axis in the top margin */
    body::after { --origin-x: 20px; --origin-y: 14px; }

    /* With no header, Resume and Portfolio name their owner above the title */
    .page-owner { display: block; margin-bottom: 6px; }

    /* The footer is the last thing on every page, so it clears the floating dock
       (48px pill + 16px offset + breathing room) */
    .site-footer {
        margin-top: 24px;
        padding: 0 20px calc(88px + env(safe-area-inset-bottom));
    }

    /* Lift the email toast above the dock */
    .email-toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

    .introduction { padding: 30px 20px; }

    /* Home hero: badge and name, then the photo, then statement and buttons.
       display: contents lets the text's children interleave with the photo,
       so the name sits clear of the floating dock on the first screen. */
    .hero { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding-bottom: 48px; }
    .hero-text { display: contents; }
    .status-badge { order: 1; }
    .hero-name { order: 2; margin: 20px 0 24px 0; }
    .hero-portrait { order: 3; align-self: stretch; }
    .hero-statement { order: 4; margin-top: 28px; }
    .hero-actions { order: 5; align-self: stretch; margin-top: 32px; }

    /* .hero-text no longer draws a box, so its fade moves onto its children,
       staggered in their new visual order */
    .page-content.active-section .hero-text { animation: none; opacity: 1; }
    .page-content.active-section .hero-text > * {
        opacity: 0;
        animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }
    .page-content.active-section .status-badge { animation-delay: 0.1s; }
    .page-content.active-section .hero-name { animation-delay: 0.15s; }
    .page-content.active-section .hero-portrait { animation-delay: 0.25s; }
    .page-content.active-section .hero-statement { animation-delay: 0.35s; }
    .page-content.active-section .hero-actions { animation-delay: 0.45s; }

    .profile-image { border-radius: 12px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45); }
    .hero-actions .contact-button { flex: 1 1 auto; text-align: center; }
    .about-row { padding: 56px 0; }
    .about-title { font-size: 1.6em; }
    .off-clock { padding: 24px; }
    .featured-work { padding: 20px; }
    .featured-body h2 { font-size: 2em; }
    .contact-section { margin-top: 56px; padding-top: 40px; }
    .contact-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .contact-chip:first-child,
    .contact-chip:last-child { grid-column: 1 / -1; }
    .msg-sheet { padding: 0 20px 24px; }
    .msg-titleblock { margin: 0 -20px 24px; padding-left: 20px; }
    .msg-fields { grid-template-columns: 1fr; gap: 24px; }
    .msg-footer { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
    .msg-status { margin: 0; text-align: center; }
    .msg-send { justify-content: center; }
    .msg-success { flex-wrap: wrap; }
    .msg-again { margin-left: 0; }

    .page-content.portfolio.active-section { display: block; padding: 0; }
    .portfolio-introduction { padding: 30px 20px; }

    .resume-card { padding: 24px; }
    .resume-card-actions { flex-direction: column; align-items: flex-start; }
    .edu-grid, .resume-extras { grid-template-columns: 1fr; }
    .resume-block { margin-bottom: 48px; }
    .skill-filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px 22px; padding: 0 20px 4px; scrollbar-width: none; }
    .skill-filters::-webkit-scrollbar { display: none; }
    .skill-filter { flex: 0 0 auto; }

    /* Portfolio: cover on top, spreads as a swipeable row */
    .portfolio-feature { grid-template-columns: 1fr; gap: 32px; margin-bottom: 56px; }
    .portfolio-details h2 { font-size: 2em; }
    .portfolio-meta { gap: 24px; }
    .portfolio-actions .contact-button { flex: 1 1 auto; text-align: center; }
    .spreads {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 20px;
        gap: 16px;
        margin: 0 -20px;
        padding: 0 20px 8px;
        scrollbar-width: none;
    }
    .spreads::-webkit-scrollbar { display: none; }
    .spread { flex: 0 0 78%; scroll-snap-align: start; }

    .resume { padding: 30px 20px; }
    .projects { padding: 30px 20px; }

    /* REDESIGNED MOBILE HEADER LAYOUT */
    .projects-header {
        text-align: left;
        margin-bottom: 20px;
    }

    /* Resume and Portfolio headers: Side by side */
    .resume-header, .portfolio-header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        text-align: left;
    }
    
    .resume-header h1, .portfolio-header h1, .projects-header h1 {
        font-size: 2em; /* Matches ABOUT header size */
        margin-bottom: 0;
        line-height: 1; /* Help with vertical alignment if text wraps */
    }
    
    .resume-header .contact-button {
        padding: 10px 18px;
        font-size: 0.95em;
        white-space: nowrap;
    }

    /* Single swipeable row of filters instead of wrapping onto two lines */
    .filter-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        margin: 0 -20px 30px;
        padding: 0 20px 20px;
        scrollbar-width: none;
    }

    .filter-container::-webkit-scrollbar { display: none; }

    .projects-grid { gap: 24px; }
    .project-info { padding: 20px; }
    .project-title { font-size: 1.25em; }

    .filter-btn {
        font-size: 0.85em;
        padding: 8px 16px;
        flex: 0 0 auto;
    }

    #projectModal .modal-content {
        width: calc(100% - 24px);
        margin: 12px auto;
    }

    .modal-header-image { height: auto; aspect-ratio: 16 / 10; }
    .modal-body { padding: 24px 20px 28px; }
    .modal-title { font-size: 1.6em; }
    .modal-text { font-size: 1em; line-height: 1.7; }
    .modal-gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .gallery-item { height: 100px; }

    .close-modal {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 32px;
    }

    .lightbox-close { top: 16px; right: 20px; }
}
