/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Visually Hidden - for SEO and accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333333;
    background-color: color(display-p3 1.000 0.940 0.870);
    animation: backgroundShift 50s ease-in-out infinite;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes backgroundShift {
    0% {
        background-color: color(display-p3 1.000 0.940 0.880);
    }
    25% {
        background-color: color(display-p3 1.000 1.000 0.890);
    }
    50% {
        background-color: color(display-p3 0.910 0.970 1.000);
    }
    75% {
        background-color: color(display-p3 0.940 1.000 0.930);
    }
    100% {
        background-color: color(display-p3 1.000 0.940 0.880);
    }
}

/* Container and Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem clamp(2rem, 8vw, 6rem);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Profile Header */
.profile-header {
    text-align: center;
    margin-bottom: 3rem;
}

.profile-image-container {
    width: 100%;
    border-radius: 12px;
    clip-path: inset(0 round 12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* Base micro-interaction */
.profile-image {
    width: 100%;
    height: auto;
    display: block;
    transform: scale(1);
    transform-origin: center center;
    will-change: transform;
    transition-property: transform;
    transition-duration: 600ms;
    transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
    transition-delay: var(--leave-delay, 50ms); /* default: debounce leave by 50ms */
}

/* Hover: scale up quickly with no delay */
.profile-image-container:hover .profile-image {
    transform: scale(1.008);
    --leave-delay: 0ms; /* entering hover has no delay; leaving restores 50ms */
}

/* Keyboard focus parity */
.profile-image-container:focus .profile-image,
.profile-image-container:focus-visible .profile-image {
    transform: scale(1.008);
    --leave-delay: 0ms;
}

/* Touch/coarse pointers: match JS touch behavior */
@media (pointer: coarse) {
    /* On touch, we want a longer 200ms linger on release */
    .profile-image {
        transition-delay: var(--leave-delay, 200ms);
    }
    /* While pressing (touchstart): scale to 1.005 with no delay */
    .profile-image-container:active .profile-image {
        transform: scale(1.005);
        --leave-delay: 0ms;
    }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .profile-image { transition: none; }
}

/* Content Sections */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.content p:first-child {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.7;
    color: #222222;
}

.content p:not(:first-child) {
    font-size: 1rem;
    line-height: 1.7;
    color: #333333;
}

/* Highlights Section */
.highlights {
    margin: 1rem 0;
}

.highlights-title {
    font-size: 1rem;
    font-weight: 600;
    color: #222222;
    margin-bottom: 0.75rem;
    text-align: left;
}

.highlights-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.highlight-item {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: start;
    padding: 0.5rem 0;
}

.highlight-year,
.highlight-description {
    font-size: 1rem;
    font-weight: 400;
    text-align: left;
}

.highlight-year {
    color: #888888;
}

.highlight-description {
    color: #333333;
    margin: 0;
}

/* Contact Section */
.contact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.contact-link {
    color: #333333;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    font-size: 1rem;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.contact-link:hover {
    color: #0066cc;
    text-decoration-color: #0066cc;
}

.contact-link:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-header {
        margin-bottom: 2rem;
    }
    
    .content p:first-child {
        font-size: 1.125rem;
    }
    
    .highlight-item {
        grid-template-columns: 60px 1fr;
    }
}

@media (max-width: 480px) {
    .content p:first-child {
        font-size: 1rem;
    }
    
    .highlight-item {
        grid-template-columns: 50px 1fr;
    }
    
    .contact {
        margin-bottom: 1rem;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 900px;
    }
    
    .content p:first-child {
        font-size: 1.375rem;
    }
}

/* Print Styles */
@media print {
    body {
        background-color: white;
        color: black;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .profile-image {
        box-shadow: none;
    }
    
    .contact-link {
        color: black;
        text-decoration: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    body {
        animation: none !important;
        background-color: color(display-p3 1.000 0.940 0.880) !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    body {
        background-color: white;
        color: black;
    }
    
    .highlight-year {
        color: #666666;
    }
    
    .contact-link {
        color: black;
    }
    
    .contact-link:hover {
        color: #0000ff;
    }
}