/* ============================================
   layer2.wiki - Bauhaus Blockchain Reference
   ============================================ */

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

:root {
    --bg: #faf5e8;
    --amber: #d4943a;
    --coral: #c45a4a;
    --gold: #e8b830;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5040;
    --code-bg: #f0e8d8;
    --rule-color: rgba(212, 148, 58, 0.3);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- HERO SECTION --- */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg);
    text-align: center;
    padding: 40px 20px;
}

.hero-shapes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    margin-bottom: 48px;
}

.shape {
    opacity: 0;
    transform: scale(0);
}

.shape-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--amber);
}

.shape-square {
    width: 108px;
    height: 108px;
    background-color: var(--coral);
}

.shape-triangle {
    width: 120px;
    height: 104px;
}

.shape-triangle svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 6vw, 64px);
    letter-spacing: 0.08em;
    color: var(--text-primary);
    opacity: 0;
    margin-bottom: 16px;
}

.hero-rule {
    width: 0;
    height: 3px;
    background-color: var(--amber);
    margin: 0 auto 24px;
}

.hero-subtitle {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 2vw, 20px);
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    opacity: 0;
}

/* Hero animations */
.shape.animate-in {
    animation: shapeEnter 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes shapeEnter {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    70% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.hero-title.animate-in {
    animation: fadeIn 400ms ease forwards;
}

.hero-subtitle.animate-in {
    animation: fadeIn 400ms ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hero-rule.animate-in {
    animation: ruleExpand 600ms ease forwards;
}

@keyframes ruleExpand {
    from { width: 0; }
    to { width: min(300px, 60vw); }
}

/* --- INDEX SECTION --- */
#index {
    max-width: 40em;
    margin: 0 auto;
    padding: 80px 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    margin-top: 80px;
}

.section-header:first-child {
    margin-top: 0;
}

.section-header h2 {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 4vw, 52px);
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.section-shape {
    flex-shrink: 0;
}

.section-shape-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--amber);
}

.section-shape-square {
    width: 36px;
    height: 36px;
    background-color: var(--coral);
}

.section-shape-triangle {
    width: 40px;
    height: 35px;
}

.section-shape-triangle svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Entry styles */
.entry {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    cursor: pointer;
}

.entry-shape {
    flex-shrink: 0;
    display: inline-block;
    margin-top: 6px;
    transition: transform 200ms ease;
}

.entry-shape-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--amber);
}

.entry-shape-square {
    width: 14px;
    height: 14px;
    background-color: var(--coral);
}

.entry-shape-triangle {
    width: 16px;
    height: 14px;
}

.entry-shape-triangle svg {
    display: block;
    width: 100%;
    height: 100%;
}

.entry-content {
    flex: 1;
}

.entry-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(18px, 2.5vw, 24px);
    letter-spacing: 0.02em;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.entry-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    transition: width 400ms ease;
}

[data-category="circle"] .entry-title::after {
    background-color: var(--amber);
}

[data-category="square"] .entry-title::after {
    background-color: var(--coral);
}

[data-category="triangle"] .entry-title::after {
    background-color: var(--gold);
}

.entry:hover .entry-title::after {
    width: 100%;
}

.entry:hover .entry-shape {
    transform: scale(1.2);
}

.entry-description {
    font-size: clamp(14px, 1.3vw, 16px);
    color: var(--text-secondary);
    line-height: 1.7;
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms ease, opacity 300ms ease, margin-top 300ms ease;
    opacity: 0;
    margin-top: 0;
}

.entry:hover .entry-description,
.entry.expanded .entry-description {
    max-height: 200px;
    opacity: 1;
    margin-top: 8px;
}

.entry-divider {
    border: none;
    height: 2px;
    background-color: var(--rule-color);
}

/* --- ARTICLE SECTION --- */
#article {
    max-width: 40em;
    margin: 0 auto;
    padding: 80px 20px;
}

.article-container {
    position: relative;
}

.article-marker {
    margin-bottom: 24px;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.article-marker.visible {
    opacity: 1;
    transform: translateX(0);
}

.article-shape-square {
    width: 40px;
    height: 40px;
    background-color: var(--coral);
}

.article-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 5vw, 48px);
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.article-rule {
    width: 100%;
    height: 3px;
    background-color: var(--amber);
    margin-bottom: 40px;
}

.article-body p {
    margin-bottom: 24px;
    color: var(--text-primary);
}

.article-body code {
    font-family: 'Fira Mono', monospace;
    font-size: 14px;
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 2px;
}

.article-section-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 28px);
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-top: 48px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.inline-shape {
    display: inline-block;
    flex-shrink: 0;
}

.inline-shape-square {
    width: 20px;
    height: 20px;
    background-color: var(--coral);
}

/* Pull quotes */
.pull-quote {
    position: relative;
    margin: 40px 0;
    padding-left: 28px;
    overflow: hidden;
}

.pull-quote-border {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: var(--coral);
    transform: skewY(0deg);
    transition: transform 300ms ease;
}

.pull-quote.visible .pull-quote-border {
    transform: skewY(3deg);
}

.pull-quote blockquote {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: normal;
}

/* --- GLOSSARY FOOTER --- */
#glossary {
    position: relative;
    padding: 80px 20px;
    overflow: hidden;
}

#glossary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #d4943a, #c45a4a, #e8b830);
    opacity: 0.10;
    pointer-events: none;
}

.glossary-container {
    max-width: 40em;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.glossary-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 4vw, 48px);
    letter-spacing: 0.02em;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 16px;
}

.glossary-rule {
    width: 100%;
    height: 3px;
    background-color: var(--amber);
    margin-bottom: 40px;
}

.glossary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: center;
}

.glossary-term {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    position: relative;
}

.glossary-label {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.4vw, 16px);
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.glossary-label::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    transition: width 400ms ease;
}

[data-category="circle"] .glossary-label::after {
    background-color: var(--amber);
}

[data-category="square"] .glossary-label::after {
    background-color: var(--coral);
}

[data-category="triangle"] .glossary-label::after {
    background-color: var(--gold);
}

.glossary-term:hover .glossary-label::after {
    width: 100%;
}

.glossary-shape {
    display: inline-block;
    flex-shrink: 0;
}

.glossary-shape-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--amber);
}

.glossary-shape-square {
    width: 9px;
    height: 9px;
    background-color: var(--coral);
}

.glossary-shape-triangle {
    width: 10px;
    height: 9px;
}

.glossary-shape-triangle svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .hero-shapes {
        gap: 24px;
    }

    .shape-circle {
        width: 80px;
        height: 80px;
    }

    .shape-square {
        width: 72px;
        height: 72px;
    }

    .shape-triangle {
        width: 80px;
        height: 70px;
    }

    #index,
    #article {
        padding: 40px 16px;
    }

    .section-header {
        margin-top: 48px;
    }

    .glossary-grid {
        gap: 4px 16px;
    }
}
