/* ============================================
   LRX.wiki - License and Right eXchange
   Chrome-Metallic Zen Wiki Design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --silver-mist: #F0F2F5;
    --chrome-shine: #C0C8D0;
    --polished-steel: #8892A0;
    --dark-slate: #2C3E50;
    --white-chrome: #FFFFFF;
    --bright-chrome: #E8ECF0;
    --accent-teal: #4DB6AC;
    --deep-chrome: #607080;

    --font-heading: 'Jost', sans-serif;
    --font-body: 'Noto Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --sidebar-width: 60px;
    --sidebar-expanded: 200px;
    --block-gap: 12px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: var(--dark-slate);
    background-color: var(--silver-mist);
    overflow-x: hidden;
}

/* --- Sidebar Navigation --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white-chrome);
    border-right: 1px solid var(--chrome-shine);
    z-index: 100;
    transition: width 0.3s ease;
    overflow: hidden;
}

#sidebar:hover {
    width: var(--sidebar-expanded);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    gap: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    color: var(--deep-chrome);
}

.sidebar-item:hover {
    background-color: var(--bright-chrome);
    color: var(--accent-teal);
}

.sidebar-item.active {
    color: var(--accent-teal);
    background-color: var(--bright-chrome);
}

.sidebar-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-icon svg {
    color: inherit;
}

.sidebar-label {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: var(--dark-slate);
}

#sidebar:hover .sidebar-label {
    opacity: 1;
}

/* --- Main Content --- */
#main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

/* --- Hero Section --- */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--silver-mist);
    position: relative;
}

.hero-inner {
    text-align: center;
    max-width: 600px;
    padding: 0 24px;
}

.wordmark {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(48px, 8vw, 96px);
    color: var(--dark-slate);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.wordmark-wiki {
    color: var(--accent-teal);
    font-weight: 500;
}

.hero-tagline {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(14px, 1.5vw, 20px);
    color: var(--polished-steel);
    margin-bottom: 40px;
    letter-spacing: 0.02em;
}

.search-container {
    max-width: 480px;
    margin: 0 auto;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--white-chrome);
    border: 1px solid var(--chrome-shine);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field:hover {
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(77, 182, 172, 0.1);
}

.search-icon {
    flex-shrink: 0;
    color: var(--polished-steel);
}

.search-field input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--dark-slate);
    background: transparent;
    cursor: default;
}

.search-field input::placeholder {
    color: var(--chrome-shine);
}

/* --- Knowledge Section --- */
#knowledge-section {
    padding: 40px 40px 60px 40px;
    position: relative;
}

/* --- Grid Container with underlying grid lines --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: minmax(120px, auto);
    gap: var(--block-gap);
    position: relative;
    background-image:
        repeating-linear-gradient(
            to right,
            var(--bright-chrome) 0,
            var(--bright-chrome) 0.5px,
            transparent 0.5px,
            transparent 292px
        ),
        repeating-linear-gradient(
            to bottom,
            var(--bright-chrome) 0,
            var(--bright-chrome) 0.5px,
            transparent 0.5px,
            transparent 132px
        );
    background-size: 292px 132px;
    padding: 6px;
}

/* --- Knowledge Blocks --- */
.block {
    background: linear-gradient(to bottom, var(--white-chrome), #F8F9FA);
    border: 1px solid var(--chrome-shine);
    border-radius: 4px;
    padding: 20px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.3s ease, background 0.3s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(12px);
    overflow: hidden;
}

.block.visible {
    opacity: 1;
    transform: translateY(0);
}

.block:hover {
    background: linear-gradient(to bottom, var(--white-chrome), var(--silver-mist));
    box-shadow: 0 4px 16px rgba(44, 62, 80, 0.08);
}

/* Block sizes */
.block-large {
    grid-column: span 2;
    grid-row: span 2;
}

.block-medium {
    grid-column: span 2;
}

.block-small {
    grid-column: span 1;
}

/* Block header */
.block-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.block-icon {
    flex-shrink: 0;
}

.block-header h2 {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: clamp(16px, 2vw, 22px);
    color: var(--dark-slate);
    line-height: 1.3;
}

.block-subtitle {
    font-size: 13px;
    color: var(--polished-steel);
    margin-top: 4px;
    padding-left: 44px;
}

/* Progressive Disclosure */
.details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
    padding-top: 0;
}

.block.expanded .details {
    opacity: 1;
    padding-top: 16px;
}

.details p {
    margin-bottom: 10px;
    color: var(--dark-slate);
    line-height: 1.7;
}

.details p:last-child {
    margin-bottom: 0;
}

.details strong {
    font-weight: 500;
    color: var(--dark-slate);
}

/* Code references */
.code-ref {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.02em;
    background: var(--bright-chrome);
    padding: 6px 12px;
    border-radius: 3px;
    margin: 8px 0;
    display: inline-block;
    color: var(--deep-chrome);
}

.code-tag {
    color: var(--polished-steel);
    margin-right: 6px;
}

/* Fish Easter Eggs */
.fish-easter-egg {
    position: absolute;
    bottom: 8px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.block.expanded .fish-easter-egg {
    opacity: 1;
}

.block.expanded .fish-easter-egg svg {
    animation: swim 3s ease-in-out infinite;
}

@keyframes swim {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
}

/* --- Footer --- */
#footer {
    background: var(--white-chrome);
    border-top: 1px solid var(--chrome-shine);
    padding: 48px 40px 32px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

.footer-col h3 {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 13px;
    color: var(--polished-steel);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}

.footer-col a {
    display: block;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--deep-chrome);
    text-decoration: none;
    padding: 3px 0;
    transition: color 0.2s ease;
}

.footer-col a:hover {
    color: var(--accent-teal);
}

.footer-bottom {
    border-top: 1px solid var(--bright-chrome);
    padding-top: 20px;
    text-align: center;
}

.footer-note {
    font-family: var(--font-heading);
    font-size: 13px;
    color: var(--chrome-shine);
    letter-spacing: 0.02em;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #sidebar {
        display: none;
    }

    #main-content {
        margin-left: 0;
    }

    .block-large,
    .block-medium {
        grid-column: span 1;
    }

    .block-large {
        grid-row: span 1;
    }

    #knowledge-section {
        padding: 24px 16px 40px;
    }

    #footer {
        padding: 32px 16px 24px;
    }

    .footer-columns {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .hero-inner {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .footer-columns {
        grid-template-columns: 1fr;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--silver-mist);
}

::-webkit-scrollbar-thumb {
    background: var(--chrome-shine);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--polished-steel);
}

/* --- Selection --- */
::selection {
    background: rgba(77, 182, 172, 0.2);
    color: var(--dark-slate);
}
