:root {
    /* Single source of truth for color tokens (Light Mode) */
    --bg: #fafafc;
    --card: #fff;
    --card-alt: #f3f4f6;
    --border: rgba(0, 0, 0, 0.1);
    --text: #1a1a1a;
    --muted: #4b5563;
    --muted-2: #6b7280;
    --blue: #3b82f6;
    --yellow: #ca8a04;
    --green: #16a34a;
}

[data-theme="dark"] {
    /* Single source of truth for color tokens (Dark Mode) */
    --bg: #0A0A0A;
    --card: #141414;
    --card-alt: #1A1D22;
    --border: rgba(255, 255, 255, 0.09);
    --text: #FFFFFF;
    --muted: #9CA3AF;
    --muted-2: #6B7280;
    --blue: #5B8DEF;
    --yellow: #EAB308;
    --green: #22C55E;
}

/* --- Global Resets & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Navigation (Mobile First) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.logo a {
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.2rem;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-btn {
    background: none;
    border: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.theme-btn:hover {
    opacity: 0.7;
}

.theme-text {
    display: none;
}

.hamburger {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Mobile Dropdown Menu */
.nav-links {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg);
    flex-direction: column;
    padding: 2rem 0;
    text-align: center;
    z-index: 1000;

    /* Hidden states for mobile */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.nav-links.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-links a {
    text-decoration: none;
    color: var(--muted);
    margin: 1rem 0;
    display: inline-block;
    width: 100%;
    font-size: 1.2rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

/* --- Base Layout (Mobile First) --- */
.hero-section,
.projects-container,
.wrap {
    flex: 1;
    width: 100%;
    padding: 2rem 5%;
    margin: 0 auto;
}

.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.hero-section h1,
.page-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--muted);
    margin-bottom: 2.5rem;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: var(--muted);
    font-size: 1.1rem;
}

/* --- Buttons --- */
.action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* --- Apple-Style Projects Grid --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    padding-top: 2rem;
}

.apple-card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: 450px;
    cursor: pointer;
}

[data-theme="dark"] .apple-card {
    background-color: #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.apple-card:hover {
    transform: scale(1.02);
}

.card-content {
    padding: 2.5rem 2rem 0 2rem;
    flex-grow: 1;
    z-index: 2;
}

.card-category {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    display: block;
    margin-bottom: 0.5rem;
}

.apple-card h3 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.card-desc {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.5;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1rem;
}

.card-image-wrapper {
    width: 100%;
    height: 250px;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background-color: var(--card-alt);
}

.card-image {
    width: auto;
    height: 90%;
    object-fit: contain;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

.card-link-icon {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    color: var(--text);
    background-color: var(--bg);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s;
    z-index: 3;
}

.card-link-icon:hover {
    opacity: 0.7;
}


/* --- Footer (Mobile First) --- */
.footer {
    border-top: 1px solid var(--border);
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 5%;
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

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

.social-links a {
    color: var(--muted);
    text-decoration: none;
    display: flex;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-links a:hover {
    color: var(--text);
    transform: translateY(-3px);
}

/* --- Tablet and Desktop Layout --- */
@media (min-width: 768px) {

    .hero-section,
    .projects-container,
    .wrap {
        margin: 4rem auto;
        max-width: 1000px;
    }

    .hero-section h1,
    .page-title {
        font-size: 3rem;
    }

    .hamburger {
        display: none;
    }

    .nav-links {
        display: flex;
        position: static;
        flex-direction: row;
        width: auto;
        padding: 0;
        background-color: transparent;
        box-shadow: none;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    .nav-links a {
        margin: 0 1rem;
        width: auto;
        font-size: 1rem;
        display: inline;
    }

    .theme-text {
        display: inline;
    }

    .footer {
        flex-direction: row;
        justify-content: space-between;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.eyebrow {
    font-size: 1rem;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================
   CASE STUDY SPECIFIC STYLES
   ========================================= */


.page-grid {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 48px;
    align-items: start;
}

@media (max-width: 860px) {
    .page-grid {
        grid-template-columns: 1fr;
    }

    .rail {
        display: none;
    }
}

/* Case Study Typography Overrides */
h1,
h2,
h3 {
    color: var(--text);
    margin: 0 0 0.4em 0;
    letter-spacing: -0.02em;
    font-weight: 800;
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
}

.case-study a {
    color: inherit;
    text-decoration: none;
}

.logo {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo .mark {
    color: var(--text);
}

.theme-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text);
    font-size: 16px;
}

/* Case Study Hero */
.hero {
    padding: 56px 0 40px 0;
}

.hero h1 {
    font-size: clamp(32px, 4.5vw, 48px);
    max-width: 16ch;
}

.hero .tagline {
    font-size: 17px;
    color: var(--muted);
    max-width: 60ch;
    margin-top: 14px;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.badge {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.badge.live {
    background: var(--green);
    color: #04140A;
    border-color: var(--green);
}

.hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.btn {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn.primary {
    background: var(--blue);
    color: #FFFFFF;
}

.btn.primary:hover {
    filter: brightness(1.1);
}

[data-theme="dark"] .btn.primary {
    background: #2563EB;
}

[data-theme="dark"] .btn.primary:hover {
    background: #3b76f0;
}

.btn.secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    border-color: var(--text);
}

/* Case Study Rail */
.rail {
    display: block;
    position: sticky;
    top: 40px;
    padding-top: 70px;
    border-left: 1px solid var(--border);
    padding-left: 20px;
}

.rail-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted-2);
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

.rail a {
    display: block;
    font-size: 13.5px;
    color: var(--muted);
    padding: 8px 0;
    border-left: 2px solid transparent;
    margin-left: -21px;
    padding-left: 19px;
    transition: color 0.15s, border-color 0.15s;
}

.rail a:hover,
.rail a.active {
    color: var(--text);
    border-left-color: var(--blue);
}

/* Case Study Section base */
.case-study section {
    padding: 52px 0;
    border-bottom: 1px solid var(--border);
}

.case-study section:last-of-type {
    border-bottom: none;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

section h2 {
    font-size: 26px;
}

.lede {
    font-size: 16px;
    max-width: 68ch;
    color: var(--muted);
}

/* Case Study Meta grid */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 26px;
}

@media (max-width: 700px) {
    .meta-grid {
        grid-template-columns: 1fr;
    }
}

.meta-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 20px;
}

.meta-card .k {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 6px;
}

.meta-card .v {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* Case Study Role split */
.role-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 26px;
}

@media (max-width: 700px) {
    .role-split {
        grid-template-columns: 1fr;
    }
}

.role-card {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
}

.role-card h3 {
    font-size: 17px;
}

.role-card ul {
    padding-left: 20px;
    margin: 12px 0 0 0;
}

.role-card li {
    margin-bottom: 8px;
    font-size: 14.5px;
    color: var(--muted);
}

.role-card.mine li::marker {
    color: var(--blue);
}

/* Case Study Sketch note (excalidraw) */
.sketch-note {
    margin-top: 22px;
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    padding: 22px 24px;
    position: relative;
}

.sketch-note::before {
    content: "✎ excalidraw session";
    position: absolute;
    top: -11px;
    left: 20px;
    background: var(--bg);
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sketch-note p {
    margin: 0;
    font-size: 14.5px;
    color: var(--muted);
}

/* Case Study Trello strip */
.trello-strip {
    margin-top: 26px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 700px) {
    .trello-strip {
        grid-template-columns: 1fr;
    }
}

.trello-col {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}

.trello-col-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 10px;
    letter-spacing: 0.05em;
}

.sticky {
    background: var(--card-alt);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    border-left: 3px solid var(--yellow);
}

.trello-col.doing .sticky {
    border-left-color: var(--blue);
}

.trello-col.done .sticky {
    border-left-color: var(--green);
    opacity: 0.8;
}

/* Case Study Features */
.feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    padding: 32px 0;
    border-top: 1px solid var(--border);
}

.feature:first-of-type {
    border-top: none;
}

.feature:nth-of-type(even) .feature-media {
    order: 2;
}

@media (max-width: 800px) {
    .feature {
        grid-template-columns: 1fr;
    }

    .feature:nth-of-type(even) .feature-media {
        order: 0;
    }
}

.feature-media {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-2);
    font-size: 12px;
    text-align: center;
    padding: 16px;
}

.feature-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: 8px;
}

.feature h3 {
    font-size: 19px;
}

.feature p {
    font-size: 14.5px;
    color: var(--muted);
}

/* Case Study Tags */
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tag {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
}

/* Case Study Decisions */
.decision {
    margin-top: 18px;
    padding: 18px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 0 14px 14px 0;
}

.decision .k {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 6px;
}

.decision p {
    margin: 0;
    font-size: 14.5px;
    color: var(--muted);
}

/* Case Study Impact */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 26px;
}

@media (max-width: 700px) {
    .impact-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.impact-stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.impact-stat .num {
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
}

.impact-stat .label {
    font-size: 12.5px;
    color: var(--muted-2);
    margin-top: 4px;
}

/* Case Study Reflection */
.reflection {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.reflection p {
    color: var(--muted);
    max-width: 65ch;
}

/* Case Study Footer nav */
.footer-nav {
    padding: 44px 0 70px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-nav a {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.footer-nav .back {
    color: var(--muted);
    font-weight: 500;
}

.footer-nav a:hover {
    color: var(--blue);
}

/* Mobile Override for Rail */
@media (max-width: 860px) {
    .rail {
        display: none !important;
    }
}
/* --- Feature Image Hover State --- */
.feature-media {
    padding: 0;
    overflow: hidden;
}

.zoomable-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.zoomable-image:hover {
    transform: scale(1.03);
}

/* --- Thumbnail Grid (On Page) --- */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    padding: 0;
    background: transparent;
    border: none;
}

.thumbnail-grid .zoomable-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.thumbnail-grid .zoomable-image:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.4);
}

/* --- Full-Screen Swipeable Lightbox --- */
.full-screen-lightbox {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    background: transparent;
    padding: 0;
    border: none;
    overflow: hidden;
}

.full-screen-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.95); 
}

/* The horizontal swipe track inside the modal */
.modal-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    align-items: center;
    scrollbar-width: none;
}

.modal-track::-webkit-scrollbar {
    display: none;
}

.modal-track img {
    flex: 0 0 100vw; 
    max-height: 90vh;
    object-fit: contain;
    scroll-snap-align: center;
    padding: 0 3rem; 
}

#close-modal {
    position: fixed;
    top: 25px;
    right: 25px;
    background: #ffffff;
    border: none;
    color: #000000;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s;
    z-index: 100;
}

#close-modal:hover {
    transform: scale(1.1);
}

.no-scroll {
    overflow: hidden;
}
/* --- Lightbox Navigation Arrows --- */
.nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1); 
    backdrop-filter: blur(4px); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.nav-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

#prev-btn {
    left: 20px;
}

#next-btn {
    right: 20px;
}

/* --- Custom Message Dialog --- */
.custom-dialog {
    background-color: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    margin: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.custom-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.custom-dialog .dialog-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    align-items: center;
}

.custom-dialog h3 {
    margin: 0;
    font-size: 1.5rem;
}

.custom-dialog p {
    color: var(--muted);
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
}

.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.stat-strip span {
    padding-left: 1.5rem;
    position: relative;
}

.stat-strip span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--blue);
}

