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

html {
    scroll-behavior: smooth;
}

:root {
    --gray-950: #0a0a0a;
    --gray-900: #171717;
    --gray-850: #1f1f1f;
    --gray-800: #262626;
    --gray-750: #2e2e2e;
    --gray-600: #525252;
    --gray-400: #a3a3a3;
    --gray-200: #e5e5e5;
    --gray-050: #fafafa;
    --clay: #A77B5B;

    /* HDR fallback colors (sRGB) */
    --clay-hdr: #A77B5B;
    --gray-050-hdr: #fafafa;
    --clay-alpha-30: rgba(167, 123, 91, 0.3);
}

/* HDR colors for Display-P3 capable displays */
@supports (color: color(display-p3 1 1 1)) {
    :root {
        --clay-hdr: color(display-p3 0.72 0.52 0.38);
        --gray-050-hdr: color(display-p3 0.99 0.99 0.99);
        --clay-alpha-30: color(display-p3 0.72 0.52 0.38 / 0.3);
    }
}

body {
    font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--gray-950);
    color: var(--gray-400);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

/* Skip to main content link for accessibility */
.skip-to-main {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--clay);
    background: var(--clay-hdr);
    color: var(--gray-950);
    padding: 12px 24px;
    text-decoration: none;
    font-weight: 500;
    z-index: 10000;
    border-radius: 0 0 8px 0;
    transition: top 0.2s ease;
}

.skip-to-main:focus {
    top: 0;
    outline: none;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--clay) 0%, var(--clay-hdr) 100%);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Focus States for Accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--clay);
    outline: 2px solid var(--clay-hdr);
    outline-offset: 4px;
    /* Add subtle glow for better visibility */
    box-shadow: 0 0 0 4px rgba(167, 123, 91, 0.2);
    box-shadow: 0 0 0 4px color(display-p3 0.72 0.52 0.38 / 0.2);
}

.page {
    max-width: 680px;
    margin: 0 auto;
    padding: 80px 40px;
    animation: fadeIn 0.6s ease-out;
    will-change: opacity, transform;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 60px;
}

.name {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: 12px;
    /* Fallback gradient for standard displays */
    background: linear-gradient(135deg, var(--gray-050) 60%, rgba(167, 123, 91, 0.3) 100%);
    /* HDR gradient with vibrant P3 colors for supported displays */
    background: linear-gradient(135deg, var(--gray-050-hdr) 60%, var(--clay-alpha-30) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientPulse 6s ease-in-out infinite;
    will-change: opacity;
}

@keyframes gradientPulse {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
}

.subtitle {
    font-size: 18px;
    font-weight: 400;
    color: var(--gray-400);
    margin-bottom: 24px;
}

.contact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 15px;
}

.contact-link {
    color: var(--gray-400);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.contact-link:hover {
    color: var(--clay);
    color: var(--clay-hdr);
}

.contact-link .icon {
    font-size: 16px;
    color: inherit;
    font-weight: 300;
}

.contact-link .arrow-icon {
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
    color: inherit;
    font-weight: 300;
}

.contact-link:hover .arrow-icon {
    opacity: 1;
    transform: translate(2px, -2px);
}

.separator {
    color: var(--gray-600);
    user-select: none;
}

/* Divider */
.divider {
    margin: 60px auto;
    text-align: center;
    font-size: 10px;
    letter-spacing: 8px;
    /* HDR color for wider gamut displays, fallback to standard */
    color: var(--gray-600);
    color: color(display-p3 0.45 0.45 0.45);
    line-height: 1;
}

.divider::before {
    content: '• • •';
    display: inline-block;
    animation: dotFade 3s ease-in-out infinite;
    /* Add subtle glow effect that's more visible on HDR displays */
    text-shadow: 0 0 8px rgba(167, 123, 91, 0.3),
                 0 0 4px rgba(167, 123, 91, 0.2);
    text-shadow: 0 0 8px color(display-p3 0.65 0.48 0.36 / 0.3),
                 0 0 4px color(display-p3 0.65 0.48 0.36 / 0.2);
    will-change: opacity;
}

@keyframes dotFade {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
        /* Intensify glow at peak of animation */
        text-shadow: 0 0 12px rgba(167, 123, 91, 0.5),
                     0 0 6px rgba(167, 123, 91, 0.4);
        text-shadow: 0 0 12px color(display-p3 0.65 0.48 0.36 / 0.5),
                     0 0 6px color(display-p3 0.65 0.48 0.36 / 0.4);
    }
}

/* Sections */
.section {
    margin-bottom: 40px;
    /* CSS Containment for better rendering performance (layout + paint) */
    contain: layout paint;
}

.section-heading {
    font-size: 24px;
    font-weight: 500;
    color: var(--gray-050);
    margin-bottom: 32px;
    letter-spacing: 0;
}

/* Body Text */
.body-text {
    font-size: 17px;
    line-height: 1.7;
    color: var(--gray-400);
    margin-bottom: 20px;
}

.body-text a {
    /* HDR clay color */
    color: var(--clay);
    color: var(--clay-hdr);
    text-decoration: underline;
    text-decoration-color: rgba(167, 123, 91, 0.3);
    text-decoration-color: color(display-p3 0.72 0.52 0.38 / 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

.body-text a:hover {
    text-decoration-color: var(--clay);
    text-decoration-color: var(--clay-hdr);
}

.body-text.highlight {
    color: var(--clay);
    color: var(--clay-hdr);
    font-weight: 450;
    padding-left: 16px;
    border-left: 2px solid var(--clay);
    border-left: 2px solid var(--clay-hdr);
}

.opportunity-link {
    color: inherit;
    text-decoration: none !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.opportunity-link:hover {
    color: var(--gray-200);
}

.opportunity-link::after {
    content: '→';
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.opportunity-link:hover::after {
    opacity: 1;
    transform: translateX(2px);
}

/* Entry (for Education & Experience) */
.entry {
    margin-bottom: 36px;
    padding: 16px;
    padding-left: 17px;
    margin-left: -16px;
    margin-right: -16px;
    border-left: 1px solid transparent;
    transition: border-color 0.2s ease;
    /* CSS Containment for layout and style isolation */
    contain: layout style;
}

.entry:last-child {
    margin-bottom: 0;
}

.entry:hover {
    /* Minimalist left border accent */
    border-left-color: rgba(167, 123, 91, 0.3);
    border-left-color: color(display-p3 0.72 0.52 0.38 / 0.3);
}

.entry-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--gray-050);
    margin-bottom: 6px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    transition: color 0.2s ease;
}

.entry:hover .entry-title {
    /* Brighten title with HDR white */
    color: var(--gray-050-hdr);
}

.project-link {
    color: var(--gray-050);
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.project-link:hover {
    color: var(--clay);
    color: var(--clay-hdr);
}

.project-arrow {
    font-size: 14px;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-weight: 300;
}

.project-link:hover .project-arrow {
    opacity: 1;
    transform: translate(2px, -2px);
}

.entry-meta {
    font-size: 14px;
    color: var(--gray-200);
    margin-bottom: 10px;
    font-weight: 300;
}

.entry-meta .company {
    color: var(--clay);
    color: var(--clay-hdr);
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    transition: filter 0.2s ease;
}

.entry-meta .company:hover {
    filter: brightness(1.2);
}

.entry-description {
    font-size: 16px;
    line-height: 1.7;
    color: var(--gray-400);
    margin-bottom: 12px;
}

/* Tech Stack Badges */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-600);
}

.tech-badge {
    font-weight: 400;
}

.tech-badge:not(:last-child)::after {
    content: '·';
    margin-left: 6px;
    opacity: 0.5;
}

/* Repository Header */
.repo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.star-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--gray-400);
    font-weight: 400;
    font-size: 14px;
    white-space: nowrap;
}

.star-icon {
    font-size: 14px;
    line-height: 1;
    /* HDR color for the star */
    color: var(--clay);
    color: var(--clay-hdr);
    animation: starPulse 3s ease-in-out infinite;
    will-change: transform, opacity, filter;
}

@keyframes starPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
        /* Subtle base glow */
        filter: drop-shadow(0 0 1px rgba(167, 123, 91, 0.3));
        filter: drop-shadow(0 0 1px color(display-p3 0.85 0.60 0.42 / 0.3));
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
        /* Intensify glow at peak */
        filter: drop-shadow(0 0 2px rgba(167, 123, 91, 0.5));
        filter: drop-shadow(0 0 2px color(display-p3 0.85 0.60 0.42 / 0.5));
    }
}

.entry:hover .star-icon {
    animation: starGlow 1.5s ease-in-out infinite;
}

@keyframes starGlow {
    0%, 100% {
        opacity: 0.8;
        /* HDR glow - more vibrant on P3 displays */
        filter: drop-shadow(0 0 3px rgba(167, 123, 91, 0.6))
                drop-shadow(0 0 6px rgba(167, 123, 91, 0.3));
        filter: drop-shadow(0 0 3px color(display-p3 0.85 0.60 0.42 / 0.6))
                drop-shadow(0 0 6px color(display-p3 0.85 0.60 0.42 / 0.3));
    }
    50% {
        opacity: 1;
        /* Peak glow - super vibrant */
        filter: drop-shadow(0 0 5px rgba(167, 123, 91, 0.8))
                drop-shadow(0 0 10px rgba(167, 123, 91, 0.5))
                drop-shadow(0 0 15px rgba(167, 123, 91, 0.2));
        filter: drop-shadow(0 0 5px color(display-p3 0.85 0.60 0.42 / 0.8))
                drop-shadow(0 0 10px color(display-p3 0.85 0.60 0.42 / 0.5))
                drop-shadow(0 0 15px color(display-p3 0.85 0.60 0.42 / 0.2));
    }
}

.star-number {
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Skills */
.skill-category {
    margin-bottom: 24px;
}

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

.skill-category-title {
    font-size: 16px;
    font-weight: 500;
    /* HDR clay for skill titles */
    color: var(--clay);
    color: var(--clay-hdr);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.skill-items {
    font-size: 15px;
    line-height: 1.7;
    color: var(--gray-400);
    margin: 0;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 14px;
    color: var(--gray-600);
    margin-top: 40px;
}

.footer p {
    margin: 0;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .divider::before {
        animation: none !important;
        opacity: 0.4 !important;
    }

    .contact-link .icon {
        animation: none !important;
    }

    .star-icon {
        animation: none !important;
        opacity: 0.8 !important;
    }

    .entry:hover .star-icon {
        animation: none !important;
        filter: none !important;
    }

    .name {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .contact-link:active,
    .project-link:active,
    .opportunity-link:active {
        opacity: 0.7;
        transform: scale(0.98);
    }

    .entry-meta .company:active {
        opacity: 0.7;
    }

    /* Ensure adequate tap target size (44px minimum) */
    .contact-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .page {
        padding: 60px 30px;
    }

    .name {
        font-size: 36px;
        line-height: 1.2;
    }

    .subtitle {
        font-size: 16px;
        line-height: 1.5;
    }

    .body-text {
        font-size: 16px;
        line-height: 1.75;
    }

    .section-heading {
        font-size: 22px;
        margin-bottom: 28px;
    }

    .entry {
        margin-bottom: 32px;
        padding: 12px;
        margin-left: -12px;
        margin-right: -12px;
    }

    .entry-title {
        font-size: 17px;
        line-height: 1.4;
    }

    .entry-meta {
        font-size: 14px;
    }

    .entry-description {
        font-size: 15px;
        line-height: 1.65;
    }

    .tech-stack {
        font-size: 12px;
    }

    .star-count {
        font-size: 13px;
    }

    .star-icon {
        font-size: 13px;
    }

    .repo-header {
        flex-wrap: wrap;
    }

    .skill-category-title {
        font-size: 15px;
    }

    .skill-items {
        font-size: 14px;
    }

    .divider {
        margin: 50px 0;
    }

    .contact {
        font-size: 14px;
        flex-direction: column;
        gap: 10px;
    }

    .separator {
        display: none;
    }

    .contact-link .icon {
        font-size: 14px;
    }

    .contact-link .arrow-icon {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 50px 20px;
    }

    .name {
        font-size: 32px;
        line-height: 1.2;
    }

    .subtitle {
        font-size: 15px;
    }

    .section-heading {
        font-size: 20px;
        margin-bottom: 24px;
    }

    .body-text {
        font-size: 15px;
        line-height: 1.7;
    }

    .entry {
        margin-bottom: 28px;
        padding: 10px;
        margin-left: -10px;
        margin-right: -10px;
    }

    .entry-title {
        font-size: 16px;
    }

    .entry-meta {
        font-size: 13px;
    }

    .entry-description {
        font-size: 14px;
        line-height: 1.6;
    }

    .tech-stack {
        font-size: 11px;
    }

    .star-count {
        font-size: 12px;
    }

    .star-icon {
        font-size: 12px;
    }

    .divider {
        margin: 40px 0;
    }
}

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

    body {
        background-color: white;
        color: #333;
        font-size: 11pt;
    }

    .page {
        padding: 20pt;
        max-width: 100%;
        margin: 0;
    }

    .name {
        color: black;
        font-size: 24pt;
    }

    .subtitle {
        color: #666;
        font-size: 12pt;
    }

    .section-heading {
        color: black;
        font-size: 14pt;
        margin-bottom: 12pt;
    }

    .entry-title {
        color: black;
        font-size: 11pt;
    }

    .entry-meta {
        color: #A77B5B;
        font-size: 10pt;
    }

    .entry-meta .company {
        color: #A77B5B;
    }

    .body-text,
    .entry-description {
        color: #333;
        font-size: 10pt;
        line-height: 1.4;
    }

    .contact-link {
        color: #666;
        text-decoration: none;
    }

    .contact-link .arrow-icon {
        display: none;
    }

    .divider {
        margin: 12pt 0;
        color: #999;
    }

    .divider::before {
        animation: none;
        opacity: 0.5;
    }

    .skill-category-title {
        color: #A77B5B;
        font-size: 10pt;
    }

    .skill-items {
        font-size: 9pt;
        color: #555;
    }

    .tech-stack {
        font-size: 9pt;
    }

    .star-count {
        font-size: 9pt;
        color: #666;
    }

    .star-icon {
        animation: none;
        color: #A77B5B;
    }

    .repo-header {
        display: flex;
        align-items: center;
        gap: 10pt;
    }

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

    .section {
        page-break-after: avoid;
        margin-bottom: 16pt;
    }

    .footer {
        margin-top: 20pt;
        font-size: 9pt;
        color: #999;
    }

    /* Show email in print */
    .opportunity-link::after {
        content: " (i@irak.li)";
        color: #666;
        font-weight: 400;
    }

    .body-text.highlight {
        border-left-color: #A77B5B;
    }
}
