/* Project Detail Page (Dark Theme) */
.project-detail {
    padding-top: 140px;
    padding-bottom: 120px;
    position: relative;
    z-index: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    background: rgba(34, 211, 238, 0.07);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(0, 240, 255, 0.1);
}

.back-link:hover {
    color: var(--bg-dark);
    background: var(--primary);
    box-shadow: none;
    transform: translateX(-3px);
}

.project-article {
    max-width: 900px;
    margin: 0 auto;
    background: #101820;
    padding: 3rem;
    border-radius: 18px;
    border: 1px solid var(--border-glass);
    backdrop-filter: none;
}

.project-header {
    margin-bottom: 3rem;
    text-align: center;
}

.project-header h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    background: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: currentColor;
}

.project-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    color: var(--text-muted);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.tags span {
    padding: 6px 16px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--primary);
    border: 1px solid rgba(34, 211, 238, 0.22);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 1px;
    white-space: nowrap;
}

.project-figure {
    width: min(100%, 820px);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 3rem;
    position: relative;
}

.project-figure::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.project-figure img {
    width: 100%;
    max-height: 640px;
    object-fit: contain;
    background: #0c1218;
    border-radius: 16px;
    display: block;
    border: 1px solid var(--border-glass);
}

.project-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.article-toc {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 1rem 0.85rem;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    background: #111a23;
    backdrop-filter: none;
}

.article-toc::-webkit-scrollbar,
.article-toc-list::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.article-toc-title {
    margin: 0 0 0.75rem;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.article-toc-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-toc a {
    display: block;
    padding: 0.45rem 0.55rem;
    border-left: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.article-toc a.level-3 {
    padding-left: 1.1rem;
    font-size: 0.76rem;
}

.article-toc a:hover,
.article-toc a.active {
    border-left-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 240, 255, 0.06);
}

.project-content h2,
.project-content h3 {
    scroll-margin-top: 110px;
}

/* Keep portrait screenshots and certificates readable without taking over the page. */
.project-figure.portrait-figure img {
    width: auto;
    max-width: 100%;
    max-height: 600px;
    margin: 0 auto;
    object-fit: contain;
}

.project-figure.video-figure {
    width: min(100%, 760px);
}

.project-figure video {
    display: block;
    width: 100%;
    max-height: 460px;
    margin: 0 auto;
    object-fit: contain;
    background: #0c1218;
    border: 1px solid var(--border-glass);
    border-radius: 14px;
}

/* App screenshots use a framed phone-like presentation so the image and its
   surrounding container share the same visual proportions. */
.app-figure {
    width: min(100%, 600px);
    padding: 1rem;
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    background: #0c1218;
}

.app-figure::after {
    inset: 1rem;
    border-radius: 12px;
}

.app-figure img {
    max-height: 620px;
    border-radius: 12px;
}

.project-figure figcaption {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.project-content h2 {
    font-size: 2rem;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-main);
}

.project-content h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.project-content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1.1rem;
}

.project-content ul {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.project-content li {
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1.05rem;
}

.project-content li::marker {
    color: var(--primary);
}

.architecture-diagram {
    background: #0c1218;
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
    border: 1px solid var(--border-glass);
}

.architecture-diagram img {
    width: 100%;
    border-radius: 8px;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.architecture-diagram img:hover {
    opacity: 1;
}

/* Challenge Section */
.challenge {
    background: rgba(248, 113, 113, 0.06);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--accent);
}

.challenge h3 {
    margin-top: 0;
    color: var(--text-main);
}

/* Results */
.results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin: 3rem 0;
}

.result-item {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: rgba(0, 240, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(0, 240, 255, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.result-item:hover {
    transform: translateY(-3px);
    box-shadow: none;
    background: rgba(34, 211, 238, 0.07);
}

.result-number {
    display: block;
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary);
    background: none;
    -webkit-background-clip: text;
    -webkit-text-fill-color: currentColor;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-label {
    color: var(--text-muted);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Specs Table */
.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.specs-table th,
.specs-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-muted);
}

.specs-table th {
    background: rgba(34, 211, 238, 0.08);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.specs-table tr:last-child td {
    border-bottom: none;
}

.specs-table tr:hover td {
    background: rgba(0, 240, 255, 0.03);
}

/* Code Block */
.code-block {
    margin: 2rem 0;
    background: #0c1218;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
}

.code-header {
    padding: 0.8rem 1.2rem;
    background: rgba(34, 211, 238, 0.08);
    border-bottom: 1px solid var(--border-glass);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
}

.code-block code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* highlight.js token colors, kept close to the site's cyan/blue palette. */
.code-block code.hljs,
.code-block .hljs { color: #d7e2ec; background: transparent; }
.code-block .hljs-comment,
.code-block .hljs-quote { color: #71879a; font-style: italic; }
.code-block .hljs-keyword,
.code-block .hljs-selector-tag,
.code-block .hljs-literal { color: #67e8f9; }
.code-block .hljs-string,
.code-block .hljs-attr { color: #a7f3d0; }
.code-block .hljs-number,
.code-block .hljs-variable,
.code-block .hljs-template-variable { color: #fbbf77; }
.code-block .hljs-title,
.code-block .hljs-title.function_,
.code-block .hljs-type { color: #93c5fd; }
.code-block .hljs-built_in,
.code-block .hljs-meta { color: #c4b5fd; }

/* Project Subtitle */
.project-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Resource List */
.resource-list {
    list-style: none;
    padding: 0;
}

.resource-list li {
    padding: 1rem 1.5rem;
    margin-bottom: 0.8rem;
    background: rgba(34, 211, 238, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.resource-list li strong {
    color: var(--primary);
}

/* Inline Code */
code {
    background: rgba(34, 211, 238, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

@media (max-width: 768px) {
    .project-layout { display: block; }
    .article-toc {
        position: static;
        max-height: none;
        margin-bottom: 1.5rem;
        padding: 0.85rem;
    }
    .article-toc-list {
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0.35rem;
        padding-bottom: 0.25rem;
    }
    .article-toc a,
    .article-toc a.level-3 {
        min-width: max-content;
        padding: 0.45rem 0.7rem;
        border: 1px solid var(--border-glass);
        border-radius: 999px;
        font-size: 0.78rem;
    }
    .article-toc a:hover,
    .article-toc a.active {
        border-color: var(--primary);
    }
    .project-article { padding: 1.5rem; }
    .project-header h1 { font-size: 2.2rem; }
    .results { grid-template-columns: 1fr; }
    .specs-table { font-size: 0.9rem; }
    .specs-table th, .specs-table td { padding: 0.8rem; }
    .project-figure img { max-height: 520px; }
    .project-figure.portrait-figure img { max-height: 520px; }
    .app-figure { width: min(100%, 430px); padding: 0.75rem; }
    .app-figure::after { inset: 0.75rem; }
    .app-figure img { max-height: 560px; }
    .project-figure.video-figure { width: min(100%, 520px); }
    .project-figure video { max-height: 360px; }
}
