:root {
    --bg-color: #f7f7f4;
    --surface-color: #ffffff;
    --text-color: #17191d;
    --text-muted: #61666f;
    --accent-color: #ed603f;
    --accent-soft: rgba(237, 96, 63, 0.12);
    --border-color: #dfdfd8;
    --card-bg: #ffffff;
    --shadow-soft: 0 12px 36px rgba(23, 25, 29, 0.07);
    --max-width-content: 920px;
    --sidebar-width: 190px;
    --gap: 34px;
    --header-height: 52px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding-top: calc(var(--header-height) + 8px);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.container-wide {
    max-width: calc(var(--max-width-content) + (var(--sidebar-width) + var(--gap)) * 2);
    margin: 0 auto;
    padding: 0 22px;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(247, 247, 244, 1.0);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(23, 25, 29, 0.04);
    z-index: 1000;
    min-height: var(--header-height);
    padding: 6px 0;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.logo img {
    height: 36px;
    display: block;
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    list-style: none;
}

.nav-menu li a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
    padding: 7px 9px;
    border-radius: 6px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.nav-menu li a:hover {
    color: var(--text-color);
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

.nav-menu li a.active {
    color: var(--accent-color);
    font-weight: 600;
    background-color: var(--accent-soft);
    border-color: rgba(237, 96, 63, 0.24);
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr minmax(0, var(--max-width-content)) 1fr;
    gap: var(--gap);
    align-items: start;
}

#content {
    grid-column: 2;
}

#content a:not(.site-link):not(.project-highlight-button):not(.download-link):not(.entry) {
    color: #2d6c72;
    font-weight: 600;
    text-decoration-color: rgba(45, 108, 114, 0.35);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

#content a:not(.site-link):not(.project-highlight-button):not(.download-link):not(.entry):hover {
    color: var(--accent-color);
    text-decoration-color: rgba(237, 96, 63, 0.55);
}

/* Sidebar & TOC */
.sidebar {
    position: sticky;
    top: 72px; /* Offset from header */
    padding-top: 22px;
    justify-self: end;
    width: var(--sidebar-width);
}

.nav-back {
    margin-bottom: 30px;
}

.nav-back-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-back-link:hover {
    color: var(--text-color);
}

.nav-back-link::before {
    content: "←";
    margin-right: 8px;
}

.toc-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.toc ul {
    list-style: none;
}

.toc ul li {
    margin-bottom: 6px;
}

.toc ul ul {
    margin-left: 15px;
    margin-top: 5px;
}

.toc a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    transition: color 0.2s, padding-left 0.2s;
    display: block;
}

.toc a:hover {
    color: var(--text-color);
}

.toc a.active {
    color: var(--accent-color);
    font-weight: 600;
    padding-left: 5px;
    border-left: 2px solid var(--accent-color);
}

.contact-sidebar {
    margin-top: 34px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-description {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
}

.contact-link {
    text-decoration: none;
    color: var(--accent-color);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--surface-color);
    transition: all 0.2s;
    text-align: center;
}

.contact-link:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

/* Main Content */
section {
    padding: 12px 0;
}

section + section {
    border-top: 1px solid var(--border-color);
}

section:last-of-type {
    border-bottom: none;
}

h1 {
    font-size: clamp(2rem, 4vw, 2.45rem);
    font-weight: 600;
    line-height: 1.05;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 8px;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 8px;
    margin-bottom: 8px;
}

p {
    margin-bottom: 10px;
    max-width: 78ch;
}

.meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.meta a {
    color: inherit;
    text-decoration: underline;
}

.intro {
    max-width: 840px;
    font-size: 1.02rem;
    line-height: 1.58;
    color: var(--text-color);
    font-weight: 400;
    text-align: left;
}

/* Specific Components */
.tip {
    background-color: var(--surface-color);
    padding: 13px 15px;
    border-left: 3px solid var(--accent-color);
    margin: 14px 0;
    font-size: 0.9rem;
    box-shadow: var(--shadow-soft);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 16px 0;
}

.card {
    background-color: var(--card-bg);
    padding: 16px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
}

.card h3 {
    margin-top: 0;
}

.note {
    font-style: italic;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.subsection {
}

.steps {
    display: grid;
    gap: 14px;
    margin: 16px 0 6px;
}

.step {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.5fr);
    align-items: start;
    gap: 18px;
    padding: 16px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.step p {
    margin: 0;
    line-height: 1.55;
    color: var(--text-color);
    order: 1;
}

.step img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background-color: #142536;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: none;
    order: 2;
}

.numbering {
    font-weight: 900;
}

.post-process {
    background-color: #fff9e6;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
}

.hero-image img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
}

video {
    width: 100%;
    border-radius: 8px;
}

/* Footer */
footer {
    padding: 28px 0 34px;
    border-top: 1px solid var(--border-color);
}

footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

footer a {
    color: var(--text-color);
    text-decoration: none;
}

.sig {
    height: 24px;
    margin-top: 15px;
    opacity: 0.6;
}

/* Responsive */
@media (max-width: 900px) {
    .layout-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    #content {
        order: 1;
        grid-column: auto;
        width: 100%;
    }
    .sidebar {
        order: 2;
        position: static;
        padding-top: 28px;
        padding-bottom: 10px;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        justify-self: auto;
        width: 100%;
    }
    .toc ul {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }
    .toc ul ul {
        display: none; /* Hide nested for simplified mobile view */
    }
    .toc-title {
        margin-bottom: 10px;
    }
    .contact-links {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .contact-link {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 600px) {
    .container-wide {
        padding: 0 16px;
    }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.35rem; }
    .intro {
        font-size: 1rem;
        line-height: 1.55;
    }
    .grid { grid-template-columns: 1fr; }
    .step {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }
    .step img { width: 100%; }
    body { padding-top: 0; }
    header { min-height: 50px; }
    .contact-sidebar {
        margin-top: 0;
    }
    .toc {
        display: none;
    }
}

@media (max-width: 760px) {
    body {
        padding-top: 0;
    }
    header {
        position: sticky;
    }
    .header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
    .nav-menu {
        justify-content: flex-start;
        margin-left: 0;
        max-width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-menu::-webkit-scrollbar {
        display: none;
    }
    .nav-menu li a {
        display: block;
        padding: 7px 10px;
        background-color: var(--card-bg);
    }
}

#lightbox {
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    padding: 20px;
}

#lightbox.active {
    display: flex;
}

#lightbox img {
    max-width: 90%;
    max-height: 80%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    cursor: zoom-out;
}

.lightbox-caption {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    text-align: center;
    max-width: 800px;
    font-weight: 300;
    line-height: 1.4;
}

.clickable {
    cursor: zoom-in;
    transition: transform 0.2s ease-in-out;
}

.clickable:hover {
    transform: scale(1.02);
}

/* Models List */
.models-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.model-item {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 22px;
    padding: 16px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.model-item:last-child {
    border-bottom: none;
}

.model-thumbnail img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: none;
    display: block;
}

.model-details h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.model-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.model-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 0.82rem;
}

.model-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-meta-label {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.model-meta-value {
    color: var(--text-color);
}

.model-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.download-link {
    text-decoration: none;
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-color);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.download-link::before {
    content: "↓";
    font-size: 1rem;
    font-weight: 400;
}

.download-link:hover {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

@media (max-width: 800px) {
    .model-item {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .model-thumbnail {
        max-width: none;
    }
}

@media (max-width: 520px) {
    .model-meta,
    .model-downloads {
        gap: 10px;
    }

    .model-meta-item {
        min-width: calc(50% - 10px);
    }

    .download-link,
    .contact-link {
        width: 100%;
    }

    .lightbox-caption {
        font-size: 0.95rem;
    }
}
