/* ============================================================
   MDD Portfolyo — Sunum Stili
   ============================================================ */

:root {
    --bg-0: #0a0a0f;
    --bg-1: #121219;
    --bg-2: #1a1a24;
    --fg-0: #ffffff;
    --fg-1: #c8c8d4;
    --fg-2: #8a8a99;
    --accent: #4f8cff;
    --accent-glow: rgba(79, 140, 255, 0.35);
    --border: rgba(255, 255, 255, 0.08);

    --pad-x: clamp(1.5rem, 6vw, 6rem);
    --pad-y-top: 6rem;
    --pad-y-bottom: 5rem;
    --gap: clamp(2rem, 5vw, 5rem);
    --radius: 16px;

    --ease: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-0);
    color: var(--fg-0);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: default; opacity: 0.3; }

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem var(--pad-x);
    pointer-events: none;
    gap: 2rem;
}

.brand {
    pointer-events: auto;
    display: flex;
    align-items: center;
}

.brand img {
    height: 36px;
    width: auto;
    opacity: 0.95;
    transition: opacity 0.2s;
}

.brand:hover img { opacity: 1; }

.top-actions {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.toc-link {
    color: var(--fg-1);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--fg-0);
}

.slide-indicator {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--fg-2);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.slide-indicator .divider { margin: 0 0.4rem; opacity: 0.4; }

#current-slide {
    color: var(--fg-0);
    font-weight: 600;
}

/* ============================================================
   SIDE DOT NAVIGATION
   ============================================================ */
.dot-nav {
    position: fixed;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.dot-nav button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
    position: relative;
}

.dot-nav button:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
}

.dot-nav button.active {
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: scale(1.3);
}

.dot-nav button::before {
    content: attr(data-label);
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-2);
    color: var(--fg-0);
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    border: 1px solid var(--border);
}

.dot-nav button:hover::before { opacity: 1; }

/* ============================================================
   DECK
   ============================================================ */
.deck {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.deck::-webkit-scrollbar { display: none; }

.slide {
    min-height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
}

/* ============================================================
   INTRO SLIDE
   ============================================================ */
.slide.intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--pad-y-top) var(--pad-x) var(--pad-y-bottom);
}

.slide.intro::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(79, 140, 255, 0.10), transparent 70%);
    pointer-events: none;
}

.slide.intro .intro-logo {
    height: clamp(60px, 12vw, 130px);
    width: auto;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 40px rgba(255,255,255,0.15));
    position: relative;
    z-index: 1;
}

.slide.intro h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--fg-1);
    max-width: 800px;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.slide.intro h1 strong { font-weight: 700; color: var(--fg-0); }

.slide.intro .intro-meta {
    margin-top: 3rem;
    display: flex;
    gap: 3rem;
    color: var(--fg-2);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

.slide.intro .intro-meta span strong {
    display: block;
    color: var(--fg-0);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
    text-transform: none;
}

/* ============================================================
   TOC SLIDE
   ============================================================ */
.slide.toc {
    padding: var(--pad-y-top) var(--pad-x) var(--pad-y-bottom);
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide.toc::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0% 0%, rgba(79, 140, 255, 0.10), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(79, 140, 255, 0.06), transparent 50%);
    pointer-events: none;
}

.toc-inner {
    width: 100%;
    max-width: 960px;
    position: relative;
    z-index: 1;
}

.toc-header { margin-bottom: 3rem; }

.toc-eyebrow {
    display: inline-block;
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.toc-header h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg-0);
}

.toc-list {
    display: flex;
    flex-direction: column;
}

.toc-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    transition: background 0.3s, padding 0.3s;
    position: relative;
}

.toc-item:first-child { border-top: 1px solid var(--border); }

.toc-item:hover {
    background: rgba(79, 140, 255, 0.05);
    padding-left: 1.5rem;
}

.toc-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transform: translateY(-50%);
    transition: width 0.3s;
}

.toc-item:hover::after { width: 1rem; }

.toc-number {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    min-width: 2.5ch;
}

.toc-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.toc-title {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 600;
    color: var(--fg-0);
    letter-spacing: -0.01em;
}

.toc-category {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--fg-2);
    font-weight: 500;
}

.toc-arrow {
    color: var(--fg-2);
    transition: color 0.3s, transform 0.3s;
    display: flex;
}

.toc-item:hover .toc-arrow {
    color: var(--accent);
    transform: translateX(6px);
}

/* ============================================================
   SECTION SLIDE (carries horizontal pages — projects in a category)
   ============================================================ */
.section-slide {
    padding: 0;
}

.pages-track {
    display: flex;
    width: 100%;
    height: 100vh;
    transition: transform 0.65s var(--ease);
    will-change: transform;
}

.page {
    flex: 0 0 100%;
    width: 100%;
    height: 100vh;
    padding: var(--pad-y-top) var(--pad-x) var(--pad-y-bottom);
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(79, 140, 255, 0.06), transparent 60%);
    pointer-events: none;
}

/* ---------- Split layouts (left/right) ---------- */
.page-split-left,
.page-split-right {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: var(--gap);
}

.page-split-left { grid-template-columns: 1.15fr 1fr; }
.page-split-right { grid-template-columns: 1fr 1.15fr; }

.slide-visual {
    position: relative;
    z-index: 1;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: calc(100vh - 12rem);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-1);
    border: 1px solid var(--border);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.02);
}

.slide-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
    color: var(--fg-2);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.slide-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 540px;
    align-self: center;
}

.slide-category {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(79, 140, 255, 0.12);
    border: 1px solid rgba(79, 140, 255, 0.3);
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 500;
}

.slide-category .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.slide-title {
    font-size: clamp(1.7rem, 3.2vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--fg-0);
}

.slide-title.big {
    font-size: clamp(2.2rem, 4.5vw, 3.5rem);
    font-weight: 300;
}

.slide-title.big strong { font-weight: 700; }

.slide-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--fg-1);
    font-weight: 400;
    max-width: 60ch;
}

.slide-description.big {
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    color: var(--fg-1);
    max-width: 65ch;
}

.slide-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.slide-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--fg-1);
    font-size: 0.97rem;
    line-height: 1.5;
}

.slide-features li::before {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    background: rgba(79, 140, 255, 0.15);
    border: 1px solid rgba(79, 140, 255, 0.4);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%234f8cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='2.5 6 5 8.5 9.5 4'/></svg>");
    background-position: center;
    background-repeat: no-repeat;
}

.slide-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.slide-tech span {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--fg-1);
    font-size: 0.85rem;
    font-weight: 500;
}

.slide-link {
    align-self: flex-start;
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.slide-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--accent-glow);
}

/* ---------- Section cover layout (bölüm kapağı) ---------- */
.page-section-cover {
    padding: var(--pad-y-top) var(--pad-x) var(--pad-y-bottom);
    align-items: center;
    background:
        radial-gradient(circle at 0% 0%, rgba(79, 140, 255, 0.10), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(140, 79, 255, 0.06), transparent 50%);
}

.section-cover-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 2%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.section-cover-number {
    font-size: clamp(20rem, 55vw, 50rem);
    font-weight: 800;
    color: rgba(255, 255, 255, 0.025);
    line-height: 0.78;
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
    user-select: none;
    transform: translateY(-1vw);
}

.section-cover-content {
    max-width: 920px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    position: relative;
    z-index: 1;
}

.section-eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 600;
    display: inline-block;
}

.section-title {
    font-size: clamp(2.5rem, 6.5vw, 5.5rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.03em;
    color: var(--fg-0);
}

.section-subtitle {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--fg-1);
    line-height: 1.5;
    max-width: 60ch;
    font-weight: 300;
}

.section-bullets {
    list-style: none;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.section-bullets li {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--fg-1);
    font-size: 1.05rem;
    line-height: 1.4;
}

.section-bullets li::before {
    content: '';
    width: 28px;
    height: 1px;
    background: var(--accent);
    flex-shrink: 0;
    opacity: 0.7;
}

.section-hint {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--fg-2);
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 500;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(20, 20, 30, 0.4);
    backdrop-filter: blur(6px);
    align-self: flex-start;
}

.section-hint svg {
    animation: arrow-bounce 1.8s ease-in-out infinite;
    color: var(--accent);
}

@keyframes arrow-bounce {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

/* ---------- Cover layout ---------- */
.page-cover {
    padding: 0;
    align-items: stretch;
}

.cover-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.cover-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.45) saturate(1.1);
}

.cover-bg.placeholder-bg {
    background:
        radial-gradient(circle at 25% 30%, rgba(79, 140, 255, 0.18), transparent 55%),
        radial-gradient(circle at 75% 70%, rgba(140, 79, 255, 0.12), transparent 55%),
        linear-gradient(135deg, var(--bg-1), var(--bg-0));
}

.page-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(10,10,15,0.85) 0%, rgba(10,10,15,0.55) 45%, rgba(10,10,15,0.25) 100%);
    z-index: 1;
}

.cover-content {
    position: relative;
    z-index: 2;
    padding: var(--pad-y-top) var(--pad-x) var(--pad-y-bottom);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 1000px;
    height: 100%;
}

.cover-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--fg-0);
}

.cover-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    line-height: 1.5;
    color: var(--fg-1);
    max-width: 60ch;
    font-weight: 300;
}

/* ---------- Gallery layout ---------- */
.page-stack {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    z-index: 1;
    align-items: stretch;
    justify-content: center;
}

.page-stack.centered {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.page-stack.centered .slide-features { align-items: flex-start; }

.page-stack-header {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: flex-start;
}

.gallery-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.gallery-count-1 { grid-template-columns: 1fr; }
.gallery-count-2 { grid-template-columns: 1fr 1fr; }
.gallery-count-3 { grid-template-columns: repeat(3, 1fr); }
.gallery-count-4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: 1fr 1fr; }
.gallery-count-5 { grid-template-columns: repeat(3, 1fr); }
.gallery-count-6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.gallery-empty { grid-template-columns: repeat(3, 1fr); }

.gallery-cell {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-1);
    border: 1px solid var(--border);
    aspect-ratio: 4 / 3;
}

.gallery-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-caption {
    font-size: 0.85rem;
    color: var(--fg-2);
    text-align: center;
}

/* ---------- Tech / Text layouts ---------- */
.page-tech .page-stack.centered .slide-tech,
.page-text .page-stack.centered .slide-tech {
    justify-content: center;
    margin-top: 1.5rem;
}

.page-text .page-stack.centered { max-width: 900px; margin: 0 auto; }

/* ============================================================
   PAGE NAVIGATION (within project slides)
   ============================================================ */
.page-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--fg-0);
    display: grid;
    place-items: center;
    transition: background 0.2s, transform 0.2s;
}

.page-arrow-prev { left: 1.5rem; }
/* right arrow is pushed inward to clear the side dot-nav column at the right edge */
.page-arrow-next { right: 4.5rem; }

.page-arrow:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-50%) scale(1.05);
    border-color: var(--accent);
}

.page-arrow:disabled { opacity: 0; pointer-events: none; }

.page-indicator {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(20, 20, 30, 0.65);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transition: all 0.3s;
    cursor: pointer;
}

.page-dot:hover { background: rgba(255,255,255,0.5); }

.page-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 999px;
    box-shadow: 0 0 8px var(--accent-glow);
}

.page-count {
    margin-left: 0.5rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--border);
    color: var(--fg-1);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.page-count .curr { color: var(--fg-0); font-weight: 600; }

/* Compact mode: no dots, just a larger counter (used when a section has many pages) */
.page-indicator.compact {
    padding: 0.65rem 1.3rem;
    gap: 0;
}

.page-indicator.compact .page-count {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    font-size: 0.85rem;
    letter-spacing: 0.18em;
}

.page-indicator.compact .page-count .curr {
    font-size: 1rem;
}

/* ============================================================
   FOOTER HINT
   ============================================================ */
.hint {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--fg-2);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    pointer-events: none;
    opacity: 0;
    animation: hint-fade-in 1s ease 1.2s forwards;
}

.hint-group { display: flex; align-items: center; gap: 0.4rem; }
.hint-group + .hint-group { padding-left: 1rem; border-left: 1px solid var(--border); }

.hint .key {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 0.4rem;
    border-radius: 4px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--fg-1);
    font-size: 0.78rem;
}

@keyframes hint-fade-in { to { opacity: 1; } }

/* ============================================================
   ANIMATIONS — chapter entrance
   ============================================================ */
.slide .slide-content > *,
.slide .slide-visual,
.slide .page-stack-header > *,
.slide .gallery-grid,
.slide .gallery-caption,
.slide .cover-content > *,
.slide .section-cover-content > *,
.slide .section-cover-number,
.slide .toc-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.slide.is-active .slide-content > *,
.slide.is-active .slide-visual,
.slide.is-active .page-stack-header > *,
.slide.is-active .gallery-grid,
.slide.is-active .gallery-caption,
.slide.is-active .cover-content > *,
.slide.is-active .section-cover-content > *,
.slide.is-active .section-cover-number,
.slide.is-active .toc-item {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger for section cover */
.slide.is-active .section-cover-number { transition-delay: 0s; transition-duration: 1.2s; }
.slide.is-active .section-cover-content > *:nth-child(1) { transition-delay: 0.15s; }
.slide.is-active .section-cover-content > *:nth-child(2) { transition-delay: 0.25s; }
.slide.is-active .section-cover-content > *:nth-child(3) { transition-delay: 0.4s; }
.slide.is-active .section-cover-content > *:nth-child(4) { transition-delay: 0.55s; }
.slide.is-active .section-cover-content > *:nth-child(5) { transition-delay: 0.75s; }

/* Stagger for slide content */
.slide.is-active .slide-content > *:nth-child(1) { transition-delay: 0.15s; }
.slide.is-active .slide-content > *:nth-child(2) { transition-delay: 0.25s; }
.slide.is-active .slide-content > *:nth-child(3) { transition-delay: 0.35s; }
.slide.is-active .slide-content > *:nth-child(4) { transition-delay: 0.45s; }
.slide.is-active .slide-content > *:nth-child(5) { transition-delay: 0.55s; }
.slide.is-active .slide-content > *:nth-child(6) { transition-delay: 0.65s; }
.slide.is-active .slide-visual { transition-delay: 0.10s; }

/* Stagger for cover */
.slide.is-active .cover-content > *:nth-child(1) { transition-delay: 0.2s; }
.slide.is-active .cover-content > *:nth-child(2) { transition-delay: 0.4s; }
.slide.is-active .cover-content > *:nth-child(3) { transition-delay: 0.6s; }

/* Stagger for TOC items */
.slide.is-active .toc-item:nth-child(1) { transition-delay: 0.2s; }
.slide.is-active .toc-item:nth-child(2) { transition-delay: 0.3s; }
.slide.is-active .toc-item:nth-child(3) { transition-delay: 0.4s; }
.slide.is-active .toc-item:nth-child(4) { transition-delay: 0.5s; }
.slide.is-active .toc-item:nth-child(5) { transition-delay: 0.6s; }
.slide.is-active .toc-item:nth-child(6) { transition-delay: 0.7s; }
.slide.is-active .toc-item:nth-child(7) { transition-delay: 0.8s; }
.slide.is-active .toc-item:nth-child(8) { transition-delay: 0.9s; }

/* Intro slide entrance */
.slide.intro .intro-logo,
.slide.intro h1,
.slide.intro .intro-meta {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide.intro.is-active .intro-logo,
.slide.intro.is-active h1,
.slide.intro.is-active .intro-meta {
    opacity: 1;
    transform: translateY(0);
}

.slide.intro.is-active .intro-logo { transition-delay: 0.1s; }
.slide.intro.is-active h1 { transition-delay: 0.4s; }
.slide.intro.is-active .intro-meta { transition-delay: 0.7s; }

/* TOC header entrance */
.slide.toc .toc-header > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.slide.toc.is-active .toc-header > * {
    opacity: 1;
    transform: translateY(0);
}

.slide.toc.is-active .toc-header > *:nth-child(1) { transition-delay: 0.1s; }
.slide.toc.is-active .toc-header > *:nth-child(2) { transition-delay: 0.2s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
    :root {
        --pad-y-top: 5rem;
        --pad-y-bottom: 5rem;
    }

    .page-split-left,
    .page-split-right {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        align-content: center;
    }

    .slide-visual {
        aspect-ratio: 16 / 10;
        max-height: 40vh;
    }

    .slide-content { max-width: 100%; }

    .dot-nav { right: 0.75rem; }
    .dot-nav button::before { display: none; }

    .gallery-count-3,
    .gallery-count-5,
    .gallery-count-6 { grid-template-columns: repeat(2, 1fr); }

    .slide.intro .intro-meta {
        gap: 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .toc-item {
        gap: 1rem;
        padding: 1.2rem 0.25rem;
    }

    .toc-item:hover { padding-left: 0.75rem; }

    .top-actions { gap: 1rem; }

    .toc-link span { display: none; }

    .page-arrow { width: 38px; height: 38px; }
    .page-arrow-prev { left: 0.75rem; }
    .page-arrow-next { right: 3rem; }

    .section-cover-number {
        font-size: clamp(15rem, 50vw, 25rem);
        opacity: 0.7;
    }

    .section-bullets li { font-size: 0.95rem; }
}

@media (max-width: 600px) {
    .top-bar { padding: 0.75rem 1rem; }
    .brand img { height: 28px; }
    .hint { display: none; }
    .toc-link { display: none; }
}

/* Project pages within section slides are clickable (opens detail modal) */
.section-slide .page:not(.page-section-cover) {
    cursor: pointer;
}

/* But interactive children keep their own cursor */
.section-slide .page a,
.section-slide .page button { cursor: pointer; }

/* ============================================================
   MODAL
   ============================================================ */
body.modal-open { overflow: hidden; }
body.modal-open .deck { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 10, 0.82);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--fg-0);
    display: grid;
    place-items: center;
    transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.modal-close:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: rotate(90deg);
}

.modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    max-height: calc(100vh - 4rem);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow-y: auto;
    box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.02);
    transform: scale(0.96) translateY(10px);
    transition: transform 0.4s var(--ease);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.modal.is-open .modal-panel {
    transform: scale(1) translateY(0);
}

.modal-panel::-webkit-scrollbar { width: 8px; }
.modal-panel::-webkit-scrollbar-track { background: transparent; }
.modal-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
.modal-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.modal-body {
    padding: 3.5rem clamp(2rem, 5vw, 4rem) 4rem;
}

/* ---- Modal header ---- */
.modal-header {
    margin-bottom: 2.5rem;
}

.modal-eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.modal-eyebrow .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.modal-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg-0);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.modal-tagline {
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: var(--fg-1);
    line-height: 1.65;
    max-width: 65ch;
}

/* ---- Modal hero image ---- */
.modal-hero {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--border);
    margin-bottom: 3rem;
}

.modal-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-hero.placeholder-bg {
    background:
        radial-gradient(circle at 25% 30%, rgba(79, 140, 255, 0.18), transparent 55%),
        radial-gradient(circle at 75% 70%, rgba(140, 79, 255, 0.12), transparent 55%),
        linear-gradient(135deg, var(--bg-1), var(--bg-0));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-2);
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

/* ---- Modal sections ---- */
.modal-section {
    padding-top: 2.5rem;
    margin-bottom: 2.5rem;
    border-top: 1px solid var(--border);
}

.modal-section:first-of-type:not(.modal-header) {
    padding-top: 0;
    border-top: none;
}

.modal-section h3 {
    font-size: 0.78rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--fg-2);
    font-weight: 600;
    margin-bottom: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-section h3::before {
    content: '';
    width: 20px;
    height: 1px;
    background: var(--accent);
}

.modal-section p {
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--fg-1);
    max-width: 70ch;
}

.modal-section p + p { margin-top: 1rem; }

.modal-features {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem 2rem;
}

.modal-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--fg-1);
    font-size: 0.98rem;
    line-height: 1.5;
}

.modal-features li::before {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    background: rgba(79, 140, 255, 0.15);
    border: 1px solid rgba(79, 140, 255, 0.4);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%234f8cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='2.5 6 5 8.5 9.5 4'/></svg>");
    background-position: center;
    background-repeat: no-repeat;
}

.modal-feature-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.modal-feature-card {
    padding: 1.25rem 1.5rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.modal-feature-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg-0);
    margin-bottom: 0.5rem;
}

.modal-feature-card p {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--fg-1);
}

.modal-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.modal-gallery-cell {
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--border);
}

.modal-gallery-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.modal-gallery-cell:hover img {
    transform: scale(1.03);
}

.modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.modal-tech span {
    padding: 0.5rem 1rem;
    border-radius: 7px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--fg-1);
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 2rem;
    padding: 1rem 1.75rem;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px var(--accent-glow);
}

/* Responsive modal */
@media (max-width: 760px) {
    .modal { padding: 1rem; }
    .modal-body { padding: 2.5rem 1.5rem 2.5rem; }
    .modal-close { top: 1rem; right: 1rem; width: 38px; height: 38px; }
    .modal-features,
    .modal-feature-cards,
    .modal-gallery { grid-template-columns: 1fr; }
}
