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

:root {
    --bg-primary: #f8f8f8;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #e5e5e5;
    --button-bg: #000;
    --button-text: #ffffff;
}

body.dark-mode {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --border-color: #262626;
    --button-bg: #ffffff;
    --button-text: #000000;
}

html {
    font-size: clamp(12px, 2.5vw, 16px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Loading Spinner Styles */
.loading-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
}

.loading-spinner-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.spinner-circle {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--button-bg);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}



@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 1px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(20px, 5vw, 40px);
}

.header {
    display: grid;
    grid-template-columns: clamp(100px, 15vw, 140px) 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 0 clamp(15px, 3vw, 25px);
    margin-bottom: clamp(20px, 4vw, 30px);
    background-color: var(--bg-secondary);
    padding: clamp(15px, 3vw, 25px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.profile-image {
    flex-shrink: 0;
    width: clamp(100px, 15vw, 140px);
    height: clamp(100px, 15vw, 140px);
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    grid-row: 1 / 5;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

@media (min-width: 1025px) {
    .profile-image img:hover {
        opacity: 0.8;
    }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0;
    gap: 0;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.8vw, 6px);
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

/* Small-screen inline icon toggle (hidden by default) */
.theme-toggle-sm {
    display: none;
    color: var(--text-primary);
    background: transparent;
    border: none;
    padding: 0 4px;
    margin-left: 4px;
    cursor: pointer;
    align-self: flex-start;
    margin-top: 10px;
    border-radius: 0;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle-sm .toggle-icon-sm svg {
    width: 15px;
    height: 15px;
    display: block;
}

/* Remove mouse-click focus outline while keeping keyboard-visible focus ring */
.theme-toggle-sm:focus {
    outline: none;
}

.theme-toggle-sm:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
    border-radius: 14px;
}

.header-left h1 {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 400;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.8vw, 6px);
    word-break: break-word;
    flex-wrap: wrap;
    min-width: 0;
}

.location {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.8vw, 6px);
    color: var(--text-secondary);
    margin-bottom: 0;
    font-size: clamp(10px, 1.8vw, 12px);
    grid-column: 2;
    grid-row: 2;
}

.location-pin {
    font-size: clamp(10px, 2vw, 12px);
    flex-shrink: 0;
}

.title {
    font-size: clamp(10px, 1.8vw, 12px);
    color: var(--text-primary);
    margin-bottom: 0;
    font-weight: 500;
    grid-column: 2;
    grid-row: 3;
}

.title-separator {
    color: var(--text-tertiary);
    margin: 0 clamp(3px, 0.8vw, 5px);
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(6px, 1.5vw, 10px);
    margin-bottom: 0;
    align-items: stretch;
    grid-column: 2;
    grid-row: 4;
    width: 100%;
}

.btn {
    padding: clamp(5px, 1vw, 7px) clamp(10px, 1.8vw, 14px);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(10px, 1.8vw, 12px);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(3px, 0.7vw, 5px);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--text-tertiary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

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

a.btn-primary {
    color: var(--button-text);
}

a.btn-primary:hover {
    color: var(--button-text);
}

.btn-secondary {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-icon {
    font-size: clamp(9px, 1.8vw, 12px);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lucide-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
}

.theme-toggle {
    align-self: flex-start;
    margin-top: clamp(5px, 0.2vw, 7px);
    margin-left: auto;
    padding: 0;
    width: 50px;
    height: 28px;
    background-color: var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.theme-toggle.dark {
    background-color: var(--text-tertiary);
}

.toggle-circle {
    width: 24px;
    height: 24px;
    background-color: var(--bg-secondary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 2px;
    transform: translateY(-50%);
    transition: left 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.theme-toggle.dark .toggle-circle {
    left: 24px;
}

.theme-toggle .toggle-icon svg {
    width: 100%;
    height: 100%;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(15px, 3vw, 20px);
    align-items: stretch;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: clamp(15px, 3vw, 20px);
}

.right-column {
    display: block;
    position: relative;
    min-height: 0;
}

.section {
    margin-bottom: 0;
    background-color: var(--bg-secondary);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.section-title {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    margin-bottom: clamp(12px, 2vw, 20px);
    color: var(--text-primary);
}

.section-icon {
    font-size: clamp(16px, 3vw, 20px);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon img {
    transition: filter 0.3s ease;
}

body.dark-mode .section-icon img {
    filter: invert(1) brightness(1.2);
}

.section-spacing {
    min-height: 262px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.recommendations-quote {
    font-size: clamp(13px, 2.2vw, 15px);
    color: var(--text-primary);
    margin-bottom: clamp(16px, 3vw, 24px);
    line-height: 1.6;
    font-style: italic;
}

.recommender-info {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5px, 0.1vw, 0.5px);
}

.recommendations-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: clamp(12px, 2vw, 16px) 0;
}

.recommender-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(13px, 2vw, 15px);
}

.recommender-title {
    color: var(--text-secondary);
    font-size: clamp(11px, 1.8vw, 13px);
}

.recommendations-dots {
    display: flex;
    gap: 6px;
    margin-top: clamp(12px, 2vw, 16px);
    justify-content: center;
}

.recommendations-carousel {
    position: relative;
    min-height: 200px;
    overflow: hidden;
}

.recommendation-item-carousel {
    position: absolute;
    width: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    top: 0;
    left: 0;
}

.recommendation-item-carousel.active {
    position: relative;
    opacity: 1;
}

.recommendation-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.recommendation-dot.active {
    background-color: var(--text-secondary);
}

.section-spacing.recommendations {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: auto;
}

.section-full-width {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    margin-top: clamp(15px, 3vw, 20px);
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(16px, 3vw, 24px);
}

.projects-title {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    font-size: clamp(16px, 3vw, 18px);
    font-weight: 600;
    color: var(--text-primary);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(12px, 2.5vw, 20px);
}

.project-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-image-container {
    width: 100%;
    height: clamp(160px, 22vw, 220px);
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-content {
    padding: clamp(16px, 2.5vw, 24px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.5vw, 12px);
    flex: 1;
}

.project-card:hover {
    border-color: var(--text-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .project-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(13px, 2.1vw, 15px);
    margin: 0;
}

.project-description {
    color: var(--text-secondary);
    font-size: clamp(12px, 1.9vw, 13px);
    margin: 0;
    line-height: 1.5;
}

.project-link {
    color: var(--text-tertiary);
    font-size: clamp(11px, 1.7vw, 12px);
    background-color: var(--bg-secondary);
    padding: clamp(4px, 0.8vw, 6px) clamp(8px, 1.5vw, 12px);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
    word-break: break-all;
    margin-top: auto;
    align-self: flex-start;
}

.project-link:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

/* Gallery Styles */
.gallery-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 20px);
}

.gallery-nav-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 20px;
}

.gallery-nav-btn:hover {
    background-color: var(--border-color);
    border-color: var(--text-primary);
}

.gallery-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(12px, 2vw, 16px);
    flex: 1;
    overflow: hidden;
    min-height: auto;
    width: 100%;
    transition: all 0.4s ease-in-out;
}

.gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

.gallery-item:hover {
    border-color: var(--text-primary);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.dark-mode .gallery-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Modal */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: fadeIn 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (min-width: 1025px) {
    .lightbox-image {
        max-width: 70vw;
        max-height: 70vh;
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 9001;
}

.lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Gallery Pagination Dots */
.gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: clamp(8px, 1vw, 12px);
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.gallery-dot:hover {
    background-color: var(--text-secondary);
    transform: scale(1.2);
}

.gallery-dot.active {
    background-color: var(--button-bg);
    transform: scale(1.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: clamp(8px, 1.5vw, 12px);
    }
}

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

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

.about-text {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: clamp(13px, 2.2vw, 14px);
}

.about-text p {
    margin-bottom: clamp(8px, 1.5vw, 12px);
}

.about-text p:last-child {
    margin-bottom: 0;
}

.tech-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 4vw, 28px);
}

.tech-category {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.5vw, 12px);
}

.tech-category-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(13px, 2.2vw, 15px);
    text-transform: none;
    margin: 0;
}

.tech-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(8px, 1.5vw, 12px);
}

.tech-tag {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: clamp(6px, 1.2vw, 8px) clamp(10px, 2vw, 14px);
    border-radius: 6px;
    font-size: clamp(11px, 1.8vw, 13px);
    font-weight: 500;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: inline-block;
}

.tech-tag:hover {
    background-color: var(--border-color);
    border-color: var(--text-secondary);
}

.education-item {
    padding-bottom: clamp(8px, 1.5vw, 12px);
    border-bottom: 1px solid var(--border-color);
}

.education-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.education-school {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: clamp(2px, 0.8vw, 4px);
    font-size: clamp(11px, 1.9vw, 13px);
}

.education-degree {
    color: var(--text-secondary);
    font-size: clamp(10px, 1.7vw, 12px);
    margin-bottom: clamp(2px, 0.8vw, 4px);
}

.education-year {
    color: var(--text-secondary);
    font-size: clamp(10px, 1.7vw, 12px);
    margin-bottom: clamp(2px, 0.8vw, 4px);
}

.achievement-list {
    --timeline-indent: clamp(30px, 5vw, 40px);
    --timeline-line-left: clamp(5px, 1vw, 7.5px);
    --timeline-marker-size: clamp(12px, 2vw, 16px);
    --timeline-marker-radius: clamp(6px, 1vw, 8px);
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 24px);
    position: relative;
    padding-left: var(--timeline-indent);
}

.achievement-list::before {
    content: '';
    position: absolute;
    left: var(--timeline-line-left);
    top: 8px;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.achievement-item {
    position: relative;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.6vw, 4px);
}

.achievement-item::before {
    content: '';
    position: absolute;
    left: calc(var(--timeline-line-left) + 1px - var(--timeline-marker-radius) - var(--timeline-indent));
    top: clamp(4px, 0.8vw, 8px);
    width: var(--timeline-marker-size);
    height: var(--timeline-marker-size);
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
}

.achievement-item:first-child::before {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
}

.achievement-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
}

.achievement-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
    font-size: clamp(12px, 2vw, 14px);
    flex: 1;
}

.achievement-organization {
    color: var(--text-secondary);
    font-size: clamp(10px, 1.6vw, 12px);
    margin-bottom: 0;
}

.achievement-year {
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: clamp(10px, 1.6vw, 12px);
    flex-shrink: 0;
}

.section-blank {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    will-change: transform;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .right-column {
        position: static;
    }

    .section-blank {
        position: static;
        height: 1070px;
        overflow-y: auto;
        overscroll-behavior: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: clamp(15px, 3vw, 20px);
    }

    .header {
        gap: clamp(15px, 2vw, 20px);
        padding: clamp(15px, 2.5vw, 20px);
    }

    .header-top {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }

    .header-left h1 {
        font-size: clamp(20px, 5vw, 28px);
    }

    .profile-image {
        width: clamp(100px, 25vw, 140px);
        height: clamp(120px, 30vw, 160px);
    }

    .actions {
        width: 100%;
        flex-direction: column;
        gap: clamp(8px, 1.5vw, 10px);
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .left-column {
        flex-direction: column;
    }

    .right-column {
        flex-direction: column;
    }

    .section {
        padding: clamp(15px, 2.5vw, 20px);
    }

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

    .section-blank {
        height: 950px;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        position: relative;
        grid-template-columns: clamp(76px, 24vw, 104px) minmax(0, 1fr);
        grid-template-rows: auto auto;
        column-gap: 12px;
        row-gap: 12px;
        padding: 12px;
    }

    .header-left h1 {
        flex-wrap: nowrap;
        font-size: clamp(18px, 6vw, 22px);
        line-height: 1.2;
    }

    .profile-image {
        grid-column: 1;
        grid-row: 1;
        width: clamp(76px, 24vw, 104px);
        height: clamp(76px, 24vw, 104px);
        aspect-ratio: 1 / 1;
    }

    .header-top {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
    }

    .location,
    .title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.35;
    }

    .location {
        align-items: flex-start;
    }

    .title {
        font-size: clamp(11px, 3.4vw, 13px);
    }

    .actions {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-self: stretch;
        width: 100%;
        gap: 8px;
        padding: 0;
        margin-top: 0 !important;
    }

    .actions .btn {
        min-width: 0;
        width: 100%;
        height: 36px;
        padding: 0 8px;
        font-size: 11px;
        margin: 0;
    }

    .btn-text {
        display: inline;
    }

    .actions .btn-primary::after {
        content: none;
    }

    .actions .btn-secondary::after {
        content: none;
    }

    .theme-toggle {
        display: none !important;
    }

    .theme-toggle-sm {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        margin: 0 0 0 2px;
        padding: 0;
    }

    .section {
        padding: clamp(12px, 2vw, 15px);
    }

    .section-title {
        font-size: clamp(14px, 3.5vw, 16px);
    }

    .about-text {
        font-size: clamp(12px, 2vw, 13px);
    }

    .tech-tag {
        font-size: clamp(10px, 1.5vw, 11px);
        padding: clamp(5px, 0.8vw, 6px) clamp(8px, 1.5vw, 10px);
    }

    .section-blank {
        height: 830px;
        overflow-y: auto;
    }
}

footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 0px;
}

/* Final Call Section */
.final-call-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: clamp(20px, 4vw, 40px);
    align-items: stretch;
}

@media (max-width: 768px) {
    .final-call-container {
        grid-template-columns: 1fr;
    }
}

.fc-left {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 16px);
}

.fc-left h2 {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.fc-left h2 span {
    color: var(--text-tertiary);
}

.fc-left p {
    color: var(--text-secondary);
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.6;
    margin: 0;
}

.fc-follow {
    margin-top: auto;
    padding-top: clamp(16px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fc-follow-text, .fc-right-title {
    font-size: clamp(10px, 1.5vw, 12px);
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.fc-social-icons {
    display: flex;
    gap: 12px;
}

.fc-social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.fc-social-icon:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: var(--border-color);
}

.fc-social-icon svg {
    width: 18px;
    height: 18px;
}

.fc-right {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 16px);
}

.fc-right-title {
    margin-bottom: 4px;
}

.fc-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: clamp(16px, 2vw, 20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--bg-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.fc-card:hover {
    border-color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.dark-mode .fc-card {
    background-color: var(--bg-secondary);
}

body.dark-mode .fc-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fc-card-icon {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.fc-card-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fc-card-label {
    font-size: clamp(10px, 1.5vw, 12px);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fc-card-value {
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 600;
    color: var(--text-primary);
}

/* Typing Animation */
@keyframes typing {
    0%,
    60%,
    100% {
        opacity: 1;
    }
    30% {
        opacity: 0.4;
    }
}

/* Chat Modal Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.chat-modal-open {
    animation: slideInUp 0.3s ease-out;
}

.chat-modal-close {
    animation: slideOutDown 0.3s ease-out;
}

.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.bot-message-container {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.bot-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}



.collapse-section {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease-in-out;
    will-change: grid-template-rows;
}

.collapse-section.open {
    grid-template-rows: 1fr;
}

.collapse-section-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: inherit;
}

/* One clean dip to black and back. The earlier version strobed on/off four
   times inside the first 300ms - roughly 6-7 flashes per second, past the
   photosensitivity threshold in WCAG 2.3.1. The swap still happens at 400ms. */
@keyframes powerOutage {
    0% {
        opacity: 1;
        filter: brightness(1) grayscale(0);
    }

    25% {
        opacity: 0;
        filter: brightness(0);
    }

    60% {
        opacity: 0;
        filter: brightness(0);
    }

    80% {
        opacity: 0.5;
        filter: brightness(0.5);
    }

    100% {
        opacity: 1;
        filter: brightness(1) grayscale(0);
    }
}

.animate-power-outage {
    animation: powerOutage 1.2s ease-in-out;
}

@keyframes chatWiggle {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(5deg); }
    40% { transform: rotate(0deg); }
}

.chat-icon-animated {
    animation: chatWiggle 4s ease-in-out infinite;
    transform-origin: bottom center;
}

/* ─── Interactive elements promoted from <div> to <button> ───
   These were divs with click handlers, so they were invisible to keyboard and
   screen-reader users. As buttons they need the UA styling neutralised. */
.theme-toggle,
.gallery-item,
.gallery-dot,
.recommendation-dot {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    color: inherit;
    padding: 0;
}

.gallery-dot,
.recommendation-dot {
    display: block;
    border: 2px solid transparent;
}

.gallery-item {
    display: block;
    width: 100%;
}

.theme-toggle:focus-visible,
.gallery-item:focus-visible,
.gallery-dot:focus-visible,
.recommendation-dot:focus-visible,
#chatButton:focus-visible,
#view-all-tech:focus-visible,
#view-all-projects-btn:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* Keyboard-only shortcut past the header */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 0;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    left: 0;
}

/* ─── Chat bubbles ───
   The canned replies are newline-formatted lists; without pre-wrap the browser
   collapses every newline and the reply arrives as one run-on paragraph. */
.chat-row {
    display: flex;
}

.chat-row-user {
    justify-content: flex-end;
}

.chat-row-bot {
    justify-content: flex-start;
}

.chat-bubble {
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 80%;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.55;
}

.chat-bubble-user {
    background: var(--button-bg);
    color: var(--button-text);
}

.chat-bubble-bot {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-left: 3px solid var(--button-bg);
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: normal;
}

/* ─── Reduced motion ───
   Respect the OS setting: no strobing portrait, no looping wiggle, no
   auto-animating carousel or collapse transitions. */
@media (prefers-reduced-motion: reduce) {

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

    .chat-icon-animated,
    .animate-power-outage {
        animation: none !important;
    }
}

/* Replaces the inline onmouseover/onmouseout handlers that used to set this
   colour (removed so the site can ship a CSP without 'unsafe-inline'). */
#view-all-tech {
    color: var(--text-tertiary);
}

#view-all-tech:hover,
#view-all-tech:focus-visible {
    color: var(--text-primary);
}

/* ─── Milestones that link out to the organisation ───
   Only some milestones have a destination, so the arrow is the affordance that
   marks which ones are clickable. Hover coordinates three quiet cues - the
   timeline marker fills, the arrow lifts away, and the organisation name
   darkens - rather than an underline. Nothing reflows: every cue is colour or
   transform, so the timeline and the year column stay put. */
a.achievement-item {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}

a.achievement-item .achievement-organization,
a.achievement-item::before {
    transition: color 260ms cubic-bezier(0.33, 1, 0.68, 1),
                background-color 260ms cubic-bezier(0.33, 1, 0.68, 1),
                border-color 260ms cubic-bezier(0.33, 1, 0.68, 1),
                transform 260ms cubic-bezier(0.33, 1, 0.68, 1);
}

.achievement-external {
    width: clamp(10px, 1.5vw, 12px);
    height: clamp(10px, 1.5vw, 12px);
    margin-left: 5px;
    color: var(--text-tertiary);
    vertical-align: -1px;
    flex-shrink: 0;
    transition: color 260ms cubic-bezier(0.33, 1, 0.68, 1),
                transform 260ms cubic-bezier(0.33, 1, 0.68, 1);
}

/* The marker is centred by transform-origin, so scaling it keeps it on the line. */
a.achievement-item:hover::before,
a.achievement-item:focus-visible::before {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
    transform: scale(1.18);
}

a.achievement-item:hover .achievement-external,
a.achievement-item:focus-visible .achievement-external {
    color: var(--text-primary);
    transform: translate(2px, -2px);
}

a.achievement-item:hover .achievement-organization,
a.achievement-item:focus-visible .achievement-organization {
    color: var(--text-primary);
}

/* Press: a quick settle inward, so the click has weight. */
a.achievement-item:active::before {
    transform: scale(0.94);
    transition-duration: 100ms;
}

a.achievement-item:active .achievement-external {
    transform: translate(0, 0);
    transition-duration: 100ms;
}

a.achievement-item:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 6px;
}
