/* ============================================================
   recycle.wiki — Styles
   Palette: #059669 #ffffff #1f2937 #4b5563 #dc2626 #fef3c7 #f7f7f8 #e5e7eb #0284c7
   Fonts: Space Grotesk (Display), Merriweather (Body), Fira Code (Code)
   ============================================================ */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    font-family: 'Merriweather', Georgia, serif;
    font-size: 16px;
    line-height: 1.8;
    color: #1f2937;
    background: #ffffff;
}

/* ============================================================
   Sidebar
   ============================================================ */
#sidebar {
    width: 260px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #f7f7f8;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Custom scrollbar for sidebar */
#sidebar::-webkit-scrollbar {
    width: 4px;
}
#sidebar::-webkit-scrollbar-track {
    background: #f7f7f8;
}
#sidebar::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 2px;
}
#sidebar::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.logo-icon {
    font-size: 1.25rem;
    color: #059669;
}

.logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.site-tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.7rem;
    color: #4b5563;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* TOC Navigation */
.toc-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.toc-section {
    margin-bottom: 0;
}

.toc-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.toc-toggle:hover {
    background: rgba(5, 150, 105, 0.06);
    color: #059669;
}

.toc-arrow {
    font-size: 0.6rem;
    transition: transform 0.25s;
    display: inline-block;
    color: #4b5563;
}

.toc-toggle.expanded .toc-arrow {
    transform: rotate(90deg);
}

.toc-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.toc-list.expanded {
    max-height: 500px;
}

.toc-link {
    display: block;
    padding: 0.3rem 1.25rem 0.3rem 2.25rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    color: #4b5563;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.3s;
}

.toc-link:hover {
    color: #059669;
    background: rgba(5, 150, 105, 0.04);
    border-left-color: rgba(5, 150, 105, 0.3);
}

.toc-link.active {
    color: #059669;
    background: rgba(5, 150, 105, 0.07);
    border-left-color: #059669;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.68rem;
    color: #4b5563;
    line-height: 1.6;
}

/* ============================================================
   Main Content
   ============================================================ */
#main-content {
    min-width: 0;
    padding: 0;
    background: #ffffff;
}

/* Breadcrumb */
#breadcrumb {
    padding: 0.75rem 3rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
}

.breadcrumb-link {
    color: #0284c7;
    text-decoration: none;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: all 0.15s;
}

.breadcrumb-link:hover {
    text-decoration: underline;
    background: rgba(2, 132, 199, 0.06);
    border-radius: 2px;
}

.breadcrumb-sep {
    color: #4b5563;
    font-size: 0.75rem;
}

.breadcrumb-current {
    color: #4b5563;
    font-size: 0.82rem;
    font-family: 'Space Grotesk', sans-serif;
}

/* Content Header */
.content-header {
    max-width: 780px;
    padding: 2.5rem 3rem 1.5rem;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.page-subtitle {
    font-family: 'Merriweather', serif;
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.7;
    max-width: 680px;
}

/* Articles */
article {
    border-top: 2px solid #e5e7eb;
    padding: 0;
}

.article-title {
    max-width: 780px;
    padding: 2rem 3rem 0.5rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

/* Content Sections */
.content-section {
    max-width: 780px;
    padding: 1.5rem 3rem 0;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    letter-spacing: -0.01em;
}

.body-text {
    font-family: 'Merriweather', serif;
    font-size: 1rem;
    line-height: 1.8;
    color: #1f2937;
    margin-bottom: 1rem;
}

.body-text strong {
    font-weight: 700;
    color: #1f2937;
}

.body-text em {
    font-style: italic;
    color: #4b5563;
}

/* Inline Code */
code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    background: #f7f7f8;
    color: #1f2937;
    padding: 0.1em 0.35em;
    border-radius: 3px;
    border: 1px solid #e5e7eb;
}

/* Cross-Reference Links */
.cross-ref {
    color: #0284c7;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    transition: all 0.15s;
}

.cross-ref:hover {
    text-decoration-style: solid;
    background: rgba(2, 132, 199, 0.06);
    border-radius: 2px;
}

/* ============================================================
   Isometric Diagrams
   ============================================================ */
.iso-diagram-container {
    margin: 1.25rem 0 1.5rem;
    overflow-x: auto;
}

.iso-diagram {
    background: #f7f7f8;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 2rem 2rem 1.25rem;
    min-width: 400px;
}

.iso-process-chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Isometric Block System */
.iso-block {
    position: relative;
    width: 70px;
    height: 44px;
    cursor: default;
    transform-style: preserve-3d;
}

.iso-block .iso-face {
    position: absolute;
}

/* Top face */
.iso-block .iso-top {
    width: 70px;
    height: 44px;
    background: #059669;
    border-radius: 2px;
    transform: rotateX(60deg) rotateZ(-45deg) translateZ(0);
    transform-origin: center;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

/* Left face (darker) */
.iso-block .iso-left {
    width: 70px;
    height: 20px;
    background: #047857;
    position: absolute;
    top: 40px;
    left: 0;
    transform: rotateX(-30deg);
    transform-origin: top;
    border-radius: 0 0 2px 2px;
}

/* Right face (darkest) */
.iso-block .iso-right {
    width: 20px;
    height: 44px;
    background: #065f46;
    position: absolute;
    top: 0;
    right: -18px;
    transform: rotateY(60deg);
    transform-origin: left;
}

/* Secondary block variant */
.iso-block.iso-block-secondary .iso-top {
    background: #4b5563;
}
.iso-block.iso-block-secondary .iso-left {
    background: #374151;
}
.iso-block.iso-block-secondary .iso-right {
    background: #1f2937;
}

/* Warning block variant */
.iso-block.iso-block-warn .iso-top {
    background: #dc2626;
}
.iso-block.iso-block-warn .iso-left {
    background: #b91c1c;
}
.iso-block.iso-block-warn .iso-right {
    background: #991b1b;
}

/* Small block variant */
.iso-block.iso-block-small {
    width: 52px;
    height: 34px;
}
.iso-block.iso-block-small .iso-top {
    width: 52px;
    height: 34px;
}
.iso-block.iso-block-small .iso-left {
    width: 52px;
    height: 15px;
    top: 30px;
}
.iso-block.iso-block-small .iso-right {
    width: 15px;
    height: 34px;
    right: -13px;
}

/* Block Labels */
.iso-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.iso-block.iso-block-small .iso-label {
    font-size: 0.55rem;
}

/* Process Arrows */
.iso-arrow {
    font-size: 1.1rem;
    color: #4b5563;
    line-height: 1;
    padding: 0 0.1rem;
    font-weight: 300;
    flex-shrink: 0;
}

/* Diagram Caption */
.iso-caption {
    text-align: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    color: #4b5563;
    margin-top: 1rem;
    font-style: italic;
}

/* ============================================================
   Callout Boxes
   ============================================================ */
.callout {
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 1.25rem 0;
}

.callout-note {
    border-left: 4px solid #059669;
    background: #fef3c7;
}

.callout-warning {
    border-left: 4px solid #dc2626;
    background: rgba(220, 38, 38, 0.04);
}

.callout-see-also {
    border-left: 4px solid #0284c7;
    background: rgba(2, 132, 199, 0.04);
}

.callout-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 0.3rem;
}

.callout-note .callout-label {
    color: #059669;
}

.callout-warning .callout-label {
    color: #dc2626;
}

.callout-see-also .callout-label {
    color: #0284c7;
}

.callout p {
    font-family: 'Merriweather', serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #1f2937;
    margin: 0;
}

/* ============================================================
   Data Tables
   ============================================================ */
.data-table-wrapper {
    overflow-x: auto;
    margin: 1.25rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
}

.data-table caption {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    color: #4b5563;
    text-align: left;
    padding: 0 0 0.5rem;
    font-style: italic;
}

.data-table th {
    background: #f7f7f8;
    color: #1f2937;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    text-align: left;
    border: 1px solid #e5e7eb;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.data-table td {
    padding: 0.55rem 0.9rem;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    vertical-align: top;
    line-height: 1.5;
}

.data-table tbody tr:nth-child(even) {
    background: #f7f7f8;
}

.data-table tbody tr:hover {
    background: rgba(5, 150, 105, 0.04);
}

/* ============================================================
   Footer
   ============================================================ */
.content-footer {
    border-top: 2px solid #e5e7eb;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 780px;
    padding: 2rem 3rem;
}

.footer-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    color: #4b5563;
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.footer-meta {
    font-size: 0.75rem;
    color: #9ca3af;
}

.footer-links {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    color: #4b5563;
    margin-top: 0.75rem;
}

.footer-links .cross-ref {
    font-size: 0.8rem;
}

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

    #sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        z-index: 100;
        height: 100vh;
        transition: left 0.3s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    }

    #sidebar.open {
        left: 0;
    }

    #breadcrumb {
        padding: 0.75rem 1.5rem;
    }

    .content-header,
    .content-section,
    .article-title {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .footer-inner {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .iso-diagram {
        padding: 1rem;
    }

    .iso-process-chain {
        gap: 0.25rem;
    }
}
