:root {
    --bg-color: #0f1115;
    /* Deep professional dark */
    --text-color: #d1d5db;
    /* Light gray for readability */
    --heading-color: #f3f4f6;
    /* Near white for contrast */
    --accent-color: #bf00ff;
    /* Purple matching portfolio index */
    --accent-hover: #d033ff;
    --accent-glow: rgba(191, 0, 255, 0.4);
    --border-color: #1f2937;
    --blockquote-bg: #111827;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.8;
    /* Generous line height for long texts */
    font-size: 1.125rem;
}

/* Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--heading-color);
    line-height: 1.3;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 3.5rem;
}

h3 {
    font-size: 1.35rem;
    color: var(--accent-color);
    margin-top: 2.5rem;
}

p {
    margin-bottom: 1.5rem;
}

/* UI Elements */
.role-tag {
    display: inline-block;
    background-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    color: #fff;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.75rem;
}

blockquote {
    background-color: var(--blockquote-bg);
    border-left: 4px solid var(--accent-color);
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #9ca3af;
    border-radius: 0 8px 8px 0;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* Placeholders */
.media-placeholder {
    width: 100%;
    background-color: #1f2937;
    border: 2px dashed #374151;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-weight: 600;
    margin: 2.5rem 0;
    min-height: 350px;
    text-align: center;
    padding: 1rem;
    transition: border-color 0.3s;
}

.media-placeholder:hover {
    border-color: #4b5563;
}

.media-placeholder img,
.media-placeholder video {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Media & Showcase */
.hero-media {
    width: 100%;
    margin: 2rem 0 2.5rem 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background-color: #0b0d11;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.hero-media img,
.hero-media video {
    width: 100%;
    height: auto;
    display: block;
}

/* Footer & Links */
footer {
    margin-top: 5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    margin: 0.5rem;
    transition: all 0.25s ease;
}

.btn:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
    text-decoration: none;
    color: #fff;
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 3rem;
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

/* Carousel Component */
.carousel-container {
    position: relative;
    width: 100%;
    margin: 2.5rem 0 1.5rem 0;
    border-radius: 10px;
    overflow: hidden;
    background-color: #11141a;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    user-select: none;
    outline: none;
}

.carousel-container:focus-visible {
    border-color: var(--accent-color);
}

.carousel-track {
    display: flex;
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
    width: 100%;
}

.carousel-slide {
    min-width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    background-color: #161922;
    color: #9ca3af;
    text-align: center;
    padding: 1.5rem;
    position: relative;
}

.carousel-slide .slide-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border: 2px dashed #374151;
    border-radius: 8px;
    width: 100%;
    height: 100%;
    min-height: 320px;
    padding: 1.5rem;
    background-color: rgba(17, 24, 39, 0.5);
    transition: border-color 0.3s, background-color 0.3s;
}

.carousel-slide .slide-placeholder:hover {
    border-color: var(--accent-color);
    background-color: rgba(17, 24, 39, 0.8);
    color: #e5e7eb;
}

.carousel-slide .slide-placeholder .placeholder-icon {
    font-size: 2.5rem;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    cursor: zoom-in;
}

/* Navigation Arrows */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 17, 21, 0.75);
    backdrop-filter: blur(8px);
    color: #f3f4f6;
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.25s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    transform: translateY(-50%) scale(1.08);
}

.carousel-btn.prev {
    left: 14px;
}

.carousel-btn.next {
    right: 14px;
}

/* Dots Navigation */
.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.45);
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
}

.carousel-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.carousel-dot.active {
    background: var(--accent-color);
    width: 22px;
    border-radius: 6px;
}

.carousel-dot:hover:not(.active) {
    background: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    body {
        font-size: 1rem;
    }

    .media-placeholder {
        min-height: 250px;
    }

    .carousel-slide {
        min-height: 280px;
        padding: 1rem;
    }

    .carousel-slide .slide-placeholder {
        min-height: 240px;
    }

    .carousel-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* Simple Explication Box */
.carousel-caption-container {
    margin: 1.5rem 0 2rem 0;
    background-color: #161922;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.carousel-caption-item {
    display: none;
}

.carousel-caption-item.active {
    display: block;
}

.carousel-caption-item p {
    margin: 0;
    color: var(--text-color);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Image Zoom Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.image-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.image-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.image-modal.show .image-modal-content {
    transform: scale(1);
}

.image-modal.show .image-modal-content.zoomed {
    transform: scale(2.5);
    cursor: zoom-out;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
}
.title-banner {
    text-align: center;
    margin: 1.5rem 0 2rem 0;
}

.title-banner img {
    max-width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: contain;
    filter: drop-shadow(0 0 25px rgba(191, 0, 255, 0.45));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.title-banner img:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 35px rgba(191, 0, 255, 0.75));
}


/* =========================================================
   Case-study components (shared by all documentation pages)
   ========================================================= */
.pitch {
    font-size: 1.2rem;
    color: var(--heading-color);
    border-left: 4px solid var(--accent-color);
    padding: 0.25rem 0 0.25rem 1.25rem;
    margin: 1.5rem 0 2rem 0;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0 2rem 0;
    padding: 0;
    list-style: none;
}

.meta-grid li {
    background: #161922;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.meta-grid li span {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    margin-bottom: 0.2rem;
}

.toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem 0;
}

.toc a {
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    color: #9ca3af;
}

.toc a:hover {
    border-color: var(--accent-color);
    color: var(--heading-color);
    text-decoration: none;
}

.contrib-list {
    list-style: none;
    padding: 0;
}

.contrib-list > li {
    background: #13161d;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.contrib-list > li > strong:first-child {
    display: block;
    color: var(--heading-color);
    margin-bottom: 0.25rem;
}

/* Problem -> Action -> Result blocks */
.par {
    display: grid;
    gap: 0.75rem;
    margin: 1.5rem 0 2rem 0;
}

.par > div {
    background: #13161d;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.par > div > p:last-child,
.par > div > ul:last-child,
.par > div > ol:last-child {
    margin-bottom: 0;
}

.par-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    color: #9ca3af;
}

.par .problem { border-left: 4px solid #ef4444; }
.par .action  { border-left: 4px solid var(--accent-color); }
.par .result  { border-left: 4px solid #22c55e; }
.par .problem .par-label { color: #f87171; }
.par .action .par-label  { color: #d58cff; }
.par .result .par-label  { color: #4ade80; }

/* Data tables (playtest logs, matrices) */
.table-wrap {
    overflow-x: auto;
    margin: 1.5rem 0 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    line-height: 1.5;
}

table.data th,
table.data td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

table.data th {
    background: #161922;
    color: var(--heading-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

table.data tr:last-child td { border-bottom: none; }
table.data td.num { text-align: center; font-variant-numeric: tabular-nums; }

/* Flow diagrams built in HTML */
.flow {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
    margin: 1.5rem 0 2rem 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.flow li {
    flex: 1 1 140px;
    background: #161922;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    counter-increment: step;
}

.flow li::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.flow li b {
    display: block;
    color: var(--heading-color);
}

.code-block {
    background: #0b0d11;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #c4b5fd;
    margin: 1.5rem 0 2rem 0;
    white-space: pre;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0 2rem 0;
}

.two-col figure { margin: 0; }

.two-col img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: block;
    cursor: zoom-in;
}

figcaption {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.hero-media img { cursor: zoom-in; }

.takeaways {
    background: linear-gradient(135deg, rgba(191, 0, 255, 0.08), rgba(17, 24, 39, 0.6));
    border: 1px solid rgba(191, 0, 255, 0.3);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
}

.takeaways h3 { margin-top: 0; }
.takeaways ul { margin-bottom: 0; }

/* Content the author still has to fill in.
   Search the HTML for "todo" and delete the class once the text is real. */
.todo {
    background: rgba(245, 158, 11, 0.12);
    border: 1px dashed #f59e0b;
    color: #fbbf24;
    border-radius: 4px;
    padding: 0 0.3rem;
}

.media-placeholder.visual-todo {
    flex-direction: column;
    gap: 0.5rem;
    min-height: 200px;
    border-color: #f59e0b;
    color: #fbbf24;
    font-weight: 500;
    font-size: 0.95rem;
}

.media-placeholder.visual-todo strong {
    color: #fcd34d;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .pitch { font-size: 1.05rem; }
}
