/* ==============================
   CSS RESET & VARIABLES
   ============================== */
:root {
    --bg-color: #ffffff;
    --text-primary: #111111;
    --text-secondary: #555555;
    --surface: #f9f9f9;
    --surface-hover: #f1f1f1;
    --border: #e0e0e0;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --transition-fast: 0.2s ease;
    --transition-smooth: 0.6s cubic-bezier(0.16, 1, 0.3, 1);

    --nav-height: 4.5rem;
    --radius: 8px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 1rem);
    font-size: 14px; /* Scaled down base font size for overall smaller text */
}

/* Scroll lock while the fullscreen player is open */
html.modal-open,
html.modal-open body {
    overflow: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    color: var(--text-primary);
    font-weight: 800; /* Bold Inter */
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

a {
    text-decoration: none;
    color: var(--text-primary);
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.6;
}

img {
    display: block;
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
    border-radius: 2px;
}

.navbar :focus-visible,
.video-modal :focus-visible {
    outline-color: #ffffff;
}

/* Keyboard-only shortcut past the navigation */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 200;
    padding: 0.75rem 1.25rem;
    background: var(--text-primary);
    color: var(--bg-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 1rem;
    opacity: 1;
}

/* ==============================
   NAVIGATION & LANGUAGE TOGGLE
   ============================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 0.85rem 5vw; /* Shorter vertical size */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    z-index: 100;

    /* A darker 'Soft Aura' gradient for legible white text */
    background: linear-gradient(-45deg, #b5887a, #8b6aaa, #7a9faa, #c47a60, #b5887a);
    background-size: 400% 400%;
    animation: gradientFlow 45s ease infinite;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: padding var(--transition-smooth), box-shadow var(--transition-smooth);
    will-change: background-position;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.navbar.scrolled {
    padding: 0.5rem 5vw; /* Even tighter when scrolling down */
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

/* Force text inside the gradient navbar to be stark white */
.logo {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
    line-height: 0.9;
}

.logo:hover {
    opacity: 0.85;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 3rem;
}

.nav-links a {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
}

.nav-links a:hover {
    opacity: 1;
}

/* Language switch */
.lang-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    padding-left: 1.5rem;
}

.lang-toggle button {
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.4;
    padding: 0.25rem;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.lang-toggle button:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.lang-toggle button.active {
    opacity: 1;
    transform: scale(1.1);
}

/* Hide the navbar cleanly while the video is open */
html.modal-open .navbar {
    opacity: 0;
    pointer-events: none;
}

/* ==============================
   HERO SECTION
   ============================== */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: var(--nav-height) 5vw 0;
}

.hero-content {
    max-width: 900px;
    margin-top: 2rem;
}

.hero-title {
    font-size: clamp(3.5rem, 7vw, 6.5rem);
    margin-bottom: 1.5rem;
}

#hero-dynamic-text {
    transition: opacity 0.6s ease, transform 0.6s ease;
    display: inline-block;
}

#hero-dynamic-text.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

#hero-dynamic-text.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    max-width: 550px;
    font-weight: 400;
    color: var(--text-secondary);
    text-wrap: pretty;
}

/* ==============================
   BUTTONS
   ============================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    background-color: var(--text-primary);
    color: var(--bg-color);
    border: 1px solid var(--text-primary);
    border-radius: 4px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

/* ==============================
   LAYOUT & SECTIONS
   ============================== */
.section {
    padding: 3.5rem 5vw;
    border-top: 1px solid var(--border);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
}

/* ==============================
   WORK / PORTFOLIO SECTION
   ============================== */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.portfolio-item {
    display: block;
    position: relative;
    opacity: 1;
}

.portfolio-item:hover {
    opacity: 1;
}

/* The newest piece runs the full width of the grid */
.portfolio-item--featured {
    grid-column: 1 / -1;
}

.portfolio-item--featured .portfolio-info h3 {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

.portfolio-item--featured .portfolio-info p {
    font-size: 1.05rem;
    max-width: 62ch;
}

.portfolio-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background-color: var(--surface);
    border-radius: var(--radius);
}

.portfolio-item.placeholder-vertical .portfolio-image {
    aspect-ratio: 9 / 16;
}

.thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.portfolio-item:hover .thumb {
    transform: scale(1.05);
}

.overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.03);
    transition: background-color var(--transition-fast);
    z-index: 1;
}

.portfolio-item:hover .overlay {
    background-color: transparent;
}

/* "New" ribbon on the featured card */
.badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    padding: 0.35rem 0.8rem;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
}

/* Play affordance so the cards read as video */
.play-badge {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    opacity: 0.9;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.play-badge svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
}

.portfolio-item:hover .play-badge {
    transform: scale(1.12);
    background: rgba(0, 0, 0, 0.7);
}

.portfolio-info {
    padding-top: 0.85rem;
}

.portfolio-category {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.portfolio-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.portfolio-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    line-height: 1.6;
    text-wrap: pretty;
}

/* Hover preview player */
.preview-video-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.preview-video-iframe.active {
    opacity: 1;
}

/* Placeholders */
.placeholder-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.06) 100%);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    padding: 2rem;
    text-align: center;
}

.portfolio-item.placeholder-vertical:hover .placeholder-content {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.08) 100%);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.placeholder-icon {
    font-size: 2.5rem;
    font-weight: 200;
    margin-bottom: 0.75rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.portfolio-item.placeholder-vertical:hover .placeholder-icon {
    transform: scale(1.2) rotate(90deg);
}

.placeholder-content span {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==============================
   EXPERTISE SECTION
   ============================== */
.expertise-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.expertise-header .section-title {
    margin-bottom: 0;
}

.expertise-intro {
    font-size: 1.1rem;
    max-width: 500px;
    color: var(--text-secondary);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.skill-card {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius);
    transition: background-color var(--transition-fast);
}

.skill-card:hover {
    background-color: var(--surface-hover);
}

.skill-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.skill-card p {
    font-size: 0.95rem;
}

/* ==============================
   CONTACT SECTION
   ============================== */
.contact-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.contact-wrapper .section-title {
    margin-bottom: 0;
}

.contact-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* ==============================
   FOOTER
   ============================== */
footer {
    padding: 3rem 5vw;
    border-top: 1px solid var(--border);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.social-links {
    display: flex;
    gap: 2rem;
}

.social-links a {
    font-size: 0.9rem;
    font-weight: 500;
}

footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==============================
   SCROLL ANIMATIONS (UTILITIES)
   ============================== */
.has-scrolled .reveal-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.has-scrolled .reveal-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.has-scrolled .reveal-fade {
    opacity: 0;
    transition: opacity 1s ease-out;
}

.has-scrolled .reveal-fade.is-visible {
    opacity: 1;
}

body:not(.has-scrolled) .reveal-up,
body:not(.has-scrolled) .reveal-fade,
body:not(.has-scrolled) .reveal-text {
    animation: fadeUpOnLoad 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUpOnLoad {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ==============================
   VIDEO MODAL (FULL VIEWPORT)
   ============================== */
.video-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.video-modal.active {
    opacity: 1;
    pointer-events: all;
}

/*
   The player is sized to fill the viewport at 16:9. YouTube picks its stream
   from the rendered player size, so the bigger this is, the higher the
   resolution it serves.
*/
.video-container {
    width: min(100vw, calc(100dvh * 16 / 9));
    aspect-ratio: 16 / 9;
    max-height: 100dvh;
    position: relative;
    background: #000;
    overflow: hidden;
}

.video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-overlay-click {
    position: absolute;
    inset: 0;
    z-index: 5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-play-pause-indicator {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 6;
}

.video-play-pause-indicator.flash {
    animation: indicatorFlash 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes indicatorFlash {
    0% { opacity: 0; transform: scale(0.6); }
    40% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.2); }
}

.indicator-icon {
    width: 28px;
    height: 28px;
    display: none;
}

.video-play-pause-indicator.playing .pause-icon,
.video-play-pause-indicator.paused .play-icon {
    display: block;
}

.close-modal {
    position: absolute;
    top: 2rem;
    left: 5vw;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: color var(--transition-fast), transform var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10000;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.close-modal:hover {
    color: #ffffff;
    transform: translateX(-4px);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media screen and (max-width: 900px) {
    .nav-right { gap: 1.5rem; }
    .nav-links { gap: 1.5rem; }
    .lang-toggle { padding-left: 1rem; }
}

@media screen and (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-item--featured {
        grid-column: auto;
    }

    .logo { font-size: 1.15rem; }

    .nav-right { gap: 1rem; }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a { font-size: 0.85rem; }

    .lang-toggle {
        padding-left: 0.75rem;
        gap: 0.25rem;
    }

    .lang-toggle button { font-size: 0.8rem; }

    .hero-title {
        font-size: 3rem;
    }

    .contact-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .close-modal {
        top: 1rem;
        left: 1rem;
    }
}

@media screen and (max-width: 420px) {
    .nav-links li:nth-child(2) { display: none; }
}

/* ==============================
   REDUCED MOTION
   ============================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .navbar { animation: none; background-position: 50% 50%; }

    .portfolio-item:hover .thumb { transform: none; }
}
