/*
 * Fluid Poster-Like Portfolio Layout
 * ===================================
 *
 * Key Changes:
 * - Desktop-perfect mode: @media (min-width: 1280px) and (min-height: 700px)
 * - Responsive/mobile fallback: @media (max-width: 1279px), (max-height: 699px)
 * - Tablet landscape allowlist: @media (min-width: 900px) and (orientation: landscape) and (min-height: 650px)
 * - Vertical spacing uses vh units for responsive scaling across screen heights
 * - Horizontal spacing uses vw units for responsive width scaling
 * - Profile photo scales with min(vw, vh) for proportional sizing
 * - Hover effects gated behind @media (hover: hover) and (pointer: fine)
 * - Mobile performance: reduced backdrop-filter and glow intensity
 * - Windows optimizations: custom scrollbars, font rendering, scrollbar-gutter
 */

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(115, 115, 115, 0.3) transparent;
}

/* Smooth Theme Transition */
body,
body * {
    transition: background-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        border-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        fill 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        stroke 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Root Variables - Warm Cream & Teal Theme */
:root {
    --text-primary: #1C1917;
    --text-secondary: #78716C;
    --accent: #78716C;
    --accent-dark: #57534E;
    --accent-glow: rgba(120, 113, 108, 0.2);
    --bg-dark: #FFFBF5;
    --bg-gradient: linear-gradient(135deg, #FFFBF5 0%, #FEF7EC 100%);
    --card-bg: rgba(254, 247, 236, 0.9);
    --card-border: rgba(231, 218, 199, 0.8);
    --card-hover-bg: rgba(254, 243, 228, 0.98);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow: 0 8px 32px 0 rgba(28, 25, 23, 0.06);
    --glass-blur: blur(12px);
    --cta-primary: #1C1917;
    --cta-secondary: #78716C;
    /* Featured link color - rich charcoal for App Store / View Website */
    --featured-link-bg: #292524;
    --featured-link-hover: #1C1917;
}

[data-theme="dark"] {
    --bg-dark: #0C0A09;
    --bg-gradient: linear-gradient(135deg, #0C0A09 0%, #1C1917 100%);
    --text-primary: #FAFAF9;
    --text-secondary: #A8A29E;
    --card-bg: rgba(28, 25, 23, 0.9);
    --card-border: rgba(68, 64, 60, 0.8);
    --card-hover-bg: rgba(41, 37, 36, 0.98);
    --accent-glow: rgba(120, 113, 108, 0.15);
    --cta-primary: #FAFAF9;
    --cta-secondary: #A8A29E;
    --featured-link-bg: #FAFAF9;
    --featured-link-hover: #E7E5E4;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: var(--glass-blur);
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(40px, 4vw, 50px);
    height: clamp(40px, 4vw, 50px);
    padding: 0;
    font-size: clamp(1rem, 1.3vw, 1.3rem);
}

.theme-toggle:hover {
    background: var(--card-hover-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Custom Scrollbar Styling - Mac-like discrete scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(115, 115, 115, 0.3);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(115, 115, 115, 0.5);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
    background: rgba(115, 115, 115, 0.7);
}

/* Base body - defaults to responsive/scrollable */
body {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: clamp(14px, 1.3vw, 18px);
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--text-primary);
    overflow: auto;
    height: auto;
    min-height: 100vh;
    scrollbar-gutter: stable;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "liga", "kern";
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: min(1600px, 96vw);
    margin: 0 auto;
}

/* Main Content Area */
.main-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Fixed Name Header - Hidden in new design */
.name-header {
    display: none;
}

/* Profile View */
.profile-view {
    display: none;
    height: auto;
    overflow-y: auto;
    padding: clamp(1rem, 2vh, 4rem);
}

.profile-view.active {
    display: flex;
    flex-direction: column;
}

.profile-container {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    justify-content: center;
    gap: 0;
}

/* Profile Header with Photo and Name */
.profile-header {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2vw, 2rem);
    margin-bottom: clamp(0.75rem, 1.5vh, 1.5rem);
}

.profile-photo {
    width: clamp(100px, min(9vw, 11vh), 220px);
    height: clamp(100px, min(9vw, 11vh), 220px);
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-title h1 {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 2.8vw, 4rem);
    font-weight: 700;
    margin-bottom: clamp(0.3rem, 0.5vw, 0.5rem);
    line-height: 1.2;
}

.profile-title .subtitle {
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 1.2vw, 1.6rem);
    font-weight: 400;
}

/* Bio Section */
.profile-bio {
    margin-bottom: clamp(0.75rem, 1.2vh, 1.5rem);
}

.profile-bio p {
    color: var(--text-primary);
    font-size: clamp(0.95rem, 1.1vw, 1.2rem);
    line-height: 1.6;
    margin-bottom: clamp(0.4rem, 0.6vh, 0.75rem);
}

.profile-bio .seeking {
    font-weight: 600;
}

#serb-link {
    color: var(--text-primary);
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

#serb-link:hover {
    opacity: 0.7;
}

/* Info Grid */
.info-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(0.25rem, 0.4vh, 0.5rem);
    margin-bottom: clamp(0.75rem, 1.2vh, 1.5rem);
}

.info-grid span {
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 1vw, 1rem);
}

.info-grid i {
    color: var(--text-primary);
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
    display: inline-block;
}

/* Skills */
.skills {
    display: flex;
    gap: clamp(0.5rem, 0.75vw, 0.75rem);
    margin: clamp(0.75rem, 1.2vh, 1.5rem) 0;
    flex-wrap: wrap;
}

.skills span {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: clamp(0.35rem, 0.5vw, 0.5rem) clamp(0.7rem, 1vw, 1rem);
    border-radius: 2rem;
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    border: 1px solid var(--card-border);
    transition: var(--transition);
    backdrop-filter: var(--glass-blur);
}

/* Links */
.links {
    display: flex;
    gap: clamp(0.5rem, 0.75vw, 0.75rem);
    margin: clamp(0.75rem, 1.2vh, 1.5rem) 0;
    align-items: center;
    flex-wrap: wrap;
}

.links a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    padding: clamp(0.6rem, 0.75vw, 0.75rem) clamp(1rem, 1.25vw, 1.25rem);
    gap: 0.5rem;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    backdrop-filter: var(--glass-blur);
}

.links a.icon-only {
    width: clamp(40px, 4vw, 50px);
    height: clamp(40px, 4vw, 50px);
    padding: 0;
    font-size: clamp(1rem, 1.3vw, 1.3rem);
}

.links a i {
    color: var(--text-primary);
}

/* Hero CTA Section */
.cta-section {
    margin: clamp(0.75rem, 1.2vh, 1.5rem) 0;
}

.cta-headline {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 0.85vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: clamp(0.5rem, 0.75vh, 0.75rem);
    font-weight: 600;
}

/* Footer CTA Section */
.footer-cta {
    text-align: center;
    padding: clamp(3rem, 6vh, 6rem) clamp(1.5rem, 3vw, 3rem);
    margin-top: clamp(2rem, 4vh, 4rem);
}

.footer-cta h2 {
    color: var(--text-primary);
    font-size: clamp(1.5rem, 2.2vw, 2.2rem);
    font-weight: 700;
    margin-bottom: clamp(0.75rem, 1.5vh, 1.5rem);
}

.footer-cta > p {
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    max-width: 500px;
    margin: 0 auto clamp(1.5rem, 2.5vh, 2.5rem);
    line-height: 1.6;
}

.footer-cta-links {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 1vw, 1rem);
    justify-content: center;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
    padding: clamp(0.6rem, 0.75vw, 0.75rem) clamp(1rem, 1.25vw, 1.25rem);
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    font-weight: 600;
    backdrop-filter: var(--glass-blur);
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: clamp(1.5rem, 3vh, 3rem) clamp(1rem, 2vw, 2rem);
}

.site-footer p {
    color: var(--text-secondary);
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    margin: 0;
}

/* Compact Footer Widgets */
.footer-widgets-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    opacity: 0.5;
    margin: 0 0 0.5rem 0 !important;
}

.footer-widgets {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer-widgets:hover {
    opacity: 1;
}

.footer-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

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

.footer-widget-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.footer-widget-img.book {
    width: 26px;
    height: 36px;
    border-radius: 3px;
}

.footer-widget-text {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    line-height: 1.3;
    max-width: 200px;
}

.footer-widget-text span:first-child {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-widget-text span:last-child {
    font-size: 0.65rem;
    opacity: 0.7;
}

.footer-widget-divider {
    color: var(--text-secondary);
    opacity: 0.4;
    font-size: 0.9rem;
}

/* Hide on very small screens */
@media (max-width: 480px) {
    .footer-widgets {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-widget-divider {
        display: none;
    }
}

/* Widgets Section */
.widgets-section {
    margin-top: clamp(0.75rem, 1.2vh, 1.5rem);
}

.widget-container {
    margin-bottom: clamp(0.4rem, 0.6vh, 0.75rem);
}

.widget-title {
    color: var(--text-secondary);
    font-size: clamp(0.65rem, 0.75vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Widget Card Styles */
.widget-card {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1vw, 1rem);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: clamp(0.65rem, 1vw, 1rem);
    text-decoration: none;
    transition: var(--transition);
    max-width: clamp(400px, 50vw, 700px);
    backdrop-filter: var(--glass-blur);
}

/* Now Playing Indicator */
.now-playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.dot {
    width: 3px;
    height: 6px;
    background: var(--accent);
    border-radius: 1px;
    animation: wave 1.2s ease-in-out infinite;
}

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

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

@keyframes wave {

    0%,
    100% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(2);
    }
}

/* Book Indicator */
.book-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bookmark {
    width: 4px;
    height: 20px;
    background: var(--accent);
    border-radius: 1px;
}

/* Widget Images */
.widget-image {
    width: clamp(45px, 5vw, 60px);
    height: clamp(45px, 5vw, 60px);
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--card-bg);
}

.widget-image.book-cover {
    width: clamp(34px, 3.5vw, 45px);
    height: clamp(51px, 5.25vw, 67px);
    border-radius: 0.25rem;
}

/* Widget Info */
.widget-info {
    flex: 1;
    min-width: 0;
}

.widget-main-text {
    color: var(--text-primary);
    font-size: clamp(0.85rem, 1vw, 1rem);
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-sub-text {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tech Tags */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tech-tag {
    background: rgba(115, 115, 115, 0.1);
    color: var(--text-secondary);
    padding: clamp(0.25rem, 0.35vw, 0.35rem) clamp(0.6rem, 0.8vw, 0.8rem);
    border-radius: 0.5rem;
    font-size: clamp(0.7rem, 0.8vw, 0.8rem);
    border: none;
    font-weight: 500;
}

/* ===========================================
   EXPERIENCE SECTION
   =========================================== */
.experience-section {
    padding: clamp(2rem, 4vh, 4rem) 0;
    border-top: 1px solid var(--card-border);
    margin-top: clamp(1.5rem, 3vh, 3rem);
}

.experience-section-header {
    text-align: left;
    margin-bottom: clamp(1.5rem, 3vh, 3rem);
}

.experience-section-header h2 {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 2.5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: clamp(0.5rem, 1vh, 1rem);
}

.experience-section-subtext {
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
}

.experience-list {
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 2.5vh, 2.5rem);
}

.experience-item {
    padding: clamp(1.25rem, 2vw, 2rem);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition);
}

.experience-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(1rem, 2vw, 2rem);
    margin-bottom: clamp(0.75rem, 1.25vh, 1.25rem);
}

.experience-item-left {
    display: flex;
    flex-direction: column;
    gap: clamp(0.15rem, 0.3vh, 0.3rem);
}

.experience-item-left h3 {
    color: var(--text-primary);
    font-size: clamp(1.15rem, 1.35vw, 1.5rem);
    font-weight: 600;
    line-height: 1.3;
}

.experience-role {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 1vw, 1.05rem);
    font-weight: 500;
}


.experience-item-description {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.7;
}

.experience-item-description p {
    margin: 0;
}

.experience-item-tech {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.4rem, 0.6vw, 0.6rem);
    margin-top: clamp(0.75rem, 1.25vh, 1.25rem);
}

/* ===========================================
   PROJECTS SECTION (Inline Expanded View)
   =========================================== */
.projects-section {
    padding: clamp(2rem, 4vh, 4rem) 0;
    border-top: 1px solid var(--card-border);
    margin-top: clamp(1.5rem, 3vh, 3rem);
}

.projects-section-header {
    text-align: left;
    margin-bottom: clamp(2rem, 4vh, 4rem);
}

.projects-section-header h2 {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 2.5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: clamp(0.5rem, 1vh, 1rem);
}

.projects-section-subtext {
    color: var(--text-secondary);
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
}

.projects-list {
    display: flex;
    flex-direction: column;
    gap: clamp(3rem, 5vh, 5rem);
}

.project-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
    padding: clamp(1.5rem, 2vw, 2rem);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition);
}

/* Content first (left), Media second (right) - consistent for all projects */
.project-item-content {
    order: 1;
}

.project-item-media {
    order: 2;
}

.project-item-media {
    display: flex;
    justify-content: center;
    align-items: center;
}

.project-item-media .media-container {
    width: 100%;
    max-width: clamp(400px, 100%, 600px);
    aspect-ratio: 16/9;
    border-radius: clamp(8px, 1vw, 12px);
    overflow: hidden;
    position: relative;
    cursor: default;
    z-index: 1;
    transition: none;
    /* Ensure container defines its own size, decoupled from video intrinsic dimensions */
    background: var(--card-bg);
}

/* Absolutely position video/image to fully fill the container regardless of intrinsic size */
.project-item-media .media-container video,
.project-item-media .media-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* Preserve header at top, crop from bottom if needed */
    border-radius: inherit;
}

/* Project media wrapper - needs relative positioning for the mute button */
.project-item-media {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1.5rem);
    position: relative;
}

/* Inline video mute toggle - to the right of video */
.video-mute-toggle {
    position: absolute;
    left: calc(50% + clamp(100px, 10vw, 150px));
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1.5px solid var(--text-primary);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.video-mute-toggle:hover {
    background: var(--card-hover-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.video-mute-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* Icon styling */
.video-mute-toggle svg {
    width: 1.4rem;
    height: 1.4rem;
    stroke: var(--text-primary);
    fill: none;
}

.video-mute-toggle svg polygon {
    fill: var(--text-primary);
    stroke: var(--text-primary);
}

/* Muted state (default) - show X icon, hide waves icon */
.video-mute-toggle .icon-unmuted {
    display: none;
}

.video-mute-toggle .icon-muted {
    display: block;
}

/* Unmuted state - show waves icon, hide X icon */
.video-mute-toggle.unmuted .icon-unmuted {
    display: block;
}

.video-mute-toggle.unmuted .icon-muted {
    display: none;
}

/* Phone-style projects (serbDictionary, iOS Stem Player) */
.project-item.phone-project .project-item-media .media-container {
    max-width: clamp(180px, 18vw, 260px);
    aspect-ratio: 9/19.5;
    border-radius: clamp(1.5rem, 2vw, 2rem);
}

.project-video-inline,
.project-image-inline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* Preserve header at top, crop from bottom if needed */
    border-radius: inherit;
    opacity: 1 !important; /* Override loading state opacity */
}

.project-item-content {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 1.5vw, 1.5rem);
}

.project-item-content h3 {
    color: var(--text-primary);
    font-size: clamp(1.3rem, 1.6vw, 1.8rem);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.project-app-icon {
    width: clamp(36px, 2.8vw, 48px);
    height: clamp(36px, 2.8vw, 48px);
    border-radius: 22%;
    object-fit: cover;
    flex-shrink: 0;
}

.project-item-description {
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.7;
}

.project-item-description strong {
    color: var(--text-primary);
    font-weight: 600;
}

.project-item-tech {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.4rem, 0.6vw, 0.6rem);
}

.project-item-links {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 0.75vw, 0.75rem);
    margin-top: clamp(0.5rem, 1vh, 1rem);
}

.project-item-links .project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.project-link {
    background: transparent;
    color: var(--text-primary);
    padding: clamp(0.6rem, 0.75vw, 0.75rem) clamp(1rem, 1.5vw, 1.5rem);
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    border: 1.5px solid var(--text-primary);
    backdrop-filter: var(--glass-blur);
}

/* Featured links - App Store, View Website (stand out with blue) */
.project-link-featured {
    background: var(--featured-link-bg);
    color: #FFFFFF;
    border: 1px solid var(--featured-link-bg);
}

/* Mobile: Stack vertically */
@media (max-width: 900px) {
    .project-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .project-item:nth-child(even) {
        direction: ltr;
    }
    
    .project-item-media {
        order: -1;
    }
    
    .project-item-content {
        align-items: center;
    }
    
    .project-item-tech,
    .project-item-links {
        justify-content: center;
    }
    
    .project-item.phone-project .project-item-media .media-container {
        max-width: clamp(200px, 50vw, 280px);
    }
}

/* Fade in media when loaded */
.media-container img,
.media-container video {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.media-container img.loaded,
.media-container video.loaded {
    opacity: 1;
}

/* ===========================================
   HOVER EFFECTS - Desktop only (non-touch)
   =========================================== */
@media (hover: hover) and (pointer: fine) {
    .skills span:hover {
        background: var(--card-hover-bg);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        transform: translateY(-1px);
    }

    .links a:hover {
        background: var(--card-hover-bg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }

    .widget-card:hover {
        background: var(--card-hover-bg);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-1px);
    }





    .project-link:hover {
        background: var(--card-hover-bg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-1px);
    }

    .project-link-featured:hover {
        background: var(--featured-link-hover);
        border-color: var(--featured-link-hover);
        box-shadow: 0 4px 16px rgba(28, 25, 23, 0.25);
        transform: translateY(-1px);
    }

    .cta-button:hover {
        background: var(--card-hover-bg);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }

    
}

/* ===========================================
   DESKTOP PERFECT MODE
   Wider layout, centered content, but now scrollable
   Adjusted to account for Windows scrollbars and 13-inch laptops
   =========================================== */
@media (min-width: 1280px) and (min-height: 700px) {

    html,
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
        scrollbar-gutter: stable both-edges;
    }

    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        max-width: min(1600px, 96vw);
        width: 100%;
        margin: 0 auto;
    }

    .main-content {
        flex: 1;
        overflow: visible;
    }

    .profile-view {
        height: auto;
        overflow-y: visible;
        padding: clamp(2rem, 4vh, 6rem) clamp(2rem, 4vw, 6rem);
    }

    .profile-view.active {
        justify-content: flex-start;
    }
}

/* ===========================================
   TABLET LANDSCAPE ALLOWLIST
   Allows desktop-like layout on landscape tablets, now scrollable
   =========================================== */
@media (min-width: 900px) and (orientation: landscape) and (min-height: 650px) and (max-width: 1279px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        max-width: min(1400px, 96vw);
        width: 100%;
        margin: 0 auto;
    }

    html,
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .main-content {
        flex: 1;
        overflow: visible;
    }

    .profile-view {
        height: auto;
        padding: clamp(1.5rem, 3vw, 3rem);
    }

    .profile-view.active {
        justify-content: flex-start;
    }
}

/* ===========================================
   RESPONSIVE/MOBILE MODE
   Scrollable stacked layout
   =========================================== */
@media (max-width: 1279px),
(max-height: 699px) {

    /* Ensure scrollable */
    body {
        overflow: auto;
        height: auto;
    }

    /* Mobile/portrait specific adjustments */
    @media (max-width: 768px) {
        .profile-header {
            flex-direction: column;
            align-items: flex-start;
        }
    }
}

/* ===========================================
   SMALL MOBILE - Performance optimizations
   =========================================== */
@media (max-width: 480px) {
    :root {
        --accent-glow: rgba(200, 155, 123, 0.15);
        --glass-blur: blur(8px);
    }

    .skills span,
    .tech-tag,
    .widget-card,
    .project-link,
    .links a {
        backdrop-filter: blur(6px);
    }

    .profile-view {
        padding: 1.5rem 1rem;
    }

    .widget-card {
        box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.25);
    }

    
}

/* ===========================================
   REDUCED MOTION
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    :root {
        --transition: none;
        --accent-glow: rgba(200, 155, 123, 0.15);
    }

    .dot {
        animation: none;
    }

    .media-container {
        transition: none;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}
