/* ==========================================================================
   EDITORIAL POSTER HERO (DYMAS ALFIN STYLE) - VANILLA CSS
   ========================================================================== */

:root {
    --bg-color: #FAFAFA;
    --text-dark: #252525;        /* Signature deep charcoal */
    --text-muted: #666666;
    --border-color: rgba(37, 37, 37, 0.12);
    --pill-bg: #FFFFFF;
    --pill-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    --nav-bg: rgba(250, 250, 250, 0.95);
    --btn-height: 44px;          /* Unified height for all hero action buttons */
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background-color: var(--bg-color);
}

html {
    scroll-behavior: smooth;
    color-scheme: light;
}

/* ==========================================================================
   GLOBAL HIGH-CONTRAST SELECTION (NEVER INVERTS OR HIDES TEXT)
   ========================================================================== */
::selection {
    background: rgba(37, 37, 37, 0.16);
    color: inherit;
}

::-moz-selection {
    background: rgba(37, 37, 37, 0.16);
    color: inherit;
}

html[data-theme='dark'] ::selection {
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
}

html[data-theme='dark'] ::-moz-selection {
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
}

/* ==========================================================================
   UNIVERSAL SCROLLBAR REMOVAL (ALL BROWSERS & ALL ELEMENTS)
   ========================================================================== */
html,
body,
* {
    scrollbar-width: none !important;     /* Firefox, modern standards */
}

*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none !important;             /* Safari, Chrome, Opera, Edge Chromium */
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

body {
    width: 100%;
    overflow-x: hidden;
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    user-select: text;
    -webkit-user-select: text;
    transition: background-color 0.45s ease, color 0.35s ease;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 3000;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    background: var(--text-dark);
    color: var(--bg-color);
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.18s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* ===========================================================================
   LIGHT / DARK THEME RAIL
   =========================================================================== */
.theme-scene-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1100;
    display: grid;
    width: 72px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    view-transition-name: theme-rail;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), filter 0.28s ease;
}

.theme-scene-toggle:hover,
.theme-scene-toggle:focus-visible {
    transform: translateY(-2px);
    filter: drop-shadow(0 13px 22px rgba(0, 0, 0, 0.2));
}

.theme-scene-toggle:active {
    transform: translateY(0) scale(0.96);
}

.theme-scene-toggle:focus-visible {
    outline: 3px solid var(--text-dark);
    outline-offset: 3px;
}

/* A palette sample instead of a conventional icon: one thick line, with a
   moving negative-space seam that swaps sides as the page changes theme. */
.theme-scene-track {
    position: relative;
    display: block;
    width: 58px;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #252525;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 1px 0 rgba(255, 255, 255, 0.62);
    transition: background-color 0.62s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.62s ease;
}

.theme-scene-track::before {
    position: absolute;
    top: 4px;
    left: 6px;
    width: 21px;
    height: 4px;
    border-radius: inherit;
    background: #FAFAFA;
    content: '';
    transform: translateX(0);
    transition: background-color 0.62s ease, transform 0.68s cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme='dark'] .theme-scene-track {
    background: #FAFAFA;
    box-shadow: inset 0 0 0 1px rgba(37, 37, 37, 0.16), 0 1px 0 rgba(255, 255, 255, 0.1);
}

html[data-theme='dark'] .theme-scene-track::before {
    background: #252525;
    transform: translateX(25px);
}

.theme-scene-toggle.is-rail-pending .theme-scene-track,
.theme-scene-toggle.is-rail-animating .theme-scene-track {
    transition: none;
}

.theme-scene-toggle.is-rail-pending .theme-scene-track::before,
.theme-scene-toggle.is-rail-animating .theme-scene-track::before {
    transition: none;
}

/* Preserve the outgoing rail until the page sweep is completely gone. */
html[data-theme='dark'] .theme-scene-toggle.is-rail-pending.is-rail-moving-dark .theme-scene-track {
    background: #252525;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 1px 0 rgba(255, 255, 255, 0.62);
}

html[data-theme='dark'] .theme-scene-toggle.is-rail-pending.is-rail-moving-dark .theme-scene-track::before {
    background: #FAFAFA;
    transform: translateX(0);
}

html:not([data-theme='dark']) .theme-scene-toggle.is-rail-pending.is-rail-moving-light .theme-scene-track {
    background: #FAFAFA;
    box-shadow: inset 0 0 0 1px rgba(37, 37, 37, 0.16), 0 1px 0 rgba(255, 255, 255, 0.1);
}

html:not([data-theme='dark']) .theme-scene-toggle.is-rail-pending.is-rail-moving-light .theme-scene-track::before {
    background: #252525;
    transform: translateX(25px);
}

.theme-scene-toggle.is-rail-animating.is-rail-moving-dark .theme-scene-track {
    animation: theme-rail-shell-to-dark 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.theme-scene-toggle.is-rail-animating.is-rail-moving-light .theme-scene-track {
    animation: theme-rail-shell-to-light 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.theme-scene-toggle.is-rail-animating.is-rail-moving-dark .theme-scene-track::before {
    animation: theme-rail-to-dark 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.theme-scene-toggle.is-rail-animating.is-rail-moving-light .theme-scene-track::before {
    animation: theme-rail-to-light 0.52s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes theme-rail-shell-to-dark {
    from {
        background: #252525;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 1px 0 rgba(255, 255, 255, 0.62);
    }
    to {
        background: #FAFAFA;
        box-shadow: inset 0 0 0 1px rgba(37, 37, 37, 0.16), 0 1px 0 rgba(255, 255, 255, 0.1);
    }
}

@keyframes theme-rail-shell-to-light {
    from {
        background: #FAFAFA;
        box-shadow: inset 0 0 0 1px rgba(37, 37, 37, 0.16), 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    to {
        background: #252525;
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16), 0 1px 0 rgba(255, 255, 255, 0.62);
    }
}

@keyframes theme-rail-to-dark {
    from {
        background: #FAFAFA;
        transform: translateX(0);
    }
    to {
        background: #252525;
        transform: translateX(25px);
    }
}

@keyframes theme-rail-to-light {
    from {
        background: #252525;
        transform: translateX(25px);
    }
    to {
        background: #FAFAFA;
        transform: translateX(0);
    }
}

/* Keep the outgoing rail visible and static during the page sweep. The new
   state stays hidden until the live post-sweep rail animation takes over. */
::view-transition-group(theme-rail) {
    animation: none;
}

::view-transition-old(theme-rail) {
    animation: none;
    opacity: 1;
}

::view-transition-new(theme-rail) {
    animation: none;
    opacity: 0;
}

/* ==========================================================================
   1. TOP NAVBAR
   ========================================================================== */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(72px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 6vw 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: none;
    transition: background-color 0.45s ease;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--text-dark);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2.2rem;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

body.is-scrolled .nav-links {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
}

.nav-link {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    padding: 0.25rem 0;
    transition: color 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-dark);
}

.nav-chat-btn {
    height: 40px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #FFFFFF;
    background: var(--text-dark);
    border: 1px solid var(--text-dark);
    padding: 0 1.35rem;
    border-radius: 9999px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(37, 37, 37, 0.2);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.nav-chat-btn:hover {
    background: #111111;
    border-color: #111111;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 37, 37, 0.32);
}

.nav-chat-btn .arrow-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-chat-btn:hover .arrow-icon {
    transform: translate(2px, -2px);
}

/* ==========================================================================
   2. RIGHT-MID SECTION INDICATOR RAIL
   ========================================================================== */
.side-rail-nav {
    position: fixed;
    right: 2.2rem;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.55rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.is-scrolled .side-rail-nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.side-rail-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 4px 0;
    text-decoration: none;
    cursor: pointer;
}

.rail-bar {
    width: 22px;
    height: 3px;
    border-radius: 1px;
    background: rgba(37, 37, 37, 0.28);
    transition: background 0.25s ease, transform 0.25s ease;
    display: block;
}

.side-rail-item.active .rail-bar {
    background: #252525;
    transform: scaleX(1.15);
}

.side-rail-item:hover .rail-bar {
    background: #252525;
}

.rail-label {
    position: absolute;
    right: 32px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.side-rail-item:hover .rail-label,
.side-rail-item:focus-visible .rail-label,
.side-rail-item.is-previewing .rail-label {
    opacity: 1;
    transform: translateX(0);
}

.side-rail-item.is-previewing .rail-bar {
    background: var(--text-dark);
    transform: scaleX(1.3);
}

/* ==========================================================================
   3. HERO STAGE (Pixel-Perfect Baseline Alignment for VR & Email Buttons)
   ========================================================================== */
.hero-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-height: 680px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 72px;
}

.hero-title-bg {
    position: absolute;
    top: 15.5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 94vw;
    max-width: 1550px;
    z-index: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}

.hero-title-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
    will-change: opacity, transform;
    transition: opacity 0.56s cubic-bezier(0.16, 1, 0.3, 1), transform 0.56s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-title-svg-light {
    position: relative;
    z-index: 1;
    opacity: 1;
    transform: scale(1);
}

.hero-title-svg-dark {
    position: absolute;
    z-index: 2;
    inset: 0;
    opacity: 0;
    transform: scale(0.985);
}

.portrait-container {
    position: absolute;
    top: 21.5vh;
    left: 50%;
    transform: translateX(-50%);
    height: 64vh;
    max-height: 580px;
    width: auto;
    aspect-ratio: 1200 / 1080;
    z-index: 3;
    cursor: crosshair;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.portrait-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: top center;
    pointer-events: none;
    display: block;
}

.portrait-picture {
    display: block;
    width: 100%;
    height: 100%;
}

.paint-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 4;
}

@supports (content-visibility: auto) {
    main > .content-section,
    .dotted-footer {
        content-visibility: auto;
        contain-intrinsic-size: auto 900px;
    }

    #contact.content-section {
        contain-intrinsic-size: auto 720px;
    }

    .dotted-footer {
        contain-intrinsic-size: auto 430px;
    }
}

/* Left Content: Anchored by bottom baseline so View Resume aligns with Email */
.hero-left-content {
    position: absolute;
    left: 6.5vw;
    bottom: 12vh;
    max-width: 320px;
    z-index: 10;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-role-title {
    font-size: clamp(1.4rem, 2.2vw, 1.95rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    margin-bottom: 0.65rem;
    line-height: 1.2;
}

.hero-tagline {
    font-size: clamp(0.86rem, 1.05vw, 0.96rem);
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.6rem;
    font-weight: 400;
}

/* View Resume Button: Exactly 44px height matching the right social pills */
.hero-cta-btn {
    height: var(--btn-height);
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background-color: var(--text-dark);
    color: #FFFFFF;
    padding: 0 1.6rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 20px rgba(37, 37, 37, 0.18);
    box-sizing: border-box;
}

.hero-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(37, 37, 37, 0.28);
    background-color: #111111;
}

.hero-cta-btn .arrow-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-cta-btn:hover .arrow-icon {
    transform: translate(2px, -2px);
}

/* Right Content: Anchored by bottom baseline so Email bottom sits at bottom: 12vh */
.hero-right-content {
    position: absolute;
    right: 6.5vw;
    bottom: 12vh;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
    pointer-events: auto;
}

/* Social Pill: Exactly 44px height, identical to View Resume button */
.social-pill {
    height: var(--btn-height);
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background-color: var(--pill-bg);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    text-decoration: none;
    box-shadow: var(--pill-shadow);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.social-pill i {
    font-size: 0.95rem;
    color: var(--text-dark);
}

.social-pill:hover {
    transform: translateX(-5px);
    border-color: var(--text-dark);
    box-shadow: 0 6px 20px rgba(37, 37, 37, 0.1);
}

.content-section {
    width: 100%;
    min-height: auto;
    padding: 7rem 8vw 8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(37, 37, 37, 0.05);
    position: relative;
    scroll-margin-top: 5.25rem;
}

/* ==========================================================================
   4. ABOUT SECTION (Biography)
   ========================================================================== */
#about.content-section {
    min-height: auto;
    padding: 6.5rem 8vw 6.5rem;
}

.about-showcase-wrapper {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    position: relative;
}

.about-showcase-wrapper .showcase-header {
    margin-bottom: 2rem;
}

.about-statement {
    font-size: clamp(1.2rem, 1.85vw, 1.45rem);
    font-weight: 500;
    line-height: 1.85;
    color: var(--text-dark);
    letter-spacing: -0.015em;
    margin: 0;
}

/* ==========================================================================
   5. SKILLS & TECHNOLOGIES SECTION
   ========================================================================== */
#skills.content-section {
    min-height: auto;
    padding: 5.25rem 8vw 5.75rem;
}

.skills-showcase-wrapper {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    position: relative;
}

.skills-showcase-wrapper > .showcase-header {
    margin-bottom: 2.25rem;
}

/* Category Groups - Separated, Clean & Minimal Layout */
.skills-category-group {
    margin-bottom: 1.8rem;
    width: 100%;
}

.skills-category-group:last-child {
    margin-bottom: 0;
}

.skills-category-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
}

.skills-category-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888888;
    white-space: nowrap;
}

.skills-category-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(37, 37, 37, 0.08);
}

/* Symmetrical, Balanced 3-Column Skill Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.65rem;
    width: 100%;
}

/* Skill Card - Symmetrical, Balanced Padding */
.skill-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 13px;
    padding: 0.7rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.22s ease;
    user-select: none;
}

.skill-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border-color: rgba(37, 37, 37, 0.2);
}

/* Skill Icon Box - Vibrant Color Tint Badges */
.skill-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-icon-box i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: inherit;
}

.skill-card:hover .skill-icon-box {
    transform: scale(1.08);
}

/* 1. Programming Languages Badges */
.skill-icon-box.icon-java { background: rgba(231, 111, 81, 0.12); color: #E76F51; }
.skill-icon-box.icon-python { background: rgba(55, 118, 171, 0.14); color: #2B6CB0; }
.skill-icon-box.icon-sql { background: rgba(0, 117, 143, 0.12); color: #00758F; }
.skill-icon-box.icon-matlab { background: rgba(209, 83, 30, 0.12); color: #D1531E; }
.skill-icon-box.icon-assembly { background: rgba(100, 116, 139, 0.14); color: #475569; }

/* 2. Cybersecurity Badges */
.skill-icon-box.icon-netsec { background: rgba(16, 185, 129, 0.14); color: #059669; }
.skill-icon-box.icon-threat { background: rgba(239, 68, 68, 0.12); color: #DC2626; }
.skill-icon-box.icon-incident { background: rgba(245, 158, 11, 0.14); color: #D97706; }
.skill-icon-box.icon-log { background: rgba(6, 182, 212, 0.14); color: #0891B2; }
.skill-icon-box.icon-crypto { background: rgba(139, 92, 246, 0.14); color: #7C3AED; }

/* 3. Design & Tools Badges */
.skill-icon-box.icon-figma { background: rgba(162, 89, 255, 0.14); color: #8B5CF6; }
.skill-icon-box.icon-uiux { background: rgba(236, 72, 153, 0.14); color: #DB2777; }
.skill-icon-box.icon-office { background: rgba(216, 59, 1, 0.12); color: #D83B01; }
.skill-icon-box.icon-ppt { background: rgba(196, 62, 28, 0.12); color: #C43E1C; }
.skill-icon-box.icon-excel { background: rgba(16, 124, 65, 0.12); color: #107C41; }

/* 4. Spoken Languages Badges */
.skill-icon-box.icon-arabic { background: rgba(20, 184, 166, 0.14); color: #0D9488; }
.skill-icon-box.icon-english { background: rgba(59, 130, 246, 0.14); color: #2563EB; }
.skill-icon-box.icon-french { background: rgba(99, 102, 241, 0.14); color: #4F46E5; }

/* Text Info Stack - Centered Flex Column */
.skill-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.skill-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.skill-desc {
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: -0.005em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
    margin-top: 2px;
}

/* ==========================================================================
   6. PROJECTS SHOWCASE SECTION
   ========================================================================== */
.project-showcase-wrapper {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    position: relative;
}

.showcase-header {
    margin-bottom: 3.5rem;
}

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #888888;
    margin-bottom: 0.8rem;
    display: block;
}

.section-title {
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-dark);
    margin-bottom: 0.85rem;
}

.section-subtitle {
    max-width: 580px;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Decoupled Floating Cursor Preview
   -------------------------------------------------------------------------- */
.floating-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 290px;
    height: 190px;
    pointer-events: none;
    z-index: 999;
    will-change: transform;
}

.floating-preview-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
    background: #FFFFFF;
    isolation: isolate;
    opacity: 0;
    transform: scale(0.92);
    transform-origin: center center;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-preview.is-visible .floating-preview-inner {
    opacity: 1;
    transform: scale(1);
}

.preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    mix-blend-mode: multiply;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.25s ease, transform 0.25s ease;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.preview-img.is-active {
    opacity: 1;
    transform: scale(1);
}

.preview-img.preview-logo {
    padding: 24px;
    background: #F6F3EE;
    mix-blend-mode: normal;
}

.preview-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.25) 0%, transparent 45%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Projects List & Rows (100% Consistent Dedicated Bold Underlines)
   -------------------------------------------------------------------------- */
.projects-list {
    position: relative;
    width: 100%;
}

.project-row {
    position: relative;
    display: block;
    color: var(--text-dark);
    text-decoration: none !important;
    cursor: pointer;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

button.project-row {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.project-row-static {
    cursor: default;
}

.project-row,
.project-row:hover,
.project-row:focus,
.project-row:active,
.project-row * {
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.project-row:focus,
button.project-row:focus {
    outline: none !important;
}

.project-row:focus-visible,
button.project-row:focus-visible {
    outline: 2px solid var(--text-dark) !important;
    outline-offset: 4px;
    border-radius: 8px;
}

.row-bg-highlight {
    position: absolute;
    inset: 0;
    margin: -4px -1.25rem;
    padding: 4px 1.25rem;
    background: rgba(37, 37, 37, 0.04);
    border-radius: 12px;
    opacity: 0;
    transform: scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .project-row:hover .row-bg-highlight {
        opacity: 1;
        transform: scale(1);
    }
}

.project-row:focus-visible .row-bg-highlight {
    opacity: 1;
    transform: scale(1);
}

.row-content {
    position: relative;
    padding: 1.45rem 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.row-info {
    flex: 1;
    min-width: 0;
}

.row-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.row-title {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.row-title-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.015em;
    line-height: 1.2;
}

/* Dedicated underline bar: exactly 3px, unaffected by letter descenders */
.row-underline {
    display: block;
    width: 0;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 999px;
    margin-top: 4px;
    transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
    .project-row:hover .row-underline {
        width: 100%;
    }

    .project-row:hover .row-arrow {
        opacity: 1;
        transform: translate(0, 0);
        color: var(--text-dark);
    }
}

.project-row:focus-visible .row-underline {
    width: 100%;
}

.project-row:focus-visible .row-arrow {
    opacity: 1;
    transform: translate(0, 0);
    color: var(--text-dark);
}

.badge-featured {
    font-size: 0.72rem;
    font-weight: 700;
    color: #FFFFFF;
    background: var(--text-dark);
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-modal {
    font-size: 0.72rem;
    font-weight: 600;
    color: #555555;
    background: rgba(37, 37, 37, 0.08);
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
}

.badge-confidential {
    color: #4A4A4A;
    background: transparent;
    border: 1px solid rgba(37, 37, 37, 0.26);
}

.row-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.4rem;
    transition: color 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
    .project-row:hover .row-desc {
        color: #333333;
    }
}

.project-row:focus-visible .row-desc {
    color: #333333;
}

.project-row-static:hover .row-desc {
    color: var(--text-muted);
}

.row-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    tabular-nums: true;
    margin-top: 0.25rem;
    transition: color 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
    .project-row:hover .row-year {
        color: var(--text-dark);
    }
}

.project-row:focus-visible .row-year {
    color: var(--text-dark);
}

.projects-bottom-border {
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   5. HOVER REVEAL CARDS (From Certs.md) - Spacious, Centered, Prominent SVGs
   ========================================================================== */
.cert-showcase-wrapper {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    position: relative;
}

/* Keep the milestone introduction aligned with the narrower content sections. */
.cert-showcase-header {
    max-width: 820px;
    margin-right: auto;
    margin-left: auto;
}

.cert-reveal-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
    width: 100%;
    margin-top: 1rem;
}

.cert-reveal-grid > .cert-reveal-card {
    grid-column: span 2;
}

.cert-reveal-grid > .cert-reveal-card:nth-child(4) {
    grid-column: 2 / span 2;
}

.cert-reveal-grid > .cert-reveal-card:nth-child(5) {
    grid-column: 4 / span 2;
}

/* A composited opacity/transform treatment keeps the reveal responsive without
   forcing the browser to repaint a blur across every neighbouring card. */
@media (hover: hover) and (pointer: fine) {
    .cert-reveal-grid:has(> .cert-reveal-card:hover) > .cert-reveal-card:not(:hover):not(:focus-visible) {
        transform: translate3d(0, 0, 0) scale(0.985);
        opacity: 0.62;
    }
}

/* Active card highlight on hover / focus */
.cert-reveal-grid .cert-reveal-card:hover,
.cert-reveal-grid .cert-reveal-card:focus-visible {
    transform: translate3d(0, -4px, 0) scale(1.018);
    opacity: 1 !important;
    z-index: 10;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.1);
}

/* Spacious, clean, borderless white card with centered contents */
.cert-reveal-card {
    position: relative;
    height: 350px;               /* Ample height to house large, prominent SVGs */
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background: #FFFFFF;
    border: none !important;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.24s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;         /* Perfectly centers the SVG and content horizontally */
    text-align: center;          /* Symmetrical typography alignment */
    padding: 2.6rem 1.6rem 2.2rem;
    outline: none !important;
    transform: translateZ(0);
    will-change: transform, opacity;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

button.cert-reveal-card {
    width: 100%;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
}

.cert-reveal-card,
.cert-reveal-card:hover,
.cert-reveal-card:focus,
.cert-reveal-card:active,
.cert-reveal-card * {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.cert-reveal-card:focus,
button.cert-reveal-card:focus {
    outline: none !important;
}

.cert-reveal-card:focus-visible {
    box-shadow: 0 0 0 2.5px var(--text-dark), 0 24px 50px rgba(0, 0, 0, 0.12);
}

/* SVG Stage: Perfectly centered with generous vertical clearance */
.cert-svg-stage {
    width: 100%;
    height: 145px;
    display: flex;
    align-items: center;
    justify-content: center;     /* Centers logo in the stage */
}

/* Base logo style (e.g. SITE) */
.cert-card-svg {
    width: 86px;
    height: 86px;
    max-width: 86px;
    max-height: 86px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cert-card-svg.svg-tcs {
    width: 190px;
    height: auto;
    max-width: 100%;
    max-height: 115px;
}

.cert-reveal-card:hover .cert-card-svg {
    transform: scale(1.08) translateY(-3px);
}

/* Scaled up UJ logo */
.cert-card-svg.svg-uj {
    width: 112px;
    height: 112px;
    max-width: 112px;
    max-height: 112px;
    transform: scale(1.24);
}

.cert-reveal-card:hover .cert-card-svg.svg-uj {
    transform: scale(1.32) translateY(-4px);
}

/* Scaled up KAUST logo */
.cert-card-svg.svg-kaust {
    width: 126px;
    height: 126px;
    max-width: 126px;
    max-height: 126px;
    transform: scale(1.38);
}

.cert-reveal-card:hover .cert-card-svg.svg-kaust {
    transform: scale(1.46) translateY(-4px);
}

/* Scaled up KAU logo */
.cert-card-svg.svg-kau {
    width: 134px;
    height: 134px;
    max-width: 134px;
    max-height: 134px;
    transform: scale(1.44);
}

.cert-reveal-card:hover .cert-card-svg.svg-kau {
    transform: scale(1.52) translateY(-4px);
}

/* Card Typography: Symmetrical, Clean, & Uncrowded */
.cert-card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.cert-card-subtitle {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.35;
}

.cert-card-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

/* Modal floating stamp logo */
.cert-modal-logo-wrap {
    position: absolute;
    bottom: 24px;
    left: 2.4rem;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    z-index: 6;
}

.cert-modal-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Embedded project list inside the modal (with identical look & hover effects) */
.modal-projects-list {
    margin-top: 0.25rem;
}

.modal-projects-list .row-content {
    padding: 0.95rem 0;
}

.modal-projects-list .row-title-text {
    font-size: 1.12rem;
}

.modal-projects-list .row-title-wrap {
    align-items: flex-start;
    flex-wrap: wrap;
    column-gap: 0.5rem;
    row-gap: 0.35rem;
}

.modal-projects-list .badge-modal {
    align-self: center;
    white-space: nowrap;
    line-height: 1.25;
}

.modal-projects-list .row-desc {
    font-size: 0.88rem;
}

.modal-projects-list .project-row:last-child .row-content {
    padding-bottom: 0.25rem;
}

/* ==========================================================================
   6. EXPERIENCE & EDUCATION TIMELINE (Minimalist Vertical Milestones)
   ========================================================================== */
.timeline-showcase-wrapper {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    position: relative;
}

.timeline-container {
    position: relative;
    padding: 3.5rem 0;          /* Vertical clearance for the top and bottom fading lines */
    margin-top: 1.5rem;
}

/* Continuous vertical timeline track: rounded ends, lower opacity before 1st dot and after last dot */
.timeline-track-line {
    position: absolute;
    left: 11px;                 /* Center-aligned behind the 24px solid node */
    top: 0;
    bottom: 0;
    width: 2.5px;
    border-radius: 9999px;      /* Crisp rounded pill ends */
    background: linear-gradient(
        to bottom,
        rgba(37, 37, 37, 0) 0%,
        rgba(37, 37, 37, 0.08) 6%,
        rgba(37, 37, 37, 0.22) 12%,
        rgba(37, 37, 37, 0.85) 18%,
        rgba(37, 37, 37, 0.85) 82%,
        rgba(37, 37, 37, 0.22) 88%,
        rgba(37, 37, 37, 0.08) 94%,
        rgba(37, 37, 37, 0) 100%
    );
}

.timeline-row {
    position: relative;
    display: flex;
    align-items: center;
    padding: 2.2rem 0;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Milestone Node / Dot: 100% OPAQUE background completely shields and obscures the line behind it */
.timeline-node {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background-color: var(--bg-color); /* 100% solid opaque background to block line pass-through */
    border-radius: 50%;
}

.timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-dark);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-row:hover .timeline-dot {
    transform: scale(1.4);
    background-color: #000000;
    box-shadow: none;
}

/* Row Content Layout: Title next to dot, dates on far right */
.timeline-content {
    flex: 1;
    margin-left: 2rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.9rem 1.4rem;
    border-radius: 14px;
    border: 1px solid transparent;
    transition: background 0.25s ease, transform 0.25s ease;
}

.timeline-row:hover .timeline-content {
    background: rgba(37, 37, 37, 0.04);
    transform: translateX(4px);
}

.timeline-main {
    display: inline-flex;
    align-items: baseline;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.timeline-org {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.015em;
}

.timeline-sep {
    color: rgba(37, 37, 37, 0.3);
    font-size: 1rem;
}

.timeline-role {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.25s ease;
}

.timeline-row:hover .timeline-role {
    color: #222222;
}

.timeline-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    tabular-nums: true;
    transition: color 0.25s ease;
}

.timeline-row:hover .timeline-date {
    color: var(--text-dark);
}

/* Subtle, unobtrusive footer legend lowered comfortably below the timeline track */
.timeline-footer {
    margin-top: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding-top: 0;
    border-top: none;
}

.timeline-footer-item {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
}

.timeline-footer-key {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.82rem;
}

.timeline-footer-sep {
    color: rgba(37, 37, 37, 0.25);
    font-size: 0.75rem;
}

/* ==========================================================================
   7. NATURAL EDITORIAL CASE STUDY MODAL (Tight Bottom Spacing, No Dead Void)
   ========================================================================== */
.case-study-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    contain: layout paint;
}

.case-study-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

.case-study-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 22, 0.62);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.24s ease;
    will-change: opacity;
}

.case-study-overlay.is-active .case-study-backdrop {
    opacity: 1;
}

/* Clean, uncolored neutral card with tight, intentional bottom bounds */
.case-study-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    background: #FFFFFF;
    color: var(--text-dark);
    border-radius: 20px;
    overflow-y: auto;
    box-shadow: 0 24px 65px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, opacity;
    transform: translate3d(0, 20px, 0);
    opacity: 0;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.case-study-card:focus,
.case-study-card:focus-visible {
    outline: none;
}

.modal-drag-handle {
    display: none;
}

.case-study-overlay.is-active .case-study-card {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

/* Natural Hero Banner: Screenshot is framed naturally with a soft bottom edge dissolve */
.modal-banner-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    background: #FFFFFF;
    overflow: hidden;
}

.modal-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transform: translateZ(0) scale(1.002);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: opacity 0.2s ease;
}

.modal-banner-img[src=""],
.modal-banner-img:not([src]) {
    opacity: 0;
}

/* Natural soft transition at the base of the image into the white card */
.modal-banner-natural-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 112px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 35%, rgba(255, 255, 255, 0.72) 72%, #FFFFFF 100%);
    pointer-events: none;
}

/* Modal Body Content (Clean, tight bottom spacing) */
.modal-body-content {
    position: relative;
    z-index: 5;
    padding: 1.4rem 2.2rem 1.35rem;  /* Significantly reduced bottom padding from 2.8rem */
}

.modal-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.modal-category {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #71717A;
}

.modal-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: #888888;
}

.modal-project-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.modal-summary {
    font-size: 0.98rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.modal-project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.25rem 0 1.5rem;
}

.modal-project-links[hidden],
.cert-modal-logo-wrap[hidden],
.modal-section-block[hidden],
.modal-banner-wrap[hidden] {
    display: none;
}

.modal-project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border: 1px solid var(--text-muted);
    border-radius: 10px;
    color: var(--text-dark);
    font: 600 0.9rem 'Plus Jakarta Sans', sans-serif;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.modal-project-link:hover {
    background: var(--bg-color);
    transform: translateY(-2px);
}

.modal-project-link:focus-visible {
    outline: 2px solid var(--text-dark);
    outline-offset: 3px;
}

.modal-project-link svg {
    flex-shrink: 0;
}

.modal-banner-wrap.modal-banner-logo {
    background: #F6F3EE;
}

html[data-theme='dark'] .modal-banner-wrap.modal-banner-logo {
    background: #F6F3EE;
}

.modal-banner-logo .modal-banner-img {
    padding: 44px 12%;
    object-position: center;
}

/* Clean Engineering Spec Grid */
.modal-spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    background: #F8F8F9;
    border-radius: 12px;
    border: 1px solid rgba(37, 37, 37, 0.08);
    margin: 1.1rem 0 1.35rem;
}

.spec-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.spec-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #888888;
    letter-spacing: 0.08em;
}

.spec-val {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.35;
}

.modal-section-block {
    margin-bottom: 1.25rem;
}

/* Eliminate excessive blank whitespace at the end of the overlay */
.modal-section-block:last-child {
    margin-bottom: 0 !important;
}

.modal-section-heading {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.55rem;
    letter-spacing: -0.01em;
}

.modal-text {
    font-size: 0.92rem;
    color: #444444;
    line-height: 1.65;
}

.modal-highlights-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0;
}

.modal-highlights-list li {
    position: relative;
    padding-left: 1.4rem;
    font-size: 0.92rem;
    color: #444444;
    line-height: 1.65;
}

.modal-highlights-list li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--text-dark);
    font-weight: 700;
}

body.modal-open {
    position: fixed;
    right: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
}

body.modal-open .theme-scene-toggle,
body.modal-open .side-rail-nav {
    visibility: hidden;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ========================================================================== 
   7. CONTACT SECTION - LIGHT, INTEGRATED FORM
   ========================================================================== */
#contact.content-section {
    min-height: auto;
    padding: 6rem 8vw 5rem;
}

.contact-showcase-wrapper {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    position: relative;
    text-align: left;
}

/* This shell establishes layout only; the form is intentionally not a card. */
.contact-form-shell {
    width: 100%;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
    width: 100%;
}

.contact-form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.contact-form-label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.contact-form-input {
    width: 100%;
    height: 50px;
    padding: 0 1rem;
    background: #FFFFFF;
    color: var(--text-dark);
    border: 1px solid rgba(37, 37, 37, 0.16);
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(37, 37, 37, 0.04);
    font: inherit;
    font-size: 0.95rem;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.contact-form-input::placeholder {
    color: #9A9A9A;
}

.contact-form-input:hover {
    border-color: rgba(37, 37, 37, 0.3);
}

.contact-form-input:focus {
    background: #FFFFFF;
    border-color: var(--text-dark);
    box-shadow: 0 0 0 3px rgba(37, 37, 37, 0.1);
}

.contact-form-helper {
    margin-top: 0.45rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.contact-form-textarea {
    height: auto;
    min-height: 132px;
    max-height: 280px;
    padding: 0.85rem 1rem;
    line-height: 1.6;
    resize: vertical;
}

.contact-checkbox-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.1rem;
    cursor: pointer;
    user-select: none;
}

.contact-checkbox-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.contact-checkbox-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 0;
    background: #FFFFFF;
    border: 1.5px solid rgba(37, 37, 37, 0.28);
    border-radius: 6px;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-check-svg {
    opacity: 0;
    stroke: var(--bg-color);
    transform: scale(0.4);
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}

.contact-checkbox-wrap:hover .contact-checkbox-box {
    border-color: var(--text-dark);
}

.contact-checkbox-input:focus-visible + .contact-checkbox-box {
    border-color: var(--text-dark);
    box-shadow: 0 0 0 3px rgba(37, 37, 37, 0.12);
}

.contact-checkbox-input:checked + .contact-checkbox-box {
    background: var(--text-dark);
    border-color: var(--text-dark);
}

.contact-checkbox-input:checked + .contact-checkbox-box .contact-check-svg {
    opacity: 1;
    transform: scale(1);
}

.contact-checkbox-text {
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.5;
    transition: color 0.2s ease;
}

.contact-checkbox-wrap:hover .contact-checkbox-text {
    color: var(--text-dark);
}

.contact-submit-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.contact-submit-btn,
.copy-email-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    height: 46px;
    padding: 0 1.25rem;
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-submit-btn {
    color: #FFFFFF;
    background: var(--text-dark);
    border: 1px solid var(--text-dark);
    box-shadow: 0 4px 14px rgba(37, 37, 37, 0.16);
}

.contact-submit-btn:hover {
    background: #111111;
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(37, 37, 37, 0.22);
}

.contact-submit-btn:active,
.copy-email-btn:active {
    transform: translateY(0);
}

.contact-submit-btn.is-loading {
    cursor: wait;
    opacity: 0.7;
    pointer-events: none;
}

.contact-submit-btn .btn-arrow {
    transition: transform 0.2s ease;
}

.contact-submit-btn:hover .btn-arrow {
    transform: translate(2px, -2px);
}

.copy-email-btn {
    color: var(--text-dark);
    background: transparent;
    border: 1px solid rgba(37, 37, 37, 0.18);
}

.copy-email-btn:hover,
.copy-email-btn.is-copied {
    background: #FFFFFF;
    border-color: rgba(37, 37, 37, 0.42);
    transform: translateY(-1px);
}

.copy-email-btn.is-copied {
    color: #166534;
}

.contact-feedback-msg {
    display: none;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.45;
}

.contact-feedback-msg.is-success {
    display: block;
    color: #166534;
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.contact-feedback-msg.is-error {
    display: block;
    color: #B42318;
    background: #FEF3F2;
    border-color: #FECDCA;
}

.contact-privacy-note {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.6;
}

.contact-privacy-note a {
    color: var(--text-dark);
    font-weight: 700;
    text-underline-offset: 3px;
}

/* ========================================================================== 
   8. LIGHT DOTTED FOOTER
   ========================================================================== */
.dotted-footer {
    position: relative;
    overflow: hidden;
    width: 100%;
    background: var(--bg-color);
    border-top: 1px solid rgba(37, 37, 37, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.dotted-footer-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 120px 120px;
    gap: 2.5rem;
    width: min(100% - 16vw, 1140px);
    margin: 0 auto;
    padding: 3.25rem 0 1rem;
}

.dotted-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 320px;
}

.dotted-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-dark);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.dotted-footer-logo i {
    font-size: 0.95rem;
}

.dotted-footer-brand p {
    margin-top: 1.15rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.65;
}

.dotted-footer-copyright {
    margin-top: 1.65rem;
    color: #9A9A9A;
    font-size: 0.75rem;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
}

.dotted-footer-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.dotted-footer-nav h3 {
    margin-bottom: 0.45rem;
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.dotted-footer-nav a {
    color: var(--text-muted);
    font-size: 0.87rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.18s ease, transform 0.18s ease;
}

.dotted-footer-nav a:hover,
.dotted-footer-nav a:focus-visible {
    color: var(--text-dark);
    transform: translateX(3px);
}

.dotted-footer-art {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 10.5rem;
}

.dotted-footer-art canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.dotted-footer-fade {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: linear-gradient(to bottom, var(--bg-color) 0%, var(--bg-color) 10%, transparent 32%);
    pointer-events: none;
}

@media (max-width: 720px) {
    .dotted-footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem 1.5rem;
        width: 88%;
        padding: 2.75rem 0 1.25rem;
    }

    .dotted-footer-brand {
        grid-column: 1 / -1;
    }

    .dotted-footer-art {
        height: 8.25rem;
    }
}

/* ===========================================================================
   DARK THEME PALETTE
   =========================================================================== */
html[data-theme='dark'] {
    color-scheme: dark;
    --bg-color: #111111;
    --text-dark: #F4F2EC;
    --text-muted: #AAA9A5;
    --border-color: rgba(244, 242, 236, 0.14);
    --pill-bg: #191919;
    --pill-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --nav-bg: rgba(17, 17, 17, 0.88);
}

html[data-theme='dark'] .top-navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

html[data-theme='dark'] .hero-title-svg-light {
    opacity: 0;
    transform: scale(1.015);
}

html[data-theme='dark'] .hero-title-svg-dark {
    opacity: 1;
    transform: scale(1);
}

html[data-theme='dark'] .rail-bar {
    background: rgba(244, 242, 236, 0.3);
}

html[data-theme='dark'] .side-rail-item.active .rail-bar,
html[data-theme='dark'] .side-rail-item:hover .rail-bar {
    background: var(--text-dark);
}

html[data-theme='dark'] .rail-label,
html[data-theme='dark'] .skill-card,
html[data-theme='dark'] .cert-reveal-card,
html[data-theme='dark'] .contact-form-input,
html[data-theme='dark'] .contact-checkbox-box {
    background: #191919;
    border-color: rgba(244, 242, 236, 0.13);
    color: var(--text-dark);
}

html[data-theme='dark'] .content-section {
    border-top-color: rgba(244, 242, 236, 0.08);
}

html[data-theme='dark'] .skills-category-header::after,
html[data-theme='dark'] .projects-bottom-border,
html[data-theme='dark'] .row-content {
    border-color: rgba(244, 242, 236, 0.12);
}

html[data-theme='dark'] .skill-card:hover {
    background: #202020;
    border-color: rgba(244, 242, 236, 0.26);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

html[data-theme='dark'] .floating-preview-inner {
    background: #FFFFFF;
}

html[data-theme='dark'] .row-bg-highlight {
    background: rgba(244, 242, 236, 0.06);
}

html[data-theme='dark'] .badge-modal {
    color: #D5D7DE;
    background: rgba(244, 242, 236, 0.1);
}

html[data-theme='dark'] .badge-confidential {
    color: #F4F2EC;
    background: transparent;
    border-color: rgba(244, 242, 236, 0.3);
}

@media (hover: hover) and (pointer: fine) {
    html[data-theme='dark'] .project-row:hover .row-desc {
        color: #F4F2EC;
    }
}

html[data-theme='dark'] .project-row:focus-visible .row-desc {
    color: #F4F2EC;
}

@media (hover: hover) and (pointer: fine) {
    html[data-theme='dark'] .cert-reveal-grid .cert-reveal-card:hover {
        background: #202020;
        border-color: rgba(244, 242, 236, 0.26);
        box-shadow: 0 20px 42px rgba(0, 0, 0, 0.38);
    }
}

html[data-theme='dark'] .cert-reveal-grid .cert-reveal-card:focus-visible {
    background: #202020;
    border-color: rgba(244, 242, 236, 0.26);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.38);
}

html[data-theme='dark'] .timeline-track-line {
    background: linear-gradient(to bottom,
        rgba(244, 242, 236, 0) 0%,
        rgba(244, 242, 236, 0.1) 6%,
        rgba(244, 242, 236, 0.4) 18%,
        rgba(244, 242, 236, 0.4) 82%,
        rgba(244, 242, 236, 0.1) 94%,
        rgba(244, 242, 236, 0) 100%);
}

html[data-theme='dark'] .timeline-dot {
    background-color: var(--text-dark);
}

/* The Experience highlight becomes a high-contrast inverse panel in dark
   mode. This prevents the previous low-contrast grey-on-black hover state. */
html[data-theme='dark'] .timeline-content {
    border: 1px solid transparent;
    background: transparent;
}

html[data-theme='dark'] .timeline-row:hover .timeline-content {
    border-color: rgba(244, 242, 236, 0.9);
    background: #F4F2EC;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
    transform: translateX(6px);
}

html[data-theme='dark'] .timeline-row:hover .timeline-org,
html[data-theme='dark'] .timeline-row:hover .timeline-role,
html[data-theme='dark'] .timeline-row:hover .timeline-date,
html[data-theme='dark'] .timeline-row:hover .timeline-sep {
    color: #111111;
}

html[data-theme='dark'] .timeline-row:hover .timeline-dot {
    background-color: #F4F2EC;
    box-shadow: none;
    transform: scale(1.4);
}

/* Modal surfaces use a deliberate hierarchy in dark mode. The spec grid no
   longer inherits its light background or collapses into one muddy surface. */
html[data-theme='dark'] .case-study-card {
    background: #181818;
    border-color: rgba(244, 242, 236, 0.14);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58);
}

html[data-theme='dark'] .modal-banner-wrap,
html[data-theme='dark'] .cert-modal-logo-wrap {
    background: #181818;
    border-color: rgba(244, 242, 236, 0.14);
}

html[data-theme='dark'] .modal-spec-grid {
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    background: #202020;
    border-color: rgba(244, 242, 236, 0.1);
}

html[data-theme='dark'] .spec-card {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

html[data-theme='dark'] .spec-label {
    color: #AAA9A5;
}

html[data-theme='dark'] .spec-val {
    color: #F4F2EC;
}

html[data-theme='dark'] .modal-category,
html[data-theme='dark'] .modal-year {
    color: #AAA9A5;
}

html[data-theme='dark'] .modal-banner-natural-fade {
    background: linear-gradient(to bottom, rgba(24, 24, 24, 0) 0%, rgba(24, 24, 24, 0.22) 35%, rgba(24, 24, 24, 0.78) 72%, #181818 100%);
}

html[data-theme='dark'] .modal-text,
html[data-theme='dark'] .modal-highlights-list li {
    color: #D5D7DE;
}

html[data-theme='dark'] .contact-form-input::placeholder {
    color: #7E7E7E;
}

html[data-theme='dark'] .contact-form-input:hover {
    border-color: rgba(244, 242, 236, 0.3);
}

html[data-theme='dark'] .contact-form-input:focus,
html[data-theme='dark'] .contact-checkbox-input:focus-visible + .contact-checkbox-box {
    border-color: #F4F2EC;
    box-shadow: 0 0 0 3px rgba(244, 242, 236, 0.12);
}

html[data-theme='dark'] .contact-submit-btn,
html[data-theme='dark'] .nav-chat-btn,
html[data-theme='dark'] .hero-cta-btn,
html[data-theme='dark'] .badge-featured {
    color: #111111;
    background: #F4F2EC;
    border-color: #F4F2EC;
}

html[data-theme='dark'] .contact-submit-btn:hover,
html[data-theme='dark'] .nav-chat-btn:hover,
html[data-theme='dark'] .hero-cta-btn:hover {
    color: #111111;
    background: #FFFFFF;
    border-color: #FFFFFF;
}

html[data-theme='dark'] .contact-checkbox-text {
    color: #D5D7DE;
}

html[data-theme='dark'] .copy-email-btn {
    color: #F4F2EC;
    background: rgba(244, 242, 236, 0.05);
    border-color: rgba(244, 242, 236, 0.22);
}

html[data-theme='dark'] .copy-email-btn:hover,
html[data-theme='dark'] .copy-email-btn.is-copied {
    background: #242424;
    border-color: rgba(244, 242, 236, 0.4);
    color: #FFFFFF;
}

html[data-theme='dark'] .dotted-footer {
    border-top-color: rgba(244, 242, 236, 0.1);
}

html[data-theme='dark'] .dotted-footer-fade {
    background: linear-gradient(to bottom, var(--bg-color) 0%, var(--bg-color) 10%, transparent 32%);
}

/* The old interface remains fixed below a moving edge while the new palette
   is revealed above it: a genuine top-to-bottom theme sweep. */
::view-transition-group(root) {
    animation: none;
}

::view-transition-old(root),
::view-transition-new(root) {
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
    animation: theme-ui-sweep-out 0.78s cubic-bezier(0.65, 0, 0.35, 1) both;
}

::view-transition-new(root) {
    z-index: 0;
    animation: none;
}

@keyframes theme-ui-sweep-out {
    from { clip-path: inset(0 0 0 0); }
    to { clip-path: inset(100% 0 0 0); }
}

/* ==========================================================================
   8. RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 1024px) {
    .hero-title-bg {
        top: 14vh;
    }
    .portrait-container {
        top: 20vh;
        height: 58vh;
        max-height: 500px;
    }
    .hero-left-content {
        left: 4vw;
        bottom: 10vh;
        max-width: 260px;
    }
    .hero-right-content {
        right: 4vw;
        bottom: 10vh;
    }

    .cert-reveal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .cert-reveal-grid > .cert-reveal-card:nth-child(n) {
        grid-column: auto;
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 900px) {
    .nav-links {
        display: none !important;
    }
}

@media (max-width: 768px) {
    html,
    body,
    .top-navbar {
        transition: none;
    }

    .paint-canvas {
        touch-action: none;
    }

    .top-navbar {
        padding: env(safe-area-inset-top, 0px) 1.25rem 0;
        height: calc(64px + env(safe-area-inset-top, 0px));
        background-color: var(--bg-color);
    }
    .nav-links {
        display: none !important;
    }
    .side-rail-nav {
        display: flex !important;
        right: max(0.4rem, env(safe-area-inset-right, 0.4rem));
        top: 50%;
        gap: 0.4rem;
        z-index: 90;
        touch-action: none;
        -webkit-touch-callout: none;
        user-select: none;
        -webkit-user-select: none;
    }

    .side-rail-item {
        padding: 7px 5px;
        min-width: 44px;
        -webkit-tap-highlight-color: transparent;
    }

    .rail-bar {
        width: 16px;
        height: 3px;
        border-radius: 999px;
    }

    .rail-label {
        display: none;
    }

    .side-rail-item:focus-visible .rail-label,
    .side-rail-item.is-previewing .rail-label {
        display: block;
        right: 26px;
    }

    .theme-scene-toggle {
        right: 1rem;
        bottom: 1rem;
        width: 72px;
        height: 44px;
    }
    .nav-chat-btn {
        padding: 0 1.1rem;
        height: 36px;
        font-size: 0.82rem;
    }

    .floating-preview {
        display: none !important;
    }

    .hero-stage {
        height: auto;
        min-height: auto;
        padding-top: 64px;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        overflow: visible;
    }

    .hero-title-bg {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 95vw;
        margin-top: 2rem;
    }

    .portrait-container {
        position: relative;
        top: -1.8rem;
        left: auto;
        transform: none;
        width: min(100vw, 466px);
        height: auto;
        min-height: 0;
        max-height: none;
        aspect-ratio: 1200 / 1080;
    }

    .hero-left-content {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        max-width: 90%;
        text-align: center;
        align-items: center;
        margin: 0.5rem auto 1.5rem;
    }

    .hero-tagline {
        margin-bottom: 1.25rem;
    }

    .hero-right-content {
        position: relative;
        bottom: auto;
        right: auto;
        transform: none;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.65rem;
        margin: 0 auto 3rem;
    }

    .social-pill {
        height: 40px;
        padding: 0 1rem;
        font-size: 0.82rem;
    }

    .hero-cta-btn {
        height: 40px;
        padding: 0 1.2rem;
        font-size: 0.84rem;
    }

    .content-section {
        padding: 5rem 6vw 6rem;
    }

    #about.content-section {
        padding: 4.5rem 6vw 4.5rem;
    }

    .about-statement {
        font-size: 1.12rem;
        line-height: 1.75;
    }

    #skills.content-section {
        padding: 4.5rem 6vw 5rem;
    }

    #contact.content-section {
        min-height: auto;
        padding: 4.5rem 6vw 4rem;
    }

    .skills-category-group {
        margin-bottom: 1.45rem;
    }

    .skills-category-header {
        gap: 0.8rem;
        margin-bottom: 0.65rem;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    .skill-card {
        padding: 0.65rem 0.75rem;
        gap: 0.65rem;
    }

    .row-content {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1.2rem 0;
    }

    .row-bg-highlight {
        margin-right: 0;
        margin-left: 0;
        padding-right: 0;
        padding-left: 0;
    }

    .row-arrow {
        opacity: 1;
        transform: translate(0, 0);
    }

    .project-row,
    button.project-row,
    .cert-reveal-card,
    button.cert-reveal-card {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        outline: none !important;
    }

    .cert-reveal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.9rem;
    }

    .cert-reveal-card {
        height: 290px;
        padding: 1.8rem 1rem 1.5rem;
    }

    /* Mobile case studies behave like native bottom sheets: 90% height,
       rounded at the top, and dismissible from the drag handle. */
    .case-study-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .case-study-card {
        width: 100%;
        max-width: none;
        height: 90svh;
        max-height: 90svh;
        border-width: 1px 0 0;
        border-radius: 24px 24px 0 0;
        scrollbar-gutter: auto;
        transform: translate3d(0, 100%, 0);
        transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
        outline: none;
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior-y: none;
        touch-action: pan-y;
    }

    .case-study-overlay.is-active .case-study-card {
        transform: translate3d(0, 0, 0);
    }

    .case-study-card.is-dragging {
        transition: none;
        user-select: none;
    }

    .modal-banner-wrap,
    .modal-banner-wrap * {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .modal-drag-handle {
        position: sticky;
        top: 0;
        z-index: 30;
        display: grid;
        width: 100%;
        height: 34px;
        margin: 0 0 -34px;
        padding: 0;
        place-items: start center;
        border: 0;
        border-radius: 24px 24px 0 0;
        background: transparent;
        cursor: grab;
        touch-action: none;
        outline: none;
        -webkit-tap-highlight-color: transparent;
    }

    .modal-drag-handle:active {
        cursor: grabbing;
    }

    .modal-drag-handle span {
        display: block;
        width: 42px;
        height: 5px;
        margin-top: 8px;
        border-radius: 999px;
        background: rgba(30, 30, 30, 0.75);
        transition: background-color 0.2s ease;
        box-shadow: none;
    }

    .modal-drag-handle:focus-visible {
        outline: none;
    }

    .modal-drag-handle:focus-visible span {
        outline: 3px solid var(--text-dark);
        outline-offset: 4px;
    }

    /* Strict choice between two colors: dark (rgba(30, 30, 30, 0.75)) or light (rgba(255, 255, 255, 0.88)) */
    .modal-drag-handle[data-tone="dark"] span {
        background: rgba(30, 30, 30, 0.75);
    }

    .modal-drag-handle[data-tone="light"] span {
        background: rgba(255, 255, 255, 0.88);
    }

    html[data-theme='dark'] .modal-drag-handle {
        background: transparent;
    }

    html[data-theme='dark'] .modal-drag-handle span {
        background: rgba(255, 255, 255, 0.88);
    }

    html[data-theme='dark'] .modal-drag-handle[data-tone="dark"] span {
        background: rgba(30, 30, 30, 0.75);
    }

    html[data-theme='dark'] .modal-drag-handle[data-tone="light"] span {
        background: rgba(255, 255, 255, 0.88);
    }

    .modal-body-content {
        padding: 1.25rem 1.4rem calc(1.15rem + env(safe-area-inset-bottom));
    }

    .modal-spec-grid {
        grid-template-columns: 1fr 1fr;
    }

    .timeline-container {
        padding: 2.5rem 0;
    }

    .timeline-row {
        padding: 1.5rem 0;
    }

    .timeline-content {
        margin-left: 1.2rem;
        padding: 0.7rem 0.9rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .timeline-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .timeline-sep {
        display: none;
    }

    .timeline-org {
        font-size: 1.12rem;
    }

    .timeline-role {
        font-size: 0.92rem;
    }

    .timeline-date {
        font-size: 0.8rem;
    }

    .contact-submit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-submit-btn,
    .copy-email-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .cert-reveal-grid {
        grid-template-columns: 1fr;
    }
}

/* Keep the information architecture available without making motion a
   requirement for people who opt out of animation. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
