/* ==========================================================================
   Khethukhanyo Mbekeni | Portfolio
   Fonts: Fraunces (display) and Manrope (text), self-hosted.
   ========================================================================== */

@font-face {
    font-family: "Fraunces";
    src: url("../assets/fonts/fraunces-latin-opsz-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Manrope";
    src: url("../assets/fonts/manrope-latin-wght-normal.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    --bg: #09090a;
    --bg-rgb: 9, 9, 10;
    --surface: #111113;
    --surface-2: #18181b;
    --text: #f1efea;
    --muted: #a19fa8;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.2);
    --gold: #dfb67f;
    --gold-bright: #efcc9c;
    --on-gold: #17120a;
    --header-bg: rgba(9, 9, 10, 0.72);
    --shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.8);

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-text: "Manrope", "Segoe UI", system-ui, sans-serif;

    --gutter: clamp(20px, 5vw, 56px);
    --section-space: clamp(84px, 11vw, 160px);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --header-h: 76px;
}

html[data-theme="light"] {
    --bg: #f3f1ed;
    --bg-rgb: 243, 241, 237;
    --surface: #fbfaf8;
    --surface-2: #eae7e1;
    --text: #17171a;
    --muted: #595962;
    --line: rgba(23, 23, 26, 0.12);
    --line-strong: rgba(23, 23, 26, 0.24);
    --gold: #85592a;
    --gold-bright: #6c4620;
    --on-gold: #ffffff;
    --header-bg: rgba(243, 241, 237, 0.78);
    --shadow: 0 30px 60px -30px rgba(40, 28, 10, 0.35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
    font-family: var(--font-text);
    font-size: 1.0625rem;
    line-height: 1.65;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { list-style: none; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-optical-sizing: auto;
    text-wrap: balance;
}

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

.container { width: min(1240px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: var(--section-space); }

.skip-link {
    position: fixed; left: 16px; top: -60px; z-index: 2000;
    padding: 10px 16px; border-radius: 8px;
    background: var(--gold); color: var(--on-gold); font-weight: 600;
    transition: top 0.2s ease;
}
.skip-link:focus { top: 14px; }

.section-heading { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-title { font-size: clamp(2.4rem, 5.6vw, 4.6rem); letter-spacing: -0.03em; }
.section-intro { margin-top: 22px; font-size: 1.15rem; color: var(--muted); max-width: 56ch; }

/* Theme switch: the whole page cross-fades as one image, so nothing changes out of step. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.5s; animation-timing-function: ease; }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }

/* ---------- Header ---------- */
.header {
    position: fixed; inset: 0 0 auto 0; z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.header.is-scrolled,
.header.menu-open {
    background: var(--header-bg);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom-color: var(--line);
}
.navbar {
    width: min(1240px, 100% - 2 * var(--gutter));
    height: var(--header-h);
    margin-inline: auto;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.logo { width: 56px; height: 56px; flex-shrink: 0; display: grid; place-items: center; transition: transform 0.3s ease; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.logo:hover { transform: scale(1.06); }
html[data-theme="light"] .logo img { filter: brightness(0.66) saturate(1.35); }

.nav-links { display: flex; align-items: center; gap: clamp(18px, 2.6vw, 40px); }
.nav-links a {
    position: relative; display: block; padding: 8px 0;
    font-size: 0.95rem; font-weight: 500; color: var(--muted);
    transition: color 0.2s ease;
}
.nav-links a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px;
    background: var(--gold); border-radius: 2px;
    transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after, .nav-links a:hover::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
    width: 44px; height: 44px; display: grid; place-items: center;
    border: 1px solid var(--line-strong); border-radius: 50%;
    background: transparent; color: var(--gold);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--gold); background: var(--surface); }
.theme-toggle svg { width: 20px; height: 20px; }
.moon-icon { display: none; }
html[data-theme="light"] .sun-icon { display: none; }
html[data-theme="light"] .moon-icon { display: block; }

.cv-button {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px;
    border-radius: 999px; background: var(--gold); color: var(--on-gold);
    font-size: 0.92rem; font-weight: 650; white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.cv-button:hover { background: var(--gold-bright); transform: translateY(-1px); }

.menu-toggle {
    display: none; width: 44px; height: 44px; position: relative;
    border: 1px solid var(--line-strong); border-radius: 50%; background: transparent;
}
.menu-toggle span {
    position: absolute; left: 13px; right: 13px; height: 2px; border-radius: 2px;
    background: var(--text); transition: transform 0.25s ease, top 0.25s ease;
}
.menu-toggle span:nth-child(1) { top: 18px; }
.menu-toggle span:nth-child(2) { top: 24px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 54px; padding: 0 30px; border-radius: 999px;
    font-weight: 650; font-size: 1rem; border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: var(--gold-bright); transform: translateY(-2px); }
.btn-secondary { border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

/* ---------- Hero ---------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    display: flex; flex-direction: column; justify-content: center;
    min-height: min(100vh, 1100px); min-height: min(100svh, 1100px);
    padding: calc(var(--header-h) + clamp(28px, 5vw, 64px)) var(--gutter) clamp(40px, 5vw, 64px);

    /* Blur behaviour, shared by every screen size. --blur-dir points toward the text. */
    --blur-dir: to left;
    --blur-start: 50%;
    /* On very wide or zoomed-out screens the portrait stays beside the text, not at the far edge. */
    --frame: max(0px, calc((100% - 1440px) / 2));
}

/* The portrait is a background layer on the right, so the name sits in front of it. */
.hero-photo {
    position: absolute; z-index: 0; inset: 0 var(--frame) 0 auto; width: min(64%, 922px);
    overflow: hidden; pointer-events: none; background: transparent;
}
.hero-photo img {
    position: absolute; right: -3%; top: -11%; width: auto; max-width: none;
    height: 120%; min-height: 0; object-fit: contain;
    /* The photo's own black background dissolves into the page on every side. */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%),
                        linear-gradient(to bottom, transparent 0%, #000 14%, #000 66%, transparent 92%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0%, #000 22%),
                linear-gradient(to bottom, transparent 0%, #000 14%, #000 66%, transparent 92%);
    mask-composite: intersect;
    animation: come-into-focus 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both;
}

/* Progressive blur: five stacked layers. Each one blurs a little more and starts a little
   further toward the text, so the photo goes from crisp to soft with no visible edge. */
.hero-blur { position: absolute; inset: 0; z-index: 1; }
.hero-blur span {
    position: absolute; inset: 0;
    -webkit-backdrop-filter: blur(var(--b)); backdrop-filter: blur(var(--b));
    -webkit-mask-image: linear-gradient(var(--blur-dir), transparent var(--s), #000 calc(var(--s) + 14%));
    mask-image: linear-gradient(var(--blur-dir), transparent var(--s), #000 calc(var(--s) + 14%));
}
.hero-blur span:nth-child(1) { --b: 2px;  --s: calc(var(--blur-start) + 0%); }
.hero-blur span:nth-child(2) { --b: 5px;  --s: calc(var(--blur-start) + 6%); }
.hero-blur span:nth-child(3) { --b: 10px; --s: calc(var(--blur-start) + 12%); }
.hero-blur span:nth-child(4) { --b: 18px; --s: calc(var(--blur-start) + 18%); }
.hero-blur span:nth-child(5) { --b: 30px; --s: calc(var(--blur-start) + 24%); }

/* A soft wash of the page colour toward the text keeps the words readable on any theme. */
.hero-fade {
    position: absolute; inset: 0; z-index: 2;
    background:
        linear-gradient(var(--blur-dir),
            rgba(var(--bg-rgb), 0) calc(var(--blur-start) - 8%),
            rgba(var(--bg-rgb), 0.55) calc(var(--blur-start) + 14%),
            rgba(var(--bg-rgb), 0.94) calc(var(--blur-start) + 30%),
            var(--bg) 100%),
        linear-gradient(to bottom, var(--bg) 0%, rgba(var(--bg-rgb), 0.9) 8%, rgba(var(--bg-rgb), 0) 22%),
        linear-gradient(to top, var(--bg) 0%, var(--bg) 12%, rgba(var(--bg-rgb), 0) 38%);
}

/* A pool of warm light behind the face, matching the photo's lighting. */
.hero::before {
    content: ""; position: absolute; z-index: 0; right: calc(var(--frame) - 6%); top: 0;
    width: min(780px, 90vw); aspect-ratio: 1; pointer-events: none;
    background: radial-gradient(closest-side, rgba(223, 182, 127, 0.15), transparent 72%);
}
html[data-theme="light"] .hero::before { background: radial-gradient(closest-side, rgba(133, 89, 42, 0.12), transparent 72%); }

.hero-grid { position: relative; z-index: 3; width: min(1240px, 100%); margin-inline: auto; }
.hero-content { max-width: min(760px, 62%); }
.hero-content h1 {
    font-size: clamp(2.8rem, 7.2vw, 6.8rem);
    font-weight: 600; line-height: 1; letter-spacing: -0.035em; text-wrap: initial;
}
.hero-role {
    margin-top: clamp(22px, 3vw, 34px);
    font-family: var(--font-display); font-size: clamp(1.2rem, 2.1vw, 1.7rem);
    font-weight: 500; letter-spacing: -0.005em; color: var(--gold);
}
.hero-description { margin-top: 18px; max-width: 48ch; font-size: 1.18rem; color: var(--text); opacity: 0.82; }
.hero-buttons { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 14px; }
.hero-socials { margin-top: 34px; display: flex; gap: 12px; }
.hero-socials a {
    width: 48px; height: 48px; display: grid; place-items: center;
    border: 1px solid var(--line-strong); border-radius: 50%; color: var(--text);
    background: rgba(var(--bg-rgb), 0.35); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.hero-socials a:hover { color: var(--gold); border-color: var(--gold); transform: translateY(-2px); }
.hero-socials svg { width: 21px; height: 21px; }

.hero-facts {
    position: relative; z-index: 3;
    width: min(1240px, 100%); margin: clamp(48px, 7vw, 96px) auto 0;
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line-strong);
}
.hero-facts > div { padding: 26px 28px 4px 0; }
.hero-facts > div + div { padding-left: 28px; border-left: 1px solid var(--line); }
.hero-facts dt { font-size: 0.92rem; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
.hero-facts dd { color: var(--muted); font-size: 1rem; line-height: 1.5; max-width: 34ch; }

/* The one orchestrated moment: the text arrives in sequence and the portrait pulls into focus. */
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes come-into-focus {
    from { opacity: 0; filter: blur(26px); transform: scale(1.06); }
    to   { opacity: 1; filter: blur(0);    transform: none; }
}
.hero-in { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 80ms); }


/* ---------- About ---------- */
.about-section { border-top: 1px solid var(--line); }
.about-grid {
    display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: clamp(32px, 6vw, 96px); align-items: start;
}
.about-grid .section-title { position: sticky; top: calc(var(--header-h) + 28px); }
.about-copy { display: grid; gap: 22px; color: var(--muted); max-width: 62ch; }
.about-copy .lead {
    font-family: var(--font-text); font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    line-height: 1.4; letter-spacing: -0.01em; color: var(--text); font-weight: 500;
}

.about-focus {
    margin-top: clamp(56px, 8vw, 104px);
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(28px, 5vw, 72px);
    padding: clamp(28px, 5vw, 64px);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.about-focus h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; color: var(--gold); margin-bottom: 18px; }
.focus-statement {
    font-family: var(--font-display); font-weight: 600;
    font-size: clamp(1.7rem, 3.2vw, 2.7rem); line-height: 1.15; letter-spacing: -0.02em;
    text-wrap: balance;
}
.about-focus-body { display: grid; gap: 18px; align-content: end; color: var(--muted); }

/* Journey */
.journey { margin-top: clamp(56px, 8vw, 104px); }
.journey-intro {
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(28px, 5vw, 72px); align-items: end;
    padding-bottom: clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--line);
}
.journey-intro h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; color: var(--gold); margin-bottom: 18px; }
.journey-tagline {
    font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em;
    font-size: clamp(1.6rem, 2.9vw, 2.4rem); line-height: 1.18; text-wrap: balance;
}
.journey-summary { color: var(--muted); }
.journey-toggle {
    margin-top: 24px; display: inline-flex; align-items: center; gap: 12px;
    min-height: 52px; padding: 0 12px 0 26px; border-radius: 999px;
    border: 1px solid var(--line-strong); background: transparent; font-weight: 650;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.journey-toggle:hover { border-color: var(--gold); background: var(--surface); }
.journey-chevron {
    width: 34px; height: 34px; padding: 7px; border-radius: 50%;
    background: var(--gold); color: var(--on-gold); transition: transform 0.35s ease;
}
.journey-toggle[aria-expanded="true"] .journey-chevron { transform: rotate(180deg); }

.journey-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); }
.journey-content[aria-hidden="false"] { grid-template-rows: 1fr; }
.journey-content-inner {
    min-height: 0; overflow: hidden; overflow: clip; /* clip keeps the sticky quote working */
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(28px, 5vw, 72px); align-items: start;
}

.journey-timeline {
    --progress: 0;
    position: relative; margin: clamp(36px, 5vw, 64px) 0 0;
    padding-left: clamp(34px, 6vw, 64px);
}
.journey-timeline::before, .journey-timeline::after {
    content: ""; position: absolute; left: 7px; top: 8px; width: 2px; border-radius: 2px;
}
.journey-timeline::before { bottom: 8px; background: var(--line-strong); }
.journey-timeline::after { height: calc((100% - 16px) * var(--progress)); background: var(--gold); }

.journey-item { position: relative; padding-bottom: clamp(30px, 4vw, 46px); }
.journey-item:last-child { padding-bottom: 0; }
.journey-item::before {
    content: ""; position: absolute; left: calc(-1 * clamp(34px, 6vw, 64px) + 1px); top: 7px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg); border: 2px solid var(--line-strong);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.journey-item.is-reached::before { border-color: var(--gold); }
.journey-milestone.is-reached::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(223, 182, 127, 0.2); }
.journey-date { display: block; font-family: var(--font-display); font-weight: 600; color: var(--gold); font-size: 1rem; margin-bottom: 4px; }
.journey-item h4 { font-size: clamp(1.4rem, 2.3vw, 1.85rem); margin-bottom: 10px; }
.journey-item p { color: var(--muted); max-width: 62ch; }
.journey-item strong { color: var(--text); font-weight: 650; }

.journey-quote {
    position: sticky; top: calc(var(--header-h) + 40px);
    margin: clamp(36px, 5vw, 64px) 0 0;
    font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em;
    font-size: clamp(1.55rem, 2.7vw, 2.3rem); line-height: 1.2; text-wrap: balance;
}

/* ---------- Skills ---------- */
.skills-section { background: var(--surface); border-block: 1px solid var(--line); }
.skills-grid {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto auto; gap: 20px;
}
.skills-card {
    padding: clamp(24px, 3vw, 36px);
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.skills-card-main { grid-row: 1 / span 2; display: flex; flex-direction: column; }
.skills-card-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.skills-card-heading h3 { font-size: 1.4rem; letter-spacing: -0.01em; }
.skills-card-heading p { color: var(--muted); font-size: 0.97rem; margin-top: 2px; }
.skills-category-icon {
    width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center;
    border-radius: 14px; border: 1px solid var(--line-strong); color: var(--gold);
}
.skills-category-icon svg { width: 24px; height: 24px; }

.skills-list { display: flex; flex-wrap: wrap; gap: 10px; }
.skills-list li {
    display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px 9px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
    font-weight: 550; font-size: 0.97rem;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.skills-list li:hover { border-color: var(--gold); transform: translateY(-2px); }
.skill-logo { width: 24px; height: 24px; flex-shrink: 0; }
html[data-theme="light"] .skill-logo-github { filter: brightness(0) opacity(0.85); }

.skills-list-large { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; align-content: start; }
.skills-list-large li {
    flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 22px;
    padding: 18px 20px; border-radius: var(--radius-md); font-size: 1.05rem; font-family: var(--font-text); font-weight: 650; letter-spacing: 0;
}
.skills-list-large .skill-logo { width: 40px; height: 40px; }
.skills-list-large li:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---------- Projects ---------- */
.projects-list { display: grid; gap: clamp(28px, 4vw, 48px); }
.project {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.project-mobile { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.project-mobile .project-media { order: -1; }

.project-media {
    position: relative; display: grid; place-items: center; min-height: 440px;
    padding: clamp(28px, 4vw, 56px); overflow: hidden;
}
/* Each project's panel takes the colour of its own product. */
.project-web .project-media { background: linear-gradient(160deg, #0f4646 0%, #072a2a 100%); }
.project-mobile .project-media { background: linear-gradient(160deg, #11203a 0%, #070d18 100%); padding-bottom: 0; align-items: end; }

.browser-frame {
    position: relative; width: 100%; padding: 0; text-align: left; overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px; background: #0a2e2e;
    box-shadow: 0 40px 70px -30px rgba(0, 0, 0, 0.7);
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.browser-frame:hover { transform: translateY(-6px); }
.browser-bar { display: flex; align-items: center; gap: 14px; padding: 11px 14px; background: rgba(0, 0, 0, 0.28); }
.browser-dots { display: flex; gap: 6px; }
.browser-dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.28); }
.browser-url {
    flex: 1; max-width: 320px; padding: 3px 12px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.09); color: rgba(255, 255, 255, 0.7); font-size: 0.8rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.browser-frame img { width: 100%; }

.phones { display: flex; align-items: flex-end; justify-content: center; gap: clamp(10px, 1.6vw, 18px); width: 100%; }
.phone {
    flex: 0 1 clamp(112px, 15vw, 172px); padding: 0; aspect-ratio: 946 / 2048;
    border: 5px solid #1d2635; border-bottom: 0; border-radius: 26px 26px 0 0; overflow: hidden; background: #0a1322;
    box-shadow: 0 30px 50px -24px rgba(0, 0, 0, 0.8);
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.phone:nth-child(1) { transform: translateY(54px); }
.phone:nth-child(2) { flex-basis: clamp(124px, 17vw, 192px); }
.phone:nth-child(3) { transform: translateY(54px); }
.phone:nth-child(2):hover { transform: translateY(-8px); }
.phone:nth-child(1):hover, .phone:nth-child(3):hover { transform: translateY(44px); }

.media-hint {
    position: absolute; right: 18px; bottom: 18px; padding: 7px 14px; border-radius: 999px;
    background: rgba(0, 0, 0, 0.55); color: #f1efea; font-size: 0.85rem; font-weight: 550;
    backdrop-filter: blur(8px); opacity: 0; transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease; pointer-events: none;
}
.browser-frame:hover .media-hint, .browser-frame:focus-visible .media-hint { opacity: 1; transform: none; }
.media-hint-static { opacity: 1; transform: none; top: 18px; bottom: auto; left: 18px; right: auto; }

.project-body { padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; justify-content: center; }
.project-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.project-kind { color: var(--muted); font-size: 0.98rem; font-weight: 550; }
.project-status {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 12px;
    border-radius: 999px; border: 1px solid var(--line-strong); font-size: 0.86rem; font-weight: 600;
}
.project-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.project-status-done { color: #5fc58b; }
html[data-theme="light"] .project-status-done { color: #1d7a45; }
.project-status-progress { color: var(--gold); }
.project-body h3 { font-size: clamp(2.3rem, 4.4vw, 3.7rem); letter-spacing: -0.03em; margin-bottom: 20px; }
.project-description { color: var(--muted); }
.project-role { margin-top: 16px; color: var(--muted); }
.project-role strong { color: var(--text); font-weight: 650; }
.project-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.project-tags span { padding: 5px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.88rem; font-weight: 550; }
.project-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.project-action {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 24px;
    border-radius: 999px; font-weight: 650; font-size: 0.97rem; border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.project-action svg { width: 17px; height: 17px; }
.project-action-primary { background: var(--gold); color: var(--on-gold); }
.project-action-primary:hover { background: var(--gold-bright); transform: translateY(-2px); }
.project-action-secondary { border-color: var(--line-strong); }
.project-action-secondary:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }
.project-action-unavailable { border-color: var(--line); color: var(--muted); border-style: dashed; cursor: default; }

/* Screenshot viewer */
.project-lightbox {
    width: min(1100px, 94vw); max-height: 94vh; margin: auto; padding: 0; overflow: hidden;
    border: 1px solid var(--line-strong); border-radius: var(--radius-md);
    background: var(--surface); color: var(--text);
}
.project-lightbox::backdrop { background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(6px); }
.project-lightbox-panel { display: flex; flex-direction: column; max-height: 94vh; }
.project-lightbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.project-lightbox-toolbar p { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.project-lightbox-close { padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-size: 0.9rem; font-weight: 600; }
.project-lightbox-close:hover { border-color: var(--gold); color: var(--gold); }
.project-lightbox-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 64px; background: var(--bg); }
.project-lightbox-stage img { max-width: 100%; max-height: calc(94vh - 160px); width: auto; height: auto; object-fit: contain; border-radius: 10px; }
.project-lightbox-nav {
    position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--line-strong); background: var(--surface); font-size: 1.6rem; line-height: 1; padding-bottom: 4px;
}
.project-lightbox-nav:hover { border-color: var(--gold); color: var(--gold); }
#project-lightbox-prev { left: 12px; }
#project-lightbox-next { right: 12px; }
.project-lightbox-nav[hidden] { display: none; }
.project-lightbox-caption { padding: 12px 18px 16px; text-align: center; color: var(--muted); font-size: 0.93rem; border-top: 1px solid var(--line); }

/* ---------- Contact ---------- */
.contact-section { border-top: 1px solid var(--line); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.contact-details h3, .contact-form h3 { font-size: clamp(1.5rem, 2.5vw, 2.1rem); letter-spacing: -0.02em; margin-bottom: 14px; }
.contact-details > p { color: var(--muted); max-width: 46ch; }
.contact-methods { margin-top: 36px; border-top: 1px solid var(--line); }
.contact-methods li { display: flex; align-items: center; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.contact-method-icon { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--gold); }
.contact-method-icon svg { width: 20px; height: 20px; }
.contact-method-label { display: block; font-size: 0.88rem; color: var(--muted); }
.contact-methods a, .contact-location { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.contact-methods a { transition: color 0.2s ease; }
.contact-methods a:hover { color: var(--gold); }

.contact-form { padding: clamp(24px, 4vw, 48px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); display: grid; gap: 18px; }
.contact-form h3 { margin-bottom: 0; }
.contact-form-intro { color: var(--muted); margin-top: -6px; }
.contact-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.contact-field { display: grid; gap: 8px; }
.contact-field label { font-size: 0.92rem; font-weight: 600; }
.contact-field input, .contact-field textarea {
    width: 100%; padding: 14px 16px; font: inherit; font-size: 1rem; color: var(--text);
    background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.contact-field textarea { resize: vertical; min-height: 150px; }
.contact-field input::placeholder, .contact-field textarea::placeholder { color: var(--muted); opacity: 0.7; }
.contact-field input:focus, .contact-field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(223, 182, 127, 0.25); }
.contact-submit {
    min-height: 56px; border: 0; border-radius: 999px; background: var(--gold); color: var(--on-gold);
    font-weight: 700; font-size: 1.02rem; transition: background-color 0.2s ease, transform 0.2s ease;
}
.contact-submit:hover { background: var(--gold-bright); transform: translateY(-2px); }
.contact-form-note { color: var(--muted); font-size: 0.9rem; margin-top: -6px; }
.contact-form-status { color: var(--gold); font-weight: 600; font-size: 0.95rem; min-height: 1.2em; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 32px; color: var(--muted); font-size: 0.95rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-top { font-weight: 600; color: var(--text); transition: color 0.2s ease; }
.footer-top:hover { color: var(--gold); }

/* ---------- Responsive ---------- */
@media (min-width: 1500px) {
    .hero-photo img {
        right: 0;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 88%, transparent 100%),
                            linear-gradient(to bottom, transparent 0%, #000 14%, #000 66%, transparent 92%);
        mask-image: linear-gradient(to right, transparent 0%, #000 22%, #000 88%, transparent 100%),
                    linear-gradient(to bottom, transparent 0%, #000 14%, #000 66%, transparent 92%);
    }
}
@media (max-width: 1000px) {
    .menu-toggle { display: inline-block; }
    .nav-links {
        position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
        padding: 8px var(--gutter) 24px; background: var(--bg); border-bottom: 1px solid var(--line);
        transform: translateY(-12px); opacity: 0; visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    }
    .header.menu-open .nav-links { opacity: 1; transform: none; visibility: visible; }
    .nav-links a { padding: 16px 0; font-size: 1.25rem; font-family: var(--font-display); border-bottom: 1px solid var(--line); }
    .nav-links a::after { display: none; }

    .hero {
        --blur-dir: to bottom;
        --blur-start: 56%;
        justify-content: flex-start;
        padding-top: min(98vw, 640px);
    }
    .hero::before { right: -30%; top: 0; width: 120vw; }
    .hero-photo { inset: 0 0 auto 0; width: 100%; height: min(132vw, 860px); }
    .hero-photo img { right: auto; left: 50%; translate: -50% 0; top: 0; height: 100%; min-height: 0; width: auto; max-width: 118%; object-fit: cover; object-position: 50% 8%;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 16%, #000 84%, transparent 100%), linear-gradient(to bottom, #000 78%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, #000 16%, #000 84%, transparent 100%), linear-gradient(to bottom, #000 78%, transparent 100%);
        -webkit-mask-composite: source-in; mask-composite: intersect; }
    .hero-content { max-width: none; }
    .hero-content h1 { font-size: clamp(2.4rem, 12.5vw, 5.2rem); }
    .hero-fade {
        background:
            linear-gradient(to bottom,
                rgba(var(--bg-rgb), 0) calc(var(--blur-start) - 6%),
                rgba(var(--bg-rgb), 0.6) calc(var(--blur-start) + 18%),
                rgba(var(--bg-rgb), 0.95) calc(var(--blur-start) + 34%),
                var(--bg) 100%),
            linear-gradient(to bottom, var(--bg) 0%, rgba(var(--bg-rgb), 0.9) 7%, rgba(var(--bg-rgb), 0) 18%);
    }
    .hero-facts { grid-template-columns: 1fr; }
    .hero-facts > div, .hero-facts > div + div { padding: 22px 0; border-left: 0; border-bottom: 1px solid var(--line); }
    .hero-facts dd { max-width: none; }

    .about-grid, .about-focus, .journey-intro, .journey-content-inner, .contact-grid { grid-template-columns: 1fr; }
    .journey-quote { position: static; margin-top: clamp(36px, 6vw, 56px); }
    .about-grid .section-title { position: static; }
    .about-focus-body { align-content: start; }
    .skills-grid { grid-template-columns: 1fr; }
    .skills-card-main { grid-row: auto; }

    .project, .project-mobile { grid-template-columns: 1fr; }
    .project-mobile .project-media { order: 0; }
    .project-media { min-height: 0; }
    .project-mobile .project-media { padding-top: 76px; }
}

@media (max-width: 640px) {
    :root { --header-h: 68px; }
    .logo { width: 48px; height: 48px; }
    .cv-button { padding: 0 16px; font-size: 0.85rem; }
    .contact-form-row { grid-template-columns: 1fr; }
    .btn { flex: 1 1 100%; }
    .skills-list-large { grid-template-columns: 1fr 1fr; }
    .project-lightbox-stage { padding: 12px 12px 64px; }
    #project-lightbox-prev { left: calc(50% - 56px); top: auto; bottom: 10px; translate: none; }
    #project-lightbox-next { right: calc(50% - 56px); top: auto; bottom: 10px; translate: none; }
    .phone:nth-child(1), .phone:nth-child(3) { transform: translateY(36px); }
}
@media (max-width: 380px) {
    .cv-button { display: none; }
}

@media (hover: none) {
    .browser-frame .media-hint { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
