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

:root {
    --bg: #FAFAF9;
    --text: #1A1A1A;
    --text-muted: #6B6B6B;
    --accent: #2D2D2D;
    --border: #E5E5E5;
    --card-bg: #FFFFFF;
    --tag-bg: #F0F0F0;
    --code-bg: #1E1E1E;
    --highlight-green: #10B981;
    --highlight-blue: #3B82F6;
    --highlight-orange: #F59E0B;
    --highlight-red: #EF4444;
    --highlight-purple: #8B5CF6;
}

[data-theme="dark"] {
    --bg: #0F0F0F;
    --text: #E5E5E5;
    --text-muted: #A0A0A0;
    --accent: #E5E5E5;
    --border: #2A2A2A;
    --card-bg: #1A1A1A;
    --tag-bg: #252525;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(250, 250, 249, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] nav {
    background: rgba(15, 15, 15, 0.9);
}

nav .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

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

.back-link svg {
    width: 16px;
    height: 16px;
}

.logo {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* Hero */
.case-hero {
    padding: 10rem 2rem 5rem;
    max-width: 900px;
    margin: 0 auto;
}

.case-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.case-label span {
    width: 40px;
    height: 1px;
    background: var(--border);
}

.case-hero h1 {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

.case-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 680px;
    line-height: 1.6;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.meta-value {
    font-weight: 500;
}

/* Main Image */
.case-image-hero {
    max-width: 1100px;
    margin: 0 auto 5rem;
    padding: 0 2rem;
}

.case-image-hero img {
    display: block;
    width: 100%;
    height: auto;
}

/* Screenshots Gallery */
.screenshots-section {
    max-width: 1100px;
    margin: 4rem auto;
    padding: 0 2rem;
}

.screenshots-section h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.75rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text);
}

.screenshots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.screenshot-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.screenshot-item img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-caption {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Content */
.case-content {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 2rem;
}

.case-content h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin: 4rem 0 1.5rem;
}

.case-content h2:first-child {
    margin-top: 0;
}

.case-content h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 2.5rem 0 1rem;
}

.case-content p {
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.case-content strong {
    color: var(--text);
    font-weight: 500;
}

.case-content ul {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.case-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

/* Problem/Solution Cards */
.challenge-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(245, 158, 11, 0.08) 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--highlight-red);
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
}

.challenge-card h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 1rem 0;
    color: var(--text);
}

.challenge-card p {
    margin: 0;
    font-size: 1rem;
}

.challenge-card ul {
    margin: 1rem 0 0 0;
}

/* Architecture Diagram */
.architecture-visual {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    margin: 2.5rem 0;
}

.arch-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
}

.arch-layers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.arch-layer {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.arch-box {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    min-width: 120px;
}

.arch-box.frontend {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--highlight-blue);
}

.arch-box.backend {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--highlight-green);
}

.arch-box.data {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--highlight-purple);
}

.arch-box.service {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #B45309;
}

.arch-connector {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Feature Sections */
.feature-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.feature-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature-section-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-section-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--highlight-green);
}

.feature-section-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--highlight-blue);
}

.feature-section-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: #B45309;
}

.feature-section-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--highlight-purple);
}

.feature-section-icon svg {
    width: 22px;
    height: 22px;
}

.feature-section h4 {
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
}

.feature-section p {
    font-size: 0.95rem;
    margin: 0;
}

.feature-section ul {
    margin: 0;
    padding-left: 1.25rem;
}

.feature-section li {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

/* Tech Stack */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.tech-category h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

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

.tech-tag {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-weight: 400;
}

/* Impact Stats */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2.5rem 0;
}

.impact-stat {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.impact-number {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.impact-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Code Block */
.code-block {
    background: var(--code-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow-x: auto;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.code-block pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #E0E0E0;
    margin: 0;
}

.code-comment {
    color: #6A9955;
}

.code-keyword {
    color: #C586C0;
}

.code-string {
    color: #CE9178;
}

.code-decorator {
    color: #DCDCAA;
}

.code-function {
    color: #DCDCAA;
}

.code-class {
    color: #4EC9B0;
}

.code-variable {
    color: #9CDCFE;
}

/* NDA Notice */
.nda-notice {
    background: var(--tag-bg);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 3rem 0;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.nda-notice svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.nda-notice p {
    font-size: 0.95rem;
    margin: 0;
}

/* V2 Roadmap */
.roadmap-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
}

.roadmap-card h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.4rem;
    font-weight: 400;
    margin: 0 0 1rem 0;
}

.roadmap-card p {
    margin: 0 0 1rem 0;
}

.roadmap-card ul {
    margin: 0;
}

/* CTA */
.case-cta {
    text-align: center;
    padding: 5rem 2rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
}

.case-cta h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1rem;
}

.case-cta p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.25s ease;
    background: var(--card-bg);
    color: #fff;
}

.btn:hover {
    border-color: var(--text);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 900px) {
    .screenshots-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .tech-grid,
    .impact-grid {
        grid-template-columns: 1fr;
    }

    .case-meta {
        gap: 1.5rem;
    }

    .arch-layer {
        flex-direction: column;
        align-items: center;
    }

    .arch-box {
        width: 100%;
        max-width: 200px;
    }
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.theme-toggle:hover {
    background: var(--tag-bg);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--text);
    transition: all 0.3s ease;
}

.theme-toggle .sun-icon {
    position: absolute;
    opacity: 1;
}

.theme-toggle .moon-icon {
    position: absolute;
    opacity: 0;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 90;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .scroll-to-top {
    background: var(--accent);
    color: #000;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

.scroll-to-top::before {
    content: 'Back to top';
    position: absolute;
    right: 60px;
    background: var(--card-bg);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scroll-to-top:hover::before {
    opacity: 1;
    visibility: visible;
    right: 65px;
}

@media (max-width: 600px) {
    .scroll-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
    }

    .scroll-to-top::before {
        display: none;
    }
}
