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

:root {
    --surface-color: #5c5c9e;
    --layer-1-color: #3d3d7a;
    --layer-2-color: #2a2d5c;
    --layer-3-color: #151830;
    --accent-color: #818cf8;
    --text-light: #e8e7f5;
    --text-muted: #a5a8c8;
    --card-radius: 8px;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Times New Roman', Times, serif;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #12122a 0%, #0d0d1f 50%, #090918 100%);
    color: var(--text-light);
}

.lake-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.layer {
    position: absolute;
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: width 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                height 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                left 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                top 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                box-shadow 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                border-color 0.75s cubic-bezier(0.33, 0.5, 0.2, 1),
                transform 0.7s cubic-bezier(0.33, 0.5, 0.2, 1);
    pointer-events: all;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(129, 140, 248, 0.12);
    opacity: 1;
    --mouse-x: 50%;
    --mouse-y: 50%;
}


.layer.active {
    cursor: default;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    border-color: rgba(129, 140, 248, 0.15);
}

.layer.active .layer-content {
    opacity: 1;
    pointer-events: all;
}

/* Inactive layers: hide content so only the card edge is visible */
.layer:not(.active) .layer-content {
    opacity: 0;
    pointer-events: none;
}

/*
   Stacked cards:
   Active (front) card is smallest, centered, highest z-index.
   Cards behind are progressively larger so their edges peek out
   around the active card. Click an edge to navigate.
*/

.layer[data-depth="0"] { background: #5c5c9e; }
.layer[data-depth="1"] {
    background: linear-gradient(160deg, #4a4a85 0%, #3a3a72 50%, #32326a 100%);
}
.layer[data-depth="2"] { background: #2a2d5c; }
.layer[data-depth="3"] { background: #151830; }

/* Pattern overlay — dots */
.layer::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: radial-gradient(circle at center, rgba(0,0,0,0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

.layer[data-depth="0"]::after { background-image: radial-gradient(circle at center, rgba(0,0,0,0.1) 1px, transparent 1px); }
.layer[data-depth="1"]::after { background-image: radial-gradient(circle at center, rgba(0,0,0,0.12) 1px, transparent 1px); }
.layer[data-depth="2"]::after { background-image: radial-gradient(circle at center, rgba(255,255,255,0.05) 1px, transparent 1px); }
.layer[data-depth="3"]::after { background-image: radial-gradient(circle at center, rgba(255,255,255,0.06) 1px, transparent 1px); }

/* Float pattern when card is active */
.layer.active::after {
    animation: patternFloat 8s linear infinite;
}

@keyframes patternFloat {
    0%   { background-position: 0 0; }
    100% { background-position: 24px 24px; }
}

/* Hover on an inactive card edge — visible stroke */
.layer:not(.active):hover {
    border: 2px solid rgba(129, 140, 248, 0.6);
    box-shadow: 0 8px 30px rgba(129, 140, 248, 0.2),
                inset 0 0 0 1px rgba(129, 140, 248, 0.3);
}
.layer:not(.active).hover-top {
    transform: translateY(-6px);
}
.layer:not(.active).hover-bottom {
    transform: translateY(6px);
}

/* Hint glow: all edges */
.layer.hint-pulse::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
    border: 2px solid rgba(129, 140, 248, 0);
    box-shadow: inset 0 0 45px rgba(129, 140, 248, 0.35);
    animation: edgeGlowPulse 2.5s ease-in-out infinite;
}

@keyframes edgeGlowPulse {
    0%   { opacity: 0.2; border-color: rgba(129, 140, 248, 0); box-shadow: inset 0 0 25px rgba(129, 140, 248, 0.1); }
    20%  { opacity: 0.6; border-color: rgba(129, 140, 248, 0.4); box-shadow: inset 0 0 40px rgba(129, 140, 248, 0.25); }
    40%  { opacity: 0.85; border-color: rgba(129, 140, 248, 0.55); box-shadow: inset 0 0 50px rgba(129, 140, 248, 0.35); }
    50%  { opacity: 1; border-color: rgba(129, 140, 248, 0.65); box-shadow: inset 0 0 55px rgba(129, 140, 248, 0.4); }
    60%  { opacity: 0.85; border-color: rgba(129, 140, 248, 0.55); box-shadow: inset 0 0 50px rgba(129, 140, 248, 0.35); }
    80%  { opacity: 0.6; border-color: rgba(129, 140, 248, 0.4); box-shadow: inset 0 0 40px rgba(129, 140, 248, 0.25); }
    100% { opacity: 0.2; border-color: rgba(129, 140, 248, 0); box-shadow: inset 0 0 25px rgba(129, 140, 248, 0.1); }
}

@keyframes arrowGlowPulse {
    0%, 30%  { border-color: rgba(129, 140, 248, 0); box-shadow: 0 0 20px rgba(129, 140, 248, 0.08); }
    45%     { border-color: rgba(129, 140, 248, 0.4); box-shadow: 0 0 24px rgba(129, 140, 248, 0.18); }
    50%     { border-color: rgba(129, 140, 248, 0.65); box-shadow: 0 0 30px rgba(129, 140, 248, 0.3); }
    55%     { border-color: rgba(129, 140, 248, 0.4); box-shadow: 0 0 24px rgba(129, 140, 248, 0.18); }
    70%, 100% { border-color: rgba(129, 140, 248, 0); box-shadow: 0 0 20px rgba(129, 140, 248, 0.08); }
}

.layer.hint-pulse .layer-label {
    animation: labelFlash 2.5s ease-in-out;
}

.layer[data-depth="0"].hint-pulse .layer-label {
    animation: labelFlashHome 2.5s ease-in-out;
}

@keyframes labelFlash {
    0%, 100% { color: rgba(129, 140, 248, 0.7); }
    50%      { color: rgba(129, 140, 248, 1); }
}

@keyframes labelFlashHome {
    0%, 100% { color: #2a2d5c; }
    50%      { color: #3d3d7a; }
}

/* Card edge label — bottom-left corner */
.layer-label {
    position: absolute;
    bottom: 0.05rem;
    left: 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(129, 140, 248, 0.7);
    z-index: 5;
    pointer-events: none;
    transform-origin: center center;
    transition: opacity 0.5s ease;
}

/* Home label — darker shade on light card */
.layer[data-depth="0"] .layer-label {
    color: #2a2d5c;
}

/* Keep labels visible on all cards including active */
.layer.active .layer-label {
    opacity: 1;
}

.layer-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 2;
    transition: opacity 0.5s cubic-bezier(0.33, 0.5, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for layer content */
.layer-content::-webkit-scrollbar {
    width: 8px;
}

.layer-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.layer-content::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.3);
    border-radius: 10px;
}

.layer-content::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.5);
}

.content-wrapper {
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

/* Home: separate fixed-height slots so greeting never shifts during glitch */
.layer[data-depth="0"] .content-wrapper {
    min-height: 11em;
}

.layer[data-depth="0"] .home-line1 {
    height: 5.75rem;
    min-height: 5.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer[data-depth="0"] .home-line1 h1 {
    margin: 0;
}

.layer[data-depth="0"] .greeting-line {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    text-transform: lowercase;
}

.layer[data-depth="0"] .home-line2 {
    height: 1.6em;
    min-height: 1.6em;
    margin-top: 0.5rem;
}

.layer[data-depth="0"] .home-line2 .subtitle {
    margin: 0;
}


/* Surface Layer (Home) */
.layer[data-depth="0"] h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    line-height: 1.15;
    min-height: 1.15em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #2a2d5c 0%, #151830 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Name — starts italic + bold, then glitches to normal */
/* Name wrapper keeps a fixed width so font swaps don't shift layout */
.name-wrap {
    display: inline-block;
    vertical-align: baseline;
}

.name-glitch {
    font-family: 'Creepster', cursive;
    font-weight: 400;
    font-style: normal;
    display: inline-block;
    position: relative;
    text-shadow: none;
}

/* Colour-split shadows during glitch */
.name-glitch.glitching {
    animation: nameGlitch 0.9s steps(1) forwards;
}

.name-glitch.glitching::before,
.name-glitch.glitching::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    overflow: hidden;
}

.name-glitch.glitching::before {
    animation: glitchTop 0.9s steps(1) forwards;
    clip-path: inset(0 0 50% 0);
}

.name-glitch.glitching::after {
    animation: glitchBottom 0.9s steps(1) forwards;
    clip-path: inset(50% 0 0 0);
}

@keyframes nameGlitch {
    0%    { opacity: 1; transform: none; filter: none; }
    5%    { opacity: 0; }
    6%    { opacity: 1; transform: translateX(-8px) skewX(-12deg); filter: blur(2px); }
    10%   { opacity: 0.2; transform: translateX(10px) skewX(10deg) scaleY(1.15); filter: none; }
    14%   { opacity: 1; transform: translateX(-4px) skewX(-6deg) scaleX(0.9); filter: blur(1px); }
    18%   { opacity: 0; }
    20%   { opacity: 0.8; transform: translateX(12px) rotate(-2deg) scaleY(0.9); filter: none; }
    25%   { opacity: 0.1; transform: translateX(-15px) skewX(15deg); filter: blur(3px); }
    28%   { opacity: 1; transform: translateX(6px) rotate(1.5deg); filter: none; }
    32%   { opacity: 0; }
    34%   { opacity: 0.7; transform: translateX(-10px) skewX(-10deg) scaleY(1.1); filter: blur(1px); }
    40%   { opacity: 0.3; transform: translateX(8px) skewX(8deg) scaleX(1.08); }
    44%   { opacity: 0; }
    46%   { opacity: 1; transform: translateX(-6px) rotate(-1deg); filter: none; }
    50%   { opacity: 0.5; transform: translateX(14px) skewX(-12deg) scaleY(0.85); filter: blur(2px); }
    55%   { opacity: 0; }
    58%   { opacity: 0.9; transform: translateX(-3px) skewX(4deg); filter: none; }
    63%   { opacity: 0.2; transform: translateX(5px) rotate(1deg); filter: blur(1px); }
    68%   { opacity: 1; transform: translateX(-2px); filter: none; }
    75%   { opacity: 0.6; transform: translateX(3px) skewX(-2deg); }
    82%   { opacity: 0; }
    84%   { opacity: 1; transform: translateX(-1px); filter: none; }
    90%   { opacity: 0.95; transform: translateX(1px); }
    100%  { opacity: 1; transform: none; filter: none; }
}

@keyframes glitchTop {
    0%, 100% { transform: none; }
    6%    { transform: translateX(8px); }
    14%   { transform: translateX(-12px); }
    20%   { transform: translateX(5px); }
    25%   { transform: translateX(-8px); }
    34%   { transform: translateX(10px); }
    40%   { transform: translateX(-6px); }
    50%   { transform: translateX(12px); }
    58%   { transform: translateX(-4px); }
    68%   { transform: translateX(2px); }
    84%   { transform: translateX(-1px); }
}

@keyframes glitchBottom {
    0%, 100% { transform: none; }
    6%    { transform: translateX(-10px); }
    14%   { transform: translateX(8px); }
    20%   { transform: translateX(-6px); }
    25%   { transform: translateX(12px); }
    34%   { transform: translateX(-8px); }
    40%   { transform: translateX(5px); }
    50%   { transform: translateX(-14px); }
    58%   { transform: translateX(3px); }
    68%   { transform: translateX(-2px); }
    84%   { transform: translateX(1px); }
}

.name-glitch.settled {
    font-family: inherit;
    font-weight: 300;
    font-style: normal;
}

.name-glitch.settled::before,
.name-glitch.settled::after {
    display: none;
}

.subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 3rem;
    min-height: 1.5em;
}

.layer[data-depth="0"] .subtitle {
    margin-top: 0.5rem;
    color: #2a2d5c;
}

.home-location {
    position: absolute;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: 600;
    color: #2a2d5c;
    letter-spacing: 0.02em;
    opacity: 0.9;
    pointer-events: none;
}

.designer-footnote {
    position: absolute;
    bottom: 1.2rem;
    right: 1.5rem;
    font-size: 0.8rem;
    color: #2a2d5c;
    letter-spacing: 0.08em;
    pointer-events: none;
}

.depth-hint {
    margin-top: 4rem;
    color: var(--accent-color);
    font-size: 1.1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* About Layer */
.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2.5rem;
    margin-top: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.profile-section {
    text-align: center;
}

.profile-image {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 1.25rem;
    border: 2px solid rgba(129, 140, 248, 0.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.profile-section h3 {
    font-size: clamp(1.6rem, 4vw, 2rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    color: var(--text-light);
}

.profile-section h3 .aka {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.role {
    display: inline-block;
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(129, 140, 248, 0.15);
    margin-top: 0.25rem;
}

.bio {
    position: relative;
    padding-top: 1.5rem;
}

.bio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.4), transparent);
    border-radius: 1px;
}

.bio p {
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    text-align: center;
}

.bio p:last-child {
    margin-bottom: 0;
}

/* Projects Layer — wallet stack */
.layer[data-depth="2"] .layer-content {
    align-items: flex-start;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.layer[data-depth="2"] .content-wrapper {
    max-width: 100%;
    width: 100%;
    text-align: left;
    padding: 0;
    height: auto;
}

.projects-grid {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    padding-top: 0;
}

.project-card {
    position: relative;
    width: 100%;
    background: rgba(30, 34, 71, 0.85);
    border-radius: 0;
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(129, 140, 248, 0.15);
    border-bottom: none;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: left;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* First card matches the layer border-radius */
.project-card:first-child {
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

.project-card:last-child {
    border-bottom: 1px solid rgba(129, 140, 248, 0.15);
}

/* Stagger the cards like a wallet — darker */
.project-card:nth-child(1) { background: rgba(92, 92, 158, 0.95); z-index: 3; }
.project-card:nth-child(2) { background: rgba(82, 82, 148, 0.95); z-index: 2; }
.project-card:nth-child(3) { background: rgba(72, 72, 138, 0.95); z-index: 1; }

.project-card::before {
    display: none;
}

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

/* Card states: minimized → peek → expanded */
.project-card {
    display: block;
}

.card-minimized h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-light);
    transition: color 0.2s ease;
    text-align: center;
}

.card-peek,
.card-expanded {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                margin 0.3s ease;
    margin-top: 0;
}

.card-peek p,
.card-expanded p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
    text-align: center;
}

/* Expanded — show everything */
.project-card.expanded .card-peek {
    max-height: 100px;
    opacity: 1;
    margin-top: 0.8rem;
}

.project-card.expanded .card-expanded {
    max-height: 2000px;
    opacity: 1;
    margin-top: 1rem;
    overflow: visible;
}

.project-image {
    width: 85%;
    max-width: 650px;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    margin: 0 auto 1rem;
    overflow: hidden;
    background: #000;
}

.project-image img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 12px;
    object-fit: contain;
}

/* Play button on cover images */
.cover-play {
    position: relative;
    cursor: pointer;
}

.cover-play:hover img {
    filter: brightness(0.6);
    transition: filter 0.3s ease;
}

.img-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1.5rem;
    pointer-events: none;
    transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.cover-play:hover .img-play-btn {
    background: rgba(129, 140, 248, 0.7);
    border-color: rgba(129, 140, 248, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}


@media (max-width: 768px) {
    .project-card {
        padding: 1.2rem 1.5rem;
    }
    .project-image {
        height: 130px;
    }
}

/* Project popup overlay */
.project-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(9, 9, 24, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background 0.4s ease;
}

.project-popup-overlay.open {
    background: rgba(9, 9, 24, 0.85);
    pointer-events: all;
}

.project-popup {
    position: relative;
    width: 92%;
    max-width: 960px;
    max-height: 90vh;
    background: #151830;
    border-radius: 20px;
    border: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(129, 140, 248, 0.1);
    overflow-y: auto;
    overflow-x: hidden;
    transform: scale(0.85) translateY(30px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

.project-popup-overlay.open .project-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-light);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.popup-close:hover {
    background: rgba(129, 140, 248, 0.5);
    transform: scale(1.1);
}

.popup-visual {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    overflow: hidden;
    cursor: default;
}

.popup-visual.has-video {
    cursor: pointer;
}

.popup-visual img {
    width: 100%;
    display: block;
    transition: filter 0.3s ease;
}

.popup-visual.has-video:hover img {
    filter: brightness(0.6);
}

.popup-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 2rem;
    pointer-events: none;
    transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.popup-visual.has-video:hover .popup-play-btn {
    background: rgba(129, 140, 248, 0.7);
    border-color: rgba(129, 140, 248, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Embedded video player inside popup — replaces visual header */
.popup-player {
    width: 100%;
}

.popup-player .player-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
}

.popup-player .player-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.popup-body {
    padding: 2rem 2.5rem 2.5rem;
}

.popup-body h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.popup-desc {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.popup-meta span {
    background: rgba(129, 140, 248, 0.12);
    color: var(--accent-color);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.popup-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.6rem 1.6rem;
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    transition: background 0.25s ease, color 0.25s ease;
}

.popup-link:hover {
    background: var(--accent-color);
    color: #12122a;
}

.popup-link.hidden {
    display: none;
}

@media (max-width: 768px) {
    .popup-body {
        padding: 1.5rem;
    }
    .popup-body h2 {
        font-size: 1.5rem;
    }
}

.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.project-card p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.project-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.project-link:hover {
    color: var(--text-light);
}

/* Contact Layer */
.contact-content {
    max-width: 600px;
    margin: 0 auto;
}

.contact-intro {
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.contact-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

.contact-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.4rem 0.2rem;
    border-bottom: 2px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.contact-link:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.contact-sep {
    color: var(--text-muted);
    opacity: 0.4;
    font-size: 1.2rem;
    user-select: none;
}

.surface-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.surface-btn:hover {
    border-bottom-color: var(--accent-color);
}

/* Page names navigation */
.nav-wrapper {
    position: fixed;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

body.nav-hidden .nav-wrapper {
    transform: translateY(-50%) translateX(calc(100% + 3rem));
    opacity: 0;
    pointer-events: none;
}

.nav-toggle {
    flex-shrink: 0;
    border: none;
    padding: 0.5rem 1rem;
    background: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.25s ease;
}

.nav-toggle:hover {
    color: var(--accent-color);
}

.nav-show-tab {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    border: none;
    width: 24px;
    min-height: 36px;
    padding: 0.35rem 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(129, 140, 248, 0.15);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px 0 0 8px;
    opacity: 0;
    pointer-events: none;
    border: 2px solid rgba(129, 140, 248, 0);
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.08);
    transition: opacity 0.3s ease, color 0.25s ease, background 0.25s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

body.nav-hidden .nav-show-tab {
    opacity: 1;
    pointer-events: all;
    animation: arrowGlowPulse 5s ease-in-out infinite;
}

body.nav-overlay-open .nav-show-tab {
    opacity: 0;
    pointer-events: none;
}

/* Nav overlay — when Show tab is clicked, nav appears as overlay */
.nav-overlay-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.nav-overlay-open .nav-overlay-backdrop {
    opacity: 1;
    pointer-events: all;
}

body.nav-overlay-open.nav-hidden .nav-wrapper {
    right: 1.25rem;
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    pointer-events: all;
    z-index: 1001;
}

.nav-show-tab:hover {
    color: var(--accent-color);
    background: rgba(129, 140, 248, 0.2);
    border-color: rgba(129, 140, 248, 0.5);
    box-shadow: 0 0 28px rgba(129, 140, 248, 0.28);
    animation-play-state: paused;
}

.depth-indicator {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.nav-page {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: color 0.25s ease, background 0.25s ease;
    cursor: pointer;
}

.nav-page:hover {
    color: var(--accent-color);
}

.nav-page.active {
    color: var(--accent-color);
}

.reduce-motion-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: color 0.25s ease, background 0.25s ease;
    flex-shrink: 0;
}

.reduce-motion-popup {
    position: absolute;
    bottom: calc(100% + 0.4rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
    background: rgba(26, 26, 46, 0.95);
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1002;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.reduce-motion-popup.reduce-motion-popup-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.reduce-motion-toggle:hover {
    color: var(--accent-color);
}

.reduce-motion-toggle::before {
    content: 'Motion';
    position: absolute;
    bottom: calc(100% + 0.4rem);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-light);
    background: rgba(26, 26, 46, 0.95);
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1002;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.reduce-motion-toggle:hover::before {
    opacity: 1;
}

.reduce-motion-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.reduce-motion-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reduce-motion-icon svg {
    display: block;
}

/* Crossed state when reduce motion is on */
.reduce-motion-toggle input:checked + .reduce-motion-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 130%;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(-45deg);
    border-radius: 1px;
    opacity: 0.9;
}

/* Fade in animations */
.fade-in {
    animation: fadeIn 1s ease-out;
}

.fade-in-delay {
    animation: fadeIn 1s ease-out 0.3s backwards;
}

.fade-in-delay-2 {
    animation: fadeIn 1s ease-out 0.6s backwards;
}

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


/* General heading styles (fallback) */
h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive Design */
@media (max-width: 768px) {
    
    
    .contact-links {
        gap: 0.3rem;
    }
    
    .nav-wrapper {
        right: auto;
        left: 50%;
        top: 1rem;
        transform: translateX(-50%);
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
    }

    body.nav-hidden .nav-wrapper {
        transform: translateX(-50%) translateY(-120%);
    }

    body.nav-overlay-open.nav-hidden .nav-wrapper {
        right: auto;
        left: 50%;
        transform: translateX(-50%) translateY(0);
    }

    .depth-indicator {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
    }

    .nav-show-tab {
        right: auto;
        left: 50%;
        top: 0;
        transform: translate(-50%, 0);
        min-height: auto;
        min-width: 4.5rem;
        width: auto;
        font-size: 0;
        padding: 0.25rem 0.85rem;
        border-radius: 8px;
    }

    /* Point down on small screens — tap to expand nav below */
    .nav-show-tab::before {
        content: '▼';
        font-size: 0.85rem;
        display: block;
        line-height: 1;
    }

    body.nav-hidden .nav-show-tab {
        top: 0;
    }

    .nav-page,
    .nav-toggle {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .reduce-motion-toggle {
        padding: 0.4rem 0.8rem;
    }

    .reduce-motion-toggle::before {
        bottom: auto;
        top: calc(100% + 0.4rem);
    }

    .reduce-motion-popup {
        bottom: auto;
        top: calc(100% + 0.4rem);
        transform: translateX(-50%) translateY(-4px);
    }

    .reduce-motion-popup.reduce-motion-popup-show {
        transform: translateX(-50%) translateY(0);
    }
    
    .layer-content {
        padding: 0.4rem 1rem 1.25rem 1rem;
    }

    .layer[data-depth="0"] .layer-content,
    .layer[data-depth="1"] .layer-content {
        padding-top: 0.4rem;
    }

    /* Home card: smaller text, flexible layout to prevent overlap */
    .layer[data-depth="0"] .content-wrapper {
        min-height: auto;
    }

    .layer[data-depth="0"] .home-line1 {
        height: auto;
        min-height: auto;
        padding: 0;
    }

    .layer[data-depth="0"] .home-line2 {
        height: auto;
        min-height: auto;
        margin-top: 0.15rem;
    }

    .layer[data-depth="0"] h1,
    .layer[data-depth="0"] .greeting-line {
        font-size: clamp(2.25rem, 9vw, 3.5rem);
        line-height: 1.15;
        margin-bottom: 0.25rem;
    }

    .layer[data-depth="0"] .subtitle {
        font-size: 0.65rem;
        margin-bottom: 0.75rem;
        min-height: auto;
    }

    .home-location {
        top: 0.75rem;
        bottom: auto;
        font-size: 0.5rem;
    }

    .designer-footnote {
        font-size: 0.6rem;
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .depth-hint {
        margin-top: 2rem;
        font-size: 0.9rem;
    }

    /* About: slightly smaller on mobile */
    .profile-section h3 {
        font-size: clamp(1.35rem, 4vw, 1.75rem);
    }
    .bio p {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    .role {
        font-size: 0.85rem;
        padding: 0.3rem 0.6rem;
    }

}

/* Scroll hint for mobile */
@media (max-width: 768px) {
    .depth-hint {
        font-size: 0.9rem;
    }
}

/* Reduce motion: disable or shorten animations */
body.reduce-motion .layer,
body.reduce-motion .layer::after,
body.reduce-motion .layer.hint-pulse::before,
body.reduce-motion .nav-show-tab,
body.reduce-motion .layer.hint-pulse .layer-label,
body.reduce-motion .fade-in,
body.reduce-motion .fade-in-delay,
body.reduce-motion .fade-in-delay-2,
body.reduce-motion .depth-hint,
body.reduce-motion .name-glitch.glitching,
body.reduce-motion .name-glitch.glitching::before,
body.reduce-motion .name-glitch.glitching::after {
    animation: none !important;
}

/* Card layout jumps instantly; only content fades */
body.reduce-motion .layer {
    transition: none;
}

body.reduce-motion * {
    transition-duration: 0.15s !important;
}

body.reduce-motion .layer-content {
    transition: opacity 0.4s ease !important;
}

