:root {
    --bg: #f3f4f6;
    --bg-soft: rgba(243, 244, 246, 0.78);
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: rgba(255, 255, 255, 0.94);
    --ink: #111827;
    --muted: #4b5563;
    --line: rgba(17, 24, 39, 0.12);
    --accent: #4b5563;
    --accent-dark: #111827;
    --teal: #6b7280;
    --teal-soft: rgba(75, 85, 99, 0.12);
    --shadow: 0 24px 60px rgba(17, 24, 39, 0.1);
    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --max-width: 1180px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6.7rem;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Syne", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(107, 114, 128, 0.12), transparent 34%),
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.55), transparent 28%),
        linear-gradient(180deg, #f8f9fb 0%, #f3f4f6 55%, #eceff3 100%);
    position: relative;
    overflow-x: hidden;
    max-width: 100%;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(17, 24, 39, 0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 24, 39, 0.028) 1px, transparent 1px);
    background-size: 46px 46px;
    pointer-events: none;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 100%);
}

.page-noise {
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.25), transparent 18%),
        radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.2), transparent 16%),
        radial-gradient(circle at 50% 90%, rgba(0, 0, 0, 0.03), transparent 28%);
    pointer-events: none;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 1rem auto 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.2rem;
    position: sticky;
    top: 0.7rem;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 999px;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
    transition: border-radius 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #111827, #6b7280);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.brand-copy {
    display: grid;
    gap: 0.12rem;
}

.brand-title,
.brand-subtitle,
.eyebrow,
.timeline-meta,
.toolbar-link,
.project-tag,
.spotlight-label,
.panel-label,
.signal-kicker,
.hero-meta,
.contact-list,
.cv-label,
.brand-subtitle {
    font-family: "Space Mono", monospace;
}

.brand-title {
    font-size: 0.82rem;
    letter-spacing: 0.14em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.3rem;
    color: var(--muted);
}

.nav a {
    position: relative;
    padding-bottom: 0.32rem;
    font-size: 0.9rem;
    transition: color 180ms ease, transform 180ms ease;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5px;
    background: linear-gradient(90deg, #111827, rgba(75, 85, 99, 0.45));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 220ms ease;
}

.nav a:hover,
.nav a:focus-visible {
    color: var(--ink);
    transform: translateY(-1px);
}

.nav a.is-current {
    color: var(--ink);
}

.nav a:hover::after,
.nav a:focus-visible::after,
.nav a.is-current::after {
    transform: scaleX(1);
}

.nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    padding: 0.6rem;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--ink);
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle span + span {
    margin-top: 0.33rem;
}

main {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 2rem auto 0;
    padding-bottom: 4rem;
}

main,
.section,
.hero,
.projects-layout,
.projects-grid,
.stack-grid,
.cv-gallery,
.intro-cards,
.project-toolbar,
.topbar {
    min-width: 0;
}

.section {
    margin-top: 2rem;
    position: relative;
    padding: 1.2rem;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: visible;
}

main > .section:nth-of-type(4n + 1) {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(236, 239, 243, 0.18));
}

main > .section:nth-of-type(4n + 2) {
    background: linear-gradient(135deg, rgba(239, 242, 246, 0.48), rgba(255, 255, 255, 0.16));
}

main > .section:nth-of-type(4n + 3) {
    background: linear-gradient(135deg, rgba(232, 236, 240, 0.52), rgba(255, 255, 255, 0.12));
}

main > .section:nth-of-type(4n + 4) {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.38), rgba(228, 232, 236, 0.22));
}

.section > * {
    position: relative;
    z-index: 1;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 1.5rem;
    align-items: stretch;
}

.hero-copy,
.hero-panel,
.intro-card,
.timeline-item,
.project-card,
.project-spotlight,
.stack-card,
.cv-card,
.contact-card {
    background: var(--panel);
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.interactive-surface {
    position: relative;
    overflow: hidden;
}

.interactive-surface::after {
    content: "";
    position: absolute;
    inset: -20%;
    background: radial-gradient(
        240px circle at var(--pointer-x, 50%) var(--pointer-y, 50%),
        rgba(255, 255, 255, 0.36),
        transparent 34%
    );
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.interactive-surface.is-glowing::after {
    opacity: 1;
}

.hero-copy {
    padding: clamp(1.8rem, 4vw, 3.2rem);
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    inset: auto -10% -20% auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 114, 128, 0.14), transparent 65%);
    pointer-events: none;
}

.eyebrow {
    margin: 0 0 0.75rem;
    color: var(--accent-dark);
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 0.96;
}

h1 {
    max-width: 9.2ch;
    margin-right: auto;
    font-size: clamp(3rem, 7.3vw, 5.7rem);
    letter-spacing: -0.05em;
    text-wrap: balance;
}

h2 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    letter-spacing: -0.05em;
}

h3 {
    font-size: 1.3rem;
    letter-spacing: -0.04em;
}

.hero-lead,
.section-copy,
.intro-card p,
.timeline-item li,
.project-card p,
.project-spotlight p,
.stack-card p,
.contact-card p {
    color: var(--muted);
    line-height: 1.7;
    font-size: 1rem;
}

.hero-lead {
    max-width: 62ch;
    margin-top: 1.2rem;
}

.hero-actions,
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 1.6rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.2rem;
    padding: 0.9rem 1.2rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        background-color 180ms ease,
        border-color 180ms ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px);
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #111827, #4b5563);
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.18);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(17, 24, 39, 0.12);
}

.hero-meta,
.contact-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.hero-meta li {
    display: inline-flex;
    align-items: center;
    min-height: 2.65rem;
    padding: 0.72rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.contact-list {
    display: grid;
    gap: 0.7rem;
}

.contact-list li {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.hero-panel {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(160deg, rgba(75, 85, 99, 0.12), transparent 44%),
        linear-gradient(340deg, rgba(17, 24, 39, 0.06), transparent 42%);
    pointer-events: none;
}

.panel-label,
.signal-kicker,
.timeline-meta,
.project-tag,
.spotlight-label,
.cv-label {
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.72rem;
}

.signal-box {
    padding: 1.15rem;
    margin-top: 0.85rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(17, 24, 39, 0.08);
    position: relative;
}

.signal-list {
    margin: 0.9rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.8rem;
    color: var(--muted);
    line-height: 1.55;
}

.signal-list strong {
    color: var(--ink);
}

.skills-marquee-shell {
    margin-top: 1rem;
}

.skills-marquee {
    position: relative;
    overflow: hidden;
    padding: 0.2rem 0;
    mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.skills-marquee-track {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: max-content;
    animation: marqueeFlow 34s linear infinite;
}

.skills-marquee:hover .skills-marquee-track,
.skills-marquee:focus-within .skills-marquee-track {
    animation-play-state: paused;
}

.skills-caption {
    margin: 0.8rem 0 0;
    color: var(--muted);
    font-family: "Space Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.hero-chip,
.skill-pill,
.filter-chip,
.spotlight-stack span {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 0.82rem;
    border-radius: 999px;
    font-family: "Space Mono", monospace;
    font-size: 0.77rem;
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.hero-chip,
.skill-pill {
    background: rgba(255, 255, 255, 0.84);
}

.intro-grid,
.stack-grid,
.cv-gallery,
.projects-layout {
    display: grid;
    gap: 1.2rem;
}

.section-heading {
    margin-bottom: 1.2rem;
}

.section-heading .section-copy {
    max-width: 72ch;
    margin-top: 0.8rem;
}

.inline-highlight {
    color: var(--accent-dark);
}

.intro-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.intro-card {
    padding: 1.4rem;
    min-height: 100%;
}

.card-index {
    margin: 0 0 1rem;
    color: var(--accent-dark);
    font-family: "Space Mono", monospace;
    letter-spacing: 0.1em;
    font-size: 0.82rem;
}

.timeline {
    display: grid;
    gap: 1rem;
}

.timeline-item {
    position: relative;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 1.6rem;
    left: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #111827, #6b7280);
    box-shadow: 0 0 0 8px rgba(75, 85, 99, 0.1);
}

.timeline-item::after {
    content: "";
    position: absolute;
    top: 2.2rem;
    bottom: -1rem;
    left: 1.3rem;
    width: 1px;
    background: linear-gradient(180deg, rgba(75, 85, 99, 0.25), transparent 100%);
}

.timeline-item:last-child::after {
    display: none;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
    color: var(--accent-dark);
}

.timeline-item ul {
    margin: 1rem 0 0;
    padding-left: 1.15rem;
    display: grid;
    gap: 0.6rem;
}

.project-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.projects-hint {
    margin: -0.2rem 0 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.68rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(17, 24, 39, 0.08);
    color: var(--muted);
    font-family: "Space Mono", monospace;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

.projects-hint::before {
    content: "";
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #111827, #6b7280);
    box-shadow: 0 0 0 6px rgba(107, 114, 128, 0.1);
    flex-shrink: 0;
}

.project-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.filter-chip {
    position: relative;
    background: rgba(255, 255, 255, 0.78);
    cursor: pointer;
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        background-color 180ms ease,
        color 180ms ease;
}

.filter-chip:hover,
.filter-chip:focus-visible,
.filter-chip.is-active {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #111827, #4b5563);
    color: #ffffff;
    border-color: transparent;
}

.filter-chip.is-active::after {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    margin-left: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

.toolbar-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.8rem;
    padding: 0.72rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(17, 24, 39, 0.08);
    color: var(--accent-dark);
    font-size: 0.8rem;
}

.projects-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    align-items: start;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    perspective: 1200px;
}

.projects-grid.is-refreshing {
    animation: gridRefresh 320ms ease;
}

.project-card {
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    opacity: 0;
    filter: blur(6px);
    transform: translateY(24px) scale(0.98) rotate(var(--card-tilt, 0deg));
    transition:
        transform 200ms ease,
        box-shadow 200ms ease,
        border-color 200ms ease;
}

.project-card.is-ready {
    animation: cardShuffleIn 720ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: var(--card-delay, 0ms);
}

.project-card.is-resting {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1) rotate(0deg);
}

.project-card:hover,
.project-card:focus-visible,
.project-card.is-active {
    transform: translateY(-4px);
    box-shadow: 0 28px 60px rgba(17, 24, 39, 0.16);
    border-color: rgba(75, 85, 99, 0.22);
}

.project-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-card h3 {
    margin-top: 0.75rem;
}

.project-card p {
    margin: 0.85rem 0 0;
}

.project-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.project-card-hint,
.project-card-state {
    font-family: "Space Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.project-card-hint {
    color: var(--muted);
}

.project-card-state {
    color: transparent;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 180ms ease, transform 180ms ease, color 180ms ease, background-color 180ms ease;
}

.project-card.is-active .project-card-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.9rem;
    padding: 0.32rem 0.6rem;
    border-radius: 0.75rem;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.38);
    color: #166534;
    opacity: 1;
    transform: scale(1);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.project-tag {
    color: var(--accent-dark);
}

.project-spotlight {
    padding: 1.5rem;
    position: sticky;
    top: 7.2rem;
    scroll-margin-top: 7.2rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.84));
    transition: transform 280ms ease, box-shadow 280ms ease;
}

.project-spotlight.is-empty {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(243, 244, 246, 0.9));
}

.project-spotlight.is-empty::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.15rem;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.12), rgba(107, 114, 128, 0.06));
    opacity: 0.8;
    pointer-events: none;
}

.project-spotlight.is-refreshing {
    animation: spotlightRefresh 420ms ease;
}

.spotlight-label {
    color: var(--accent-dark);
}

.spotlight-points {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.7rem;
    color: var(--muted);
    line-height: 1.55;
}

.spotlight-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.1rem;
}

.spotlight-stack span {
    background: rgba(229, 231, 235, 0.9);
}

.project-sheet[hidden] {
    display: none;
}

.project-sheet {
    position: fixed;
    inset: 0;
    z-index: 45;
}

.project-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 23, 0.42);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 220ms ease;
}

.project-sheet-dialog {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 0.8rem 1rem calc(1rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -20px 54px rgba(17, 24, 39, 0.18);
    transform: translateY(100%);
    transition: transform 260ms ease;
    max-height: min(82vh, 36rem);
    max-height: min(82dvh, 36rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.project-sheet.is-open .project-sheet-backdrop {
    opacity: 1;
}

.project-sheet.is-open .project-sheet-dialog {
    transform: translateY(0);
}

.project-sheet-handle {
    width: 3.2rem;
    height: 0.32rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.38);
}

.project-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}

.project-sheet-close {
    display: inline-grid;
    place-items: center;
    flex: 0 0 2.6rem;
    aspect-ratio: 1;
    align-self: flex-start;
    width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
    cursor: pointer;
}

.project-sheet-summary,
.project-sheet-points {
    color: var(--muted);
}

.project-sheet-summary {
    margin: 1rem 0 0;
    line-height: 1.65;
}

.project-sheet-points {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.7rem;
    line-height: 1.55;
}

.project-sheet-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

.project-sheet-stack span {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 0.82rem;
    border-radius: 999px;
    font-family: "Space Mono", monospace;
    font-size: 0.77rem;
    background: rgba(229, 231, 235, 0.94);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.stack-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stack-card {
    padding: 1.5rem;
    min-height: 100%;
}

.stack-card p {
    margin: 0.95rem 0 0;
}

.cv-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cv-card {
    padding: 0.9rem;
    display: grid;
    gap: 0.8rem;
    width: 100%;
    border: 0;
    text-align: left;
    cursor: zoom-in;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.cv-label {
    color: var(--accent-dark);
}

.cv-zoom {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.85);
    background: rgba(17, 24, 39, 0.76);
    color: #ffffff;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 1;
}

.cv-zoom svg,
.project-sheet-close svg,
.doc-viewer-close svg,
.doc-nav svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cv-card img {
    border-radius: var(--radius-md);
    box-shadow: 0 18px 45px rgba(17, 24, 39, 0.12);
    transition: transform 240ms ease;
}

.cv-card:hover,
.cv-card:focus-visible {
    transform: translateY(-4px);
}

.cv-card:hover img,
.cv-card:focus-visible img {
    transform: scale(1.02);
}

.cv-card:hover .cv-zoom,
.cv-card:focus-visible .cv-zoom {
    opacity: 1;
    transform: translateY(0);
}

.contact-card {
    padding: clamp(1.5rem, 3vw, 2.4rem);
}

.contact-list {
    margin-top: 1.3rem;
}

.footer {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 0 auto 2rem;
    padding: 1.5rem 0 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.94rem;
}

body.viewer-open {
    overflow: hidden;
}

body.nav-open {
    overflow: hidden;
}

body.project-sheet-open {
    overflow: hidden;
}

.doc-viewer[hidden] {
    display: none;
}

.doc-viewer {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    overflow: hidden;
}

.doc-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 23, 0.78);
    backdrop-filter: blur(14px);
}

.doc-viewer-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 1240px);
    height: min(100%, 940px);
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    margin: 0;
    padding: 1rem;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 30px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.doc-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.doc-viewer-caption {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-family: "Space Mono", monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.doc-viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.doc-viewer-link,
.doc-viewer-close,
.doc-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.1);
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.doc-viewer-link:hover,
.doc-viewer-link:focus-visible,
.doc-viewer-close:hover,
.doc-viewer-close:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.14);
}

.doc-viewer-link {
    min-height: 2.75rem;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    font-family: "Space Mono", monospace;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.doc-viewer-close {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 50%;
}

.doc-viewer-stage {
    position: relative;
    min-height: 0;
    display: grid;
    place-items: stretch;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(243, 244, 246, 0.88), rgba(229, 231, 235, 0.92));
    overflow: hidden;
}

.doc-viewer-scroll {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 3.5rem;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
}

.doc-viewer-image {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: contain;
    filter: drop-shadow(0 22px 44px rgba(17, 24, 39, 0.18));
    transition: width 120ms linear, height 120ms linear, filter 180ms ease;
    user-select: none;
    -webkit-user-drag: none;
}

.doc-viewer.is-zoomed .doc-viewer-image {
    filter: drop-shadow(0 28px 56px rgba(17, 24, 39, 0.22));
}

.doc-viewer.is-zoomed .doc-viewer-scroll {
    cursor: grab;
}

.doc-viewer.is-oversized .doc-viewer-scroll {
    align-items: flex-start;
    justify-content: flex-start;
}

.doc-viewer.is-panning .doc-viewer-scroll {
    cursor: grabbing;
}

.doc-nav {
    position: absolute;
    top: 50%;
    width: 3.15rem;
    height: 3.15rem;
    padding: 0;
    border-radius: 50%;
    transform: translateY(-50%);
}

.doc-nav-prev {
    left: 1rem;
}

.doc-nav-next {
    right: 1rem;
}

.doc-nav:hover,
.doc-nav:focus-visible {
    transform: translateY(calc(-50% - 2px));
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.14);
}

.floating-actions {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 38;
    display: grid;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

.floating-actions.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.floating-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    padding: 0;
    border: 1px solid rgba(17, 24, 39, 0.12);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14);
    backdrop-filter: blur(14px);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.floating-btn:hover,
.floating-btn:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 24px 46px rgba(17, 24, 39, 0.18);
}

.floating-btn svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.floating-btn-whatsapp svg {
    fill: currentColor;
    stroke: none;
}

.floating-ripple {
    position: absolute;
    inset: -0.3rem;
    border-radius: inherit;
    border: 1px solid rgba(17, 24, 39, 0.18);
    animation: whatsappWave 2.8s ease-out infinite;
    pointer-events: none;
}

.floating-btn-whatsapp {
    animation: whatsappBlink 2.6s ease-in-out infinite;
    width: 3.68rem;
    height: 3.68rem;
}

@keyframes marqueeFlow {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes cardShuffleIn {
    from {
        opacity: 0;
        filter: blur(6px);
        transform: translateY(26px) scale(0.975) rotate(var(--card-tilt, 0deg));
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes spotlightRefresh {
    0% {
        transform: translateY(8px);
        box-shadow: 0 18px 36px rgba(17, 24, 39, 0.08);
    }
    100% {
        transform: translateY(0);
        box-shadow: var(--shadow);
    }
}

@keyframes gridRefresh {
    0% {
        opacity: 0.55;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes whatsappWave {
    0% {
        opacity: 0.45;
        transform: scale(0.96);
    }
    70% {
        opacity: 0;
        transform: scale(1.26);
    }
    100% {
        opacity: 0;
        transform: scale(1.32);
    }
}

@keyframes whatsappBlink {
    0%,
    100% {
        box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14);
    }
    50% {
        box-shadow: 0 18px 40px rgba(17, 24, 39, 0.24);
    }
}

.reveal {
    opacity: 1;
    transform: translateY(0);
}

.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 650ms ease,
        transform 650ms ease;
}

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

@media (min-width: 981px) {
    .project-sheet {
        display: none !important;
    }
}

@media (min-width: 761px) {
    .topbar {
        position: fixed;
        top: 0.8rem;
        left: 50%;
        width: min(calc(100% - 2rem), var(--max-width));
        margin: 0;
        transform: translateX(-50%);
        z-index: 40;
    }

    main {
        margin-top: 6.4rem;
    }
}

@media (max-width: 980px) {
    .hero,
    .projects-layout,
    .cv-gallery,
    .intro-cards,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .stack-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-spotlight {
        display: none;
    }

    .doc-viewer-dialog {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }
}

@media (max-width: 760px) {
    html {
        scroll-padding-top: 5.5rem;
    }

    body::before,
    .page-noise {
        display: none;
    }

    .section {
        padding: 0.95rem;
        border-radius: 28px;
    }

    main > .section:nth-of-type(4n + 1) {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.56), rgba(237, 240, 244, 0.32));
    }

    main > .section:nth-of-type(4n + 2) {
        background: linear-gradient(135deg, rgba(233, 237, 241, 0.72), rgba(255, 255, 255, 0.26));
    }

    main > .section:nth-of-type(4n + 3) {
        background: linear-gradient(135deg, rgba(228, 233, 238, 0.76), rgba(255, 255, 255, 0.24));
    }

    main > .section:nth-of-type(4n + 4) {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(230, 234, 239, 0.34));
    }

    .topbar {
        position: fixed;
        top: calc(0.45rem + env(safe-area-inset-top));
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        margin: 0;
        padding: 0.9rem 1rem;
        border-radius: 28px;
        z-index: 40;
        backdrop-filter: none;
    }

    body.nav-open .topbar {
        border-radius: 26px;
        box-shadow: 0 24px 48px rgba(17, 24, 39, 0.12);
    }

    .nav-toggle {
        display: inline-block;
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav {
        position: absolute;
        top: calc(100% + 0.65rem);
        right: 0;
        left: 0;
        display: grid;
        gap: 0.35rem;
        padding: 0.9rem;
        background: rgba(255, 255, 255, 0.96);
        border-radius: 24px;
        border: 1px solid rgba(17, 24, 39, 0.08);
        box-shadow: 0 20px 40px rgba(17, 24, 39, 0.1);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        max-height: min(70vh, 22rem);
        overflow-y: auto;
        transition:
            opacity 180ms ease,
            transform 180ms ease,
            visibility 180ms ease;
    }

    .nav.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav a {
        display: flex;
        align-items: center;
        min-height: 3.15rem;
        padding: 0.85rem 0.9rem;
        border-radius: 18px;
        background: rgba(243, 244, 246, 0.9);
        border: 1px solid rgba(17, 24, 39, 0.06);
    }

    .nav a::after {
        left: 0.9rem;
        right: 0.9rem;
        bottom: 0.72rem;
    }

    .nav a.is-current {
        background: rgba(243, 244, 246, 0.96);
        color: var(--ink);
        border-color: rgba(17, 24, 39, 0.14);
        box-shadow: inset 3px 0 0 rgba(17, 24, 39, 0.9);
    }

    .nav a.is-current::after {
        background: linear-gradient(90deg, #111827, rgba(75, 85, 99, 0.45));
    }

    h1 {
        max-width: none;
    }

    main {
        margin-top: calc(6.35rem + env(safe-area-inset-top));
        padding-bottom: 5rem;
    }

    .section {
        margin-top: 1.5rem;
    }

    .hero-copy,
    .hero-panel,
    .project-card,
    .project-spotlight,
    .stack-card,
    .contact-card,
    .timeline-item,
    .intro-card {
        border-radius: 24px;
        backdrop-filter: none;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .floating-actions {
        right: calc(0.85rem + env(safe-area-inset-right));
        bottom: calc(0.85rem + env(safe-area-inset-bottom));
        z-index: 41;
    }

    .doc-viewer-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .doc-viewer-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.65rem;
    }

    .doc-viewer-link {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    .doc-viewer {
        padding: 0.4rem;
    }

    .doc-nav {
        width: 2.8rem;
        height: 2.8rem;
    }

    .project-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .project-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
        overflow: visible;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .filter-chip {
        width: auto;
        min-height: 2.1rem;
        padding: 0.42rem 0.62rem;
        font-size: 0.62rem;
        letter-spacing: 0.03em;
        flex: 0 0 auto;
        justify-content: center;
        min-width: 0;
        text-align: center;
    }

    .toolbar-link {
        width: 100%;
        justify-content: center;
    }

    .hero-meta li {
        flex: 1 1 calc(50% - 0.65rem);
        justify-content: center;
        text-align: center;
    }

    .hero-meta {
        display: none;
    }

    .project-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .project-card-hint,
    .project-card-state {
        font-size: 0.68rem;
    }

    .project-sheet-dialog {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    h1 {
        max-width: 8.4ch;
        font-size: clamp(2.7rem, 10.2vw, 4.25rem);
        letter-spacing: -0.045em;
        line-height: 0.93;
    }
}

@media (max-width: 540px) {
    body::before {
        background-size: 30px 30px;
    }

    main {
        width: min(calc(100% - 1rem), var(--max-width));
    }

    .topbar {
        right: 0.5rem;
        left: 0.5rem;
    }

    .brand {
        align-items: flex-start;
        max-width: calc(100% - 3.5rem);
    }

    .brand-title {
        font-size: 0.68rem;
        letter-spacing: 0.08em;
    }

    .brand-subtitle {
        max-width: 18rem;
        font-size: 0.56rem;
        line-height: 1.35;
        letter-spacing: 0.03em;
    }

    h1 {
        max-width: 8.2ch;
        font-size: clamp(2.45rem, 11vw, 3.55rem);
        letter-spacing: -0.04em;
    }

    .hero-actions,
    .contact-actions {
        flex-direction: column;
    }

    .hero-meta li {
        flex-basis: 100%;
    }

    .btn {
        width: 100%;
    }

    .timeline-item {
        padding: 1.35rem 1.15rem 1.35rem 1.8rem;
    }

    .stack-grid {
        grid-template-columns: 1fr;
    }

    .floating-btn {
        width: 3rem;
        height: 3rem;
    }

    .floating-btn-whatsapp {
        width: 3.45rem;
        height: 3.45rem;
    }

    .contact-list {
        gap: 0.55rem;
        font-size: 0.74rem;
    }

    .contact-list li {
        padding: 0.72rem 0.78rem;
        border-radius: 16px;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .doc-viewer-dialog {
        width: 100%;
        height: 100%;
        max-height: calc(100vh - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
        margin: 0;
        padding: 0.8rem;
        border-radius: 24px;
    }

    .doc-viewer-link {
        min-height: 2.55rem;
        padding: 0.72rem 0.85rem;
        font-size: 0.66rem;
    }

    .doc-viewer-close {
        width: 2.55rem;
        height: 2.55rem;
    }

    .doc-nav {
        top: auto;
        bottom: 0.9rem;
        transform: none;
    }

    .doc-nav-prev {
        left: 0.9rem;
    }

    .doc-nav-next {
        right: 0.9rem;
    }

    .doc-nav:hover,
    .doc-nav:focus-visible {
        transform: translateY(-2px);
    }

    .doc-viewer-scroll {
        padding: 1rem 1rem 4.6rem;
    }

    .projects-hint {
        width: 100%;
        justify-content: flex-start;
    }

    .project-sheet-dialog {
        max-height: min(86vh, 40rem);
        max-height: min(86dvh, 40rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .skills-marquee-track,
    .floating-btn-whatsapp,
    .floating-ripple,
    .project-card.is-ready,
    .project-spotlight.is-refreshing {
        animation: none !important;
    }

    .btn,
    .project-card,
    .floating-actions,
    .floating-btn,
    .filter-chip {
        transition: none !important;
    }
}
