:root {
    --background: #ffffff;
    --text-primary: #171717;
    --text-secondary: #737373;
    --border: #e5e5e5;
    --light-blue: #E5F3FD;
}

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

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

header {
    display: flex;
    justify-content: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 10;
}

.pill-container {
    position: relative;
    display: inline-flex;
    border-radius: 999px;
    padding: 0.5rem;
    background: var(--light-blue);
    overflow: hidden;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: color 0.3s ease;
    z-index: 1;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.nav-link:focus-visible {
    outline: 2px solid rgba(229, 243, 253, 0.85);
    outline-offset: 4px;
    border-radius: 8px;
}

.nav-link.active {
    color: var(--text-primary);
}

.nav-indicator {
    position: absolute;
    height: calc(100% - 1rem);
    top: 0.5rem;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 999px;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.8s ease-out;
    z-index: 0;
    opacity: 0;
}

header.fade-in {
    animation-delay: 0.1s;
}
main.fade-in {
    animation-delay: 0.2s;
}
footer.fade-in {
    animation-delay: 0.3s;
}

.fade-in {
    animation: fadeInAnimation 0.5s ease-in-out forwards, slideUpAnimation 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInAnimation {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpAnimation {
    from { transform: translateY(10px); }
    to { transform: translateY(0); }
}

/* --- Waving Hand Animation --- */
@keyframes wave-animation {
    0% { transform: rotate(0.0deg); }
    10% { transform: rotate(14.0deg); }
    20% { transform: rotate(-8.0deg); }
    30% { transform: rotate(14.0deg); }
    40% { transform: rotate(-4.0deg); }
    50% { transform: rotate(10.0deg); }
    70% { transform: rotate(0.0deg); }
    100% { transform: rotate(0.0deg); }
}

.wave-animation-active {
    animation-name: wave-animation;
    animation-duration: 3.5s;
    animation-iteration-count: 1;
    animation-timing-function: ease-out;
    transform-origin: 70% 70%;
    display: inline-block;
}

.hero-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dino-userpic {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.2;
}

.hero .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 90%;
}

@media (max-width: 768px) {
    .hero-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .dino-userpic {
        width: 50px;
        height: 50px;
    }
    
    .dino-on-line {
        width: 65px;
        animation-duration: 10s;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 2rem 1rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero .subtitle {
        font-size: 1rem;
        max-width: 100%;
    }
}

.connect-section {
    margin-top: 3rem;
    text-align: center;
}

.site-footer {
    margin-top: 3rem;
    text-align: center;
}

.site-footer .section-divider {
    margin-bottom: 1.5rem;
}

.footer-credits {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 2rem;
    line-height: 1.5;
}

.footer-credits a {
    color: var(--text-secondary);
}

/* Support link on its own centered line under the first sentence */
.footer-support {
    display: block;
    margin: 0.5rem auto 0.75rem;
    width: fit-content;
}

.dino-line-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    width: 100%;
    margin: 0;
}

.dino-on-line {
    position: fixed;
    width: 100px;
    height: auto;
    z-index: 0;
    left: 100vw;
}

.dino-on-line.skating {
    animation: skateAcross 12s linear infinite;
}

@keyframes skateAcross {
    from {
        transform: translateX(0);
    }
    to {
        /* Travel across the screen (100vw) plus its own max width (100px) */
        transform: translateX(calc(-100vw - 100px)); 
    }
}

.connect-section h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 2rem; /* Tighter spacing */
}

.connect-anchor {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    position: relative;
    padding: 0.5rem;
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.connect-anchor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(229, 243, 253, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: -1;
}

.connect-anchor:hover::before {
    transform: scale(1);
    opacity: 1;
}

.hover-link {
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #38694B;
    cursor: pointer;
}

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

/* Two-column layout for say-hi page */
.connect-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: left;
}

.cv-page .connect-grid {
    grid-template-columns: 1fr 1fr 2.5fr;
    gap: 3rem;
}

.connect-column h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
}

.contact-item:hover {
    background-color: rgba(229, 243, 253, 0.5);
    transform: translateY(-1px);
}

.contact-icon {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.contact-icon img {
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.contact-icon .icon-color {
    opacity: 0;
}

.contact-item:hover .contact-icon .icon-mono {
    opacity: 0;
}

.contact-item:hover .contact-icon .icon-color {
    opacity: 1;
}

.contact-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.vibe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.vibe-grid .contact-item {
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem;
    border-radius: 8px;
}

.vibe-grid .contact-name {
    font-size: 0.875rem;
}

/* Progressive icon scaling to maintain two-column layout longer */
@media (max-width: 900px) {
    .contact-icon {
        width: 28px;
        height: 28px;
    }
    
    .contact-icon img {
        width: 28px;
        height: 28px;
    }
    
    .connect-grid {
        gap: 3rem;
    }
    
    .vibe-grid {
        max-width: 260px;
    }
}

@media (max-width: 700px) {
    .contact-icon {
        width: 24px;
        height: 24px;
    }
    
    .contact-icon img {
        width: 24px;
        height: 24px;
    }
    
    .connect-grid {
        gap: 2.5rem;
    }
    
    .vibe-grid {
        max-width: 240px;
    }
    
    .vibe-grid .contact-item {
        padding: 0.75rem 0.25rem;
    }
}

/* Keep two columns even on small screens, and make icons smaller */
@media (max-width: 550px) {
    .connect-grid {
        gap: 1.5rem;
    }
    
    .contact-icon {
        width: 20px;
        height: 20px;
    }
    
    .contact-icon img {
        width: 20px;
        height: 20px;
    }
    
    .vibe-grid {
        max-width: 200px;
    }
    
    .vibe-grid .contact-item {
        padding: 0.5rem 0.2rem;
    }
    
    .vibe-grid .contact-name {
        font-size: 0.75rem;
    }
    
    .contact-item {
        padding: 0.5rem;
    }
    
    .contact-name {
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .dino-on-line {
        width: 50px;
    }
    
    @keyframes skateAcross {
        from {
            transform: translateX(0);
        }
        to {
            /* Travel across the screen (100vw) plus its own width for mobile (50px) */
            transform: translateX(calc(-100vw - 50px)); 
        }
    }

    /* Disable animations on mobile */
    .nav-indicator {
        transition: none;
    }
}

/* --- ACCESSIBILITY UTILITIES --- */

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

/* --- PROJECTS PAGE STYLES --- */

.projects-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start; /* Align items to the top */
    height: 100%; /* Ensure layout takes full height */
}

.projects-sidebar {
    padding-right: 2rem;
    width: 45%;
    flex-shrink: 0;
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-item {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden; /* Ensures content respects border-radius */
}

.project-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(229, 243, 253, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: -1;
}

.project-item:hover::before {
    opacity: 1;
}

.project-item:hover {
    transform: translateY(-2px);
}

.project-item.active::before {
    opacity: 1;
    background-color: rgba(229, 243, 253, 1);
}

.project-item.active {
    transform: translateY(-2px);
}

.project-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.project-year {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.project-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.project-detail {
    position: relative;
    height: auto;
    min-height: 500px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: visible;
    align-self: stretch;
}

.dino-neck {
    position: fixed;
    --dino-width: clamp(320px, 30vw, 450px);
    right: clamp(20px, 3vw, 40px);
    left: auto;
    top: var(--dino-sticky-top, 20px);
    width: var(--dino-width);
    height: auto;
    z-index: -1;
    opacity: 1;
    transition: opacity 0.2s ease, top 0.2s ease-out, right 0.2s ease-out;
    pointer-events: none;
}

/* Hide dino when any project is active */
.project-viewing .dino-neck {
    opacity: 0;
}

/* Hide fixed dino when viewport is too narrow for side placement */
@media (max-width: 980px) {
    .dino-neck { display: none; }
}

.dino-neck.hidden {
    opacity: 0;
}

.project-content {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateY(10px);
    overflow-y: auto;
    max-height: calc(100vh - 100px);
}

/* Hide scrollbar for project content */
.project-content::-webkit-scrollbar {
    display: none;
}

.project-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.project-content.hidden {
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    pointer-events: none;
}

.project-content.active {
    opacity: 1;
    transform: translateY(0);
}

/* Project image container */
.project-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    flex: 0 0 auto;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto 1.5rem;
}

/* Loading state overlay for smooth transitions */
.project-image.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(229,243,253,0.5), transparent 60%);
    pointer-events: none;
}

.project-image.loading .spinner {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(23,23,23,0.15);
    border-top-color: rgba(23,23,23,0.5);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease;
    image-rendering: auto;
    border-radius: 16px;
}

.project-info {
    flex: 1;
}

.project-info h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.project-info div {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.project-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}


/* Desktop: ensure project detail is visible */
@media (min-width: 769px) {
    .projects-page .project-content {
        position: sticky;
        top: 20px;
    }

    .project-detail {
        display: flex;
    }
    
    .dino-neck {
        display: block;
    }
    
    /* Projects page: hide skating dino completely on desktop */
    .projects-page .dino-on-line {
        display: none !important;
    }
}

/* Hide mobile overlay on desktop */
@media (min-width: 769px) {
    .project-overlay {
        display: none !important;
    }
}

/* Mobile responsiveness for projects */
@media (max-width: 768px) {
    .projects-layout {
        flex-direction: column;
        gap: 2rem;
    }
    
    .projects-sidebar {
        width: 100%;
        padding-right: 0;
        padding-bottom: 2rem;
    }
    
    .project-detail {
        display: none; /* Hide desktop project detail on mobile */
    }

    .dino-neck {
        display: none; /* Hide nodding dino on mobile */
    }
    
    /* Show skating dino on mobile since there's no space for nodding dino */
    .projects-page .dino-on-line {
        display: block !important;
    }
    
    /* Mobile project overlay */
    .project-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: var(--background);
        z-index: 99999;
        padding: 2rem;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        isolation: isolate;
    }
    
    .project-overlay.active {
        transform: translateX(0);
    }
    
    /* Prevent body scroll when overlay is active */
    body.overlay-active {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .project-overlay-header {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 2rem;
        position: relative;
        min-height: 44px;
        flex-direction: column;
    }
    
    .back-button {
        background-color: var(--light-blue);
        border: none;
        outline: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        color: var(--text-primary);
        font-size: 1.4rem;
        font-weight: bold;
        flex-shrink: 0;
        position: absolute;
        top: 0;
        left: 0;
        -webkit-tap-highlight-color: transparent;
    }
    
    .back-button:hover {
        background-color: var(--light-blue);
    }
    
    #overlay-project-title {
        margin: 0;
        width: 100%;
        text-align: center;
        line-height: 1.2;
    }
    
    .project-subtitle {
        margin: 0.25rem 0 0 0;
        width: 100%;
        text-align: center;
        font-size: 0.875rem;
        color: var(--text-secondary);
        display: none; /* Hidden by default, shown when subtitle exists */
    }
    
    .project-overlay .project-image {
        width: 100%;
        aspect-ratio: 1 / 1;
        height: auto;
        max-width: 360px;
        flex: 0 0 auto;
        margin: 0 auto 2rem;
    }
    
    .project-overlay .project-image img {
        object-fit: cover;
        object-position: center;
        transition: opacity 0.3s ease;
    }
    
    .project-overlay .project-info h2 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
        line-height: 1.2;
    }
    
    .project-overlay .project-info div {
        font-size: 1.125rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
    
    .project-actions {
        text-align: center;
    }
    
    .mobile-project-link {
        text-decoration: underline;
        color: var(--text-primary);
        padding: 0.5rem 1rem;
        border-radius: 8px;
        background-color: rgba(229, 243, 253, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        transition: all 0.3s ease;
        display: inline-block;
        border: none;
        outline: none;
    }
    
    .mobile-project-link:focus {
        outline: 2px solid var(--text-primary);
        outline-offset: 2px;
    }
    
    .mobile-project-link:hover {
        background-color: rgba(229, 243, 253, 1);
        transform: translateY(-1px);
    }
    
}

@media (max-width: 480px) {
    .project-item {
        padding: 0.75rem;
    }
    
    .project-title {
        font-size: 1rem;
    }
    
    .project-year, .project-summary {
        font-size: 0.8rem;
    }
    
}

/* Speaking Dino Tooltip/Tulip */
.dino-userpic {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dino-userpic:hover {
    transform: scale(1.05);
}

.dino-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 
        0 5px 12px rgba(0, 0, 0, 0.05),
        0 2px 5px rgba(0, 0, 0, 0.025),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    max-width: 320px;
    min-width: 200px;
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
    font-size: 14px;
    line-height: 1.5;
}

.dino-tooltip.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dino-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #e5e5e5;
}

.dino-tooltip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #ffffff;
}

.dino-tooltip .quote-text {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 400;
}

.dino-tooltip .quote-text em {
    font-style: italic;
    color: var(--text-primary);
}

.dino-tooltip .quote-text strong {
    font-weight: 600;
}

.dino-tooltip .quote-source {
    margin: 0;
    text-align: right;
}

.dino-tooltip .quote-source a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border-bottom: 1px solid #38694B;
}

.dino-tooltip .quote-source a:hover {
    color: var(--text-primary);
}

/* Responsive tooltip positioning */
@media (max-width: 768px) {
    .dino-tooltip {
        max-width: 280px;
        font-size: 13px;
        padding: 14px 16px;
    }
}

/* --- WORK/CV PAGE --- */
.hero-cv {
    display: flex;
    gap: 2rem;
    align-items: center;
    margin-bottom: 3rem;
}

.hero-cv-image {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
    cursor: pointer;
}

.hero-cv-text {
    flex: 1;
}

.hero-cv h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.hero-cv .subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    max-width: 100%;
}

.cv-page .connect-section {
    margin-bottom: 3rem;
}

.cv-contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cv-contact-list p {
    margin: 0;
    color: var(--text-secondary);
}

.cv-photo, .cv-photo-hover {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    transition: opacity 0.3s ease;
    position: absolute;
    left: 0;
    top: 0;
}

.cv-photo-hover {
    opacity: 0;
}

/* Loading state for CV photos */
.hero-cv-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--border) 25%, rgba(229, 231, 235, 0.5) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    z-index: 0;
}

.hero-cv-image.loaded::before {
    display: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.cv-photo, .cv-photo-hover {
    opacity: 0;
    z-index: 1;
}

.hero-cv-image.loaded .cv-photo {
    opacity: 1;
}

/* Toggle state for all devices */
.hero-cv-image.photo-toggled .cv-photo {
    opacity: 0;
}

.hero-cv-image.photo-toggled .cv-photo-hover {
    opacity: 1;
}

/* Hover effect only on devices that support proper hovering (desktop) */
@media (hover: hover) and (pointer: fine) {
    .hero-cv-image:hover .cv-photo {
        opacity: 0;
    }

    .hero-cv-image:hover .cv-photo-hover {
        opacity: 1;
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.cv-actions {
    margin: 0;
}

.download-cv-btn {
    display: inline-block;
    background-color: var(--light-blue);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 500;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.download-cv-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.download-cv-btn:disabled {
    cursor: wait;
}

.cv-section {
    margin-bottom: 1.5rem;
}

.cv-section .section-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.cv-section h2 {
    font-size: 1.5rem;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.cv-item {
    margin-bottom: 1.5rem;
}

.cv-item:last-of-type {
    margin-bottom: 0;
}

.cv-item h4 {
    font-size: 1.25rem;
    font-weight: 500;
}

.cv-item .sub-info {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.cv-item p {
     color: var(--text-primary);
}

.cv-item ul {
    list-style-type: disc;
    padding-left: 1.25rem;
    margin-top: 1rem;
}

.cv-item ul li {
    margin-bottom: 0.5rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    break-inside: avoid;
    page-break-inside: avoid;
}

.skill-category {
    break-inside: avoid;
    page-break-inside: avoid;
}

.skill-category h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.skill-category ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.skill-category ul li {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}


.print-footer {
    display: none;
}

/* Hide PDF-only sections from web view */
.pdf-only {
    display: none;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: A4;
        margin: 1.0cm 0 0 0;
    }

    /* First page has no top margin 'cause it's good enough already */
    @page :first {
        margin: 0;
    }

    /* Show PDF-only sections */
    .pdf-only {
        display: block !important;
    }

    html, body {
        width: 210mm;
        height: 297mm;
    }

    body {
        background: #fff;
        padding: 1.5cm;
        margin: 0;
    }

    html {
        font-size: 12px; /* Scales all rem units down for print to help fit */
    }

    /* Hide elements not needed for PDF */
    header, .dino-on-line, .cv-actions, .site-footer, nav, .cv-photo-hover {
        display: none !important;
    }

    .container {
        padding: 0;
        max-width: 100%;
    }

    .cv-photo {
        opacity: 1 !important;
    }

    .hero-cv {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: 2rem !important;
    }

    .hero-cv-image {
        width: 140px !important; /* Slightly smaller image because it overlaps with text */
        height: 140px !important;
        flex-shrink: 0;
    }

    .hero-cv-text,
    .hero-cv h1,
    .hero-cv .subtitle {
        text-align: left !important;
    }
    
    /* Display clean URLs for specific links in print */
    a[href="https://www.linkedin.com/in/danielbilyk/"] .contact-name,
    a[href="https://github.com/danielbilyk"] .contact-name {
        display: none;
    }
    
    a[href="https://www.linkedin.com/in/danielbilyk/"]::after {
        content: "linkedin.com/in/danielbilyk";
        font-size: inherit;
        color: inherit;
        font-weight: 500;
    }
    
    a[href="https://github.com/danielbilyk"]::after {
        content: "github.com/danielbilyk";
        font-size: inherit;
        color: inherit;
        font-weight: 500;
    }

    /* Prevent breaking inside elements */
    .hero-cv, .connect-section, .cv-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Adjust spacing for print */
    .cv-page .connect-section {
        margin-bottom: 1.25rem;
    }
    
    /* Force 3-column layout for Contact/Fluent/Skills in print */
    .cv-page .connect-grid {
        grid-template-columns: 1fr 1fr 2.5fr !important;
        gap: 3rem !important;
    }
    
    .cv-page .connect-column:last-child {
        grid-column: auto !important;
    }
    .cv-section {
        padding-top: 1.25rem;
    }
    #cv-content .cv-section:first-of-type {
        padding-top: 0;
    }
    .cv-section .section-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.25rem;
    }
    .cv-item {
        margin-top: 0.75rem;
        margin-bottom: 0;
    }
    .cv-item:first-of-type {
        margin-top: 0;
    }
    .cv-item .sub-info {
        margin-bottom: 0.25rem;
    }
    .cv-item p,
    .cv-item ul {
        margin-bottom: 0.25rem;
    }
    .cv-item ul {
        margin-top: 0.25rem;
    }
    .cv-item ul li {
        margin-bottom: 0.15rem;
    }

    .print-footer {
        display: block;
        width: 100%;
        text-align: center;
        font-size: 7.5pt;
        color: var(--text-secondary);
        font-style: italic;
        margin-top: 1.5cm;
    }
    
    .print-footer p {
        margin: 0;
    }
    
}

@media (max-width: 768px) {
    .hero-cv {
        flex-direction: column;
        align-items: center;
        gap: 0;
        margin-bottom: 0;
    }

    .hero-cv-image {
        width: 120px;
        height: 120px;
        margin-bottom: 1rem;
    }

    .hero-cv-text {
        width: 100%;
    }

    .hero-cv h1 {
        font-size: 2rem;
        text-align: center;
    }

    .cv-page .connect-section {
        margin-top: 2rem;
    }

    .cv-page .connect-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .cv-page .connect-column:last-child {
        grid-column: 1 / -1;
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    .skill-category h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        text-align: left;
    }
    .skill-category ul li {
        font-size: 0.9375rem;
        margin-bottom: 0.3rem;
    }
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skills-list p {
    margin: 0;
    color: var(--text-secondary);
}

.skills-list strong {
    color: var(--text-primary);
}

.cv-page .contact-list {
    gap: 0;
}

.cv-page .contact-item {
    padding: 0.5rem;
    gap: 1rem;
}

.cv-page .contact-icon {
    width: 24px;
    height: 24px;
}

.cv-page .contact-icon img {
    width: 24px;
    height: 24px;
    position: absolute;
}

.cv-page div.contact-item:hover {
    background-color: transparent;
    transform: none;
}

.cv-page div.contact-item:hover .contact-icon .icon-mono {
    opacity: 1;
}

.cv-page div.contact-item:hover .contact-icon .icon-color {
    opacity: 0;
}

@media (min-width: 769px) {
    .cv-page .contact-list {
        gap: 0.5rem;
    }
}