/* ==========================================================
   Project Detail — self-contained styles (HTML + JS only)
   ========================================================== */

:root {
    --primary: #00f0ff;
    --primary-2: #3b82f6;
    --bg: #0d1117;
    --bg-2: #161b22;
    --card: #1a2029;
    --border: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.25);
    --text: #e6edf3;
    --text-dim: #9aa7b4;
    --ok: #34d399;
    --warn: #fbbf24;
    --radius: 16px;
    --wrap: 1120px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', system-ui, sans-serif;
    background:
        radial-gradient(circle at 80% 0%, rgba(0, 240, 255, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 0% 60%, rgba(59, 130, 246, 0.07) 0%, transparent 45%),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

img { max-width: 100%; display: block; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 24px;
}

.wrap.narrow { max-width: 820px; }

.hidden { display: none !important; }

/* ---------- Reading progress bar ---------- */
.progress-bar-top {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    z-index: 999;
    transition: width 0.1s linear;
}

/* ---------- Loading / error state ---------- */
.state-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    transition: opacity 0.4s ease;
}
.state-screen.gone { opacity: 0; pointer-events: none; }
.state-inner { text-align: center; color: var(--text-dim); }
.spinner {
    width: 46px; height: 46px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 18px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-inner.error i { font-size: 3rem; color: var(--warn); display: block; margin-bottom: 12px; }
.state-inner .btn-solid { margin-top: 20px; }

/* ---------- Nav ---------- */
.detail-nav {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(13, 17, 23, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.25s ease, transform 0.25s ease;
}
.back-link:hover { color: var(--primary); transform: translateX(-3px); }
.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #061018;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 240, 255, 0.3); }

/* ---------- Content reveal ---------- */
.content-hidden { opacity: 0; }
#content { animation: fadeUp 0.6s ease both; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 20px; }
.pill {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--primary);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--border-glow);
    margin-bottom: 18px;
}
.hero-title {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #fff 30%, #7dd3fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-desc {
    font-size: 1.1rem;
    color: var(--text-dim);
    max-width: 720px;
    margin-bottom: 28px;
}
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin-bottom: 26px;
}
.hero-meta .meta-item { min-width: 110px; }
.hero-meta .meta-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.hero-meta .meta-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}
.hero-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Buttons ---------- */
.btn-solid, .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 24px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn-solid {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #061018;
}
.btn-solid:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0, 240, 255, 0.32); }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-3px); }

/* ---------- Sections ---------- */
.section { padding: 44px 0; }
.section-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 28px;
    position: relative;
    padding-bottom: 12px;
}
.section-title::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 54px; height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.lead-text { font-size: 1.08rem; color: var(--text-dim); }

/* ---------- Cover ---------- */
.cover-frame {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}
.cover-frame img { width: 100%; height: auto; }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px;
}
.stat-card {
    background: linear-gradient(160deg, var(--card), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 20px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.stat-card:hover { transform: translateY(-5px); border-color: var(--border-glow); }
.stat-card .num {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #7dd3fc);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-card .lbl { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }

/* ---------- Cards / panels ---------- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.panel {
    background: linear-gradient(160deg, var(--card), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
}
.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 20px;
}
.panel-title i { color: var(--primary); }

/* ---------- Check lists ---------- */
.check-list { list-style: none; display: grid; gap: 12px; }
.check-list li {
    position: relative;
    padding-left: 30px;
    color: var(--text);
}
.check-list li::before {
    position: absolute;
    left: 0; top: 3px;
    font-family: "bootstrap-icons";
    font-size: 1rem;
}
.check-list.ok li::before { content: "\F26E"; color: var(--ok); }
.check-list.warn li::before { content: "\F332"; color: var(--warn); }

/* ---------- Tech grid ---------- */
.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
}
.tech-item {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 12px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.tech-item:hover { transform: translateY(-5px); border-color: var(--border-glow); }
.tech-item i { font-size: 1.9rem; color: var(--primary); }
.tech-item span { display: block; margin-top: 10px; font-size: 0.88rem; font-weight: 500; }

/* ---------- Chips ---------- */
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.chip-grid.tight { gap: 8px; }
.chip {
    padding: 9px 16px;
    border-radius: 40px;
    font-size: 0.88rem;
    background: rgba(0, 240, 255, 0.07);
    border: 1px solid var(--border-glow);
    color: var(--text);
    transition: background 0.25s ease, transform 0.25s ease;
}
.chip:hover { background: rgba(0, 240, 255, 0.16); transform: translateY(-2px); }

/* ---------- Project info (timeline + side cards) ---------- */
.info-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 24px;
    align-items: start;
}
.info-side { display: grid; gap: 24px; }

/* Scoped to the project-detail page timeline (#timelineCard) so it does
   not leak into the index page's #experience .timeline */
#timelineCard .timeline {
    list-style: none;
    counter-reset: step;
    display: grid;
    gap: 4px;
}
#timelineCard .timeline li {
    position: relative;
    counter-increment: step;
    padding: 0 0 22px 44px;
    color: var(--text);
}
#timelineCard .timeline li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: -2px;
    width: 30px; height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    color: #061018;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
#timelineCard .timeline li::after {
    content: "";
    position: absolute;
    left: 14px; top: 30px;
    width: 2px; height: calc(100% - 30px);
    background: var(--border);
}
#timelineCard .timeline li:last-child { padding-bottom: 0; }
#timelineCard .timeline li:last-child::after { display: none; }

/* ---------- Architecture flow ---------- */
.arch-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.arch-node {
    background: linear-gradient(160deg, var(--card), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 26px;
    text-align: center;
    min-width: 150px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.arch-node:hover { transform: translateY(-5px); border-color: var(--border-glow); }
.arch-node i { font-size: 1.8rem; color: var(--primary); }
.arch-node span { display: block; margin-top: 8px; font-weight: 600; font-size: 0.95rem; }
.arch-arrow { color: var(--text-dim); font-size: 1.4rem; padding: 0 4px; }

/* ---------- Performance ---------- */
.perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}
.perf-card {
    background: linear-gradient(160deg, var(--card), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 20px;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.perf-card:hover { transform: translateY(-5px); border-color: var(--border-glow); }
.perf-card i { font-size: 1.9rem; color: var(--primary); }
.perf-card .p-val { font-size: 1.5rem; font-weight: 800; margin: 10px 0 2px; }
.perf-card .p-lbl { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- API list ---------- */
.api-list { display: grid; gap: 12px; }
.api-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.api-method {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}
.api-method.GET { background: rgba(52, 211, 153, 0.15); color: var(--ok); }
.api-method.POST { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.api-method.PUT { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.api-method.DELETE { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.api-url { font-family: ui-monospace, monospace; font-size: 0.9rem; color: var(--text); }
.api-desc { color: var(--text-dim); font-size: 0.85rem; width: 100%; }

/* ---------- Gallery ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.gallery-item {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: var(--bg-2);
}
.gallery-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.gallery-item:hover img { transform: scale(1.07); }

/* ---------- Lightbox ---------- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    animation: fade 0.3s ease;
}
.lightbox.show { display: block; }
.lightbox img {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 92%;
    max-height: 86%;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.3);
}
.lightbox-close {
    position: absolute;
    top: 22px; right: 34px;
    font-size: 42px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.3s ease, color 0.3s ease;
}
.lightbox-close:hover { color: var(--primary); transform: rotate(90deg); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- CTA ---------- */
.cta-section { padding-bottom: 80px; }
.cta-card {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(59, 130, 246, 0.08));
    border: 1px solid var(--border-glow);
    border-radius: 24px;
    padding: 50px 40px;
    text-align: center;
}
.cta-card h2 { font-size: 1.8rem; margin-bottom: 10px; }
.cta-card p { color: var(--text-dim); margin-bottom: 26px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .two-col { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .arch-arrow { transform: rotate(90deg); }
    .arch-flow { flex-direction: column; }
    .arch-node { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    #content { animation: none; }
}
