/* ============================================================
   layer2.wiki — Bauhaus reference manual stylesheet
   Palette (sunset-warm):
     --bg            #faf5e8  warm white
     --amber         #d4943a  shape primary (circle)
     --coral         #c45a4a  shape primary (square)
     --gold          #e8b830  shape primary (triangle)
     --ink           #1a1a1a  text primary
     --warm-gray     #5a5040  text secondary
     --code-bg       #f0e8d8  code background
   Fonts: Jost (geometric sans), Fira Mono (monospace)
   ============================================================ */

:root {
    --bg: #faf5e8;
    --amber: #d4943a;
    --coral: #c45a4a;
    --gold: #e8b830;
    --ink: #1a1a1a;
    --warm-gray: #5a5040;
    --code-bg: #f0e8d8;
    --rule: rgba(212, 148, 58, 0.30);
    --rule-strong: #d4943a;
    --column: 40em;
    --gap-section: 80px;
    --line-height: 1.8;
    --ease-bauhaus: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Jost', 'Inter', system-ui, sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: var(--line-height);
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

code,
.reference-code {
    font-family: 'Fira Mono', ui-monospace, 'SF Mono', Consolas, monospace;
    font-size: 14px;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 1px;
    color: var(--ink);
    letter-spacing: 0;
}

.inline-link {
    color: var(--ink);
    text-decoration: none;
    background-image: linear-gradient(var(--coral), var(--coral));
    background-size: 0% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 400ms var(--ease-bauhaus);
    padding-bottom: 2px;
}

.inline-link:hover {
    background-size: 100% 2px;
}

/* ------------------------------------------------------------
   Hero / Opening Viewport
   ------------------------------------------------------------ */
.hero {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

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

.shape {
    width: 120px;
    height: 120px;
    transform-origin: center;
    opacity: 0;
    transform: scale(0);
}

.shape.is-in {
    animation: shapeBounce 600ms var(--ease-bauhaus) forwards;
}

.shape-circle {
    background: var(--amber);
    border-radius: 50%;
}

.shape-square {
    background: var(--coral);
}

.shape-triangle {
    background: transparent;
    width: 132px;
    height: 120px;
}

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

.shape-triangle svg polygon {
    fill: var(--gold);
}

.shape:nth-child(1) { animation-delay: 0ms; }
.shape:nth-child(2) { animation-delay: 200ms; }
.shape:nth-child(3) { animation-delay: 400ms; }

@keyframes shapeBounce {
    0%   { opacity: 0; transform: scale(0); }
    60%  { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1.0); }
}

.hero-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(40px, 7vw, 96px);
    letter-spacing: 0.06em;
    color: var(--ink);
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms var(--ease-bauhaus), transform 400ms var(--ease-bauhaus);
    transition-delay: 700ms;
}

.hero.is-ready .hero-title {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1.4vw, 17px);
    color: var(--warm-gray);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 400ms var(--ease-bauhaus);
    transition-delay: 900ms;
}

.hero.is-ready .hero-subtitle {
    opacity: 1;
}

.hero-rule {
    width: 0;
    height: 3px;
    background: var(--rule-strong);
    margin-bottom: 56px;
    transition: width 600ms var(--ease-bauhaus);
    transition-delay: 1100ms;
}

.hero.is-ready .hero-rule {
    width: min(40em, 70vw);
}

.hero-nav {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 400ms var(--ease-bauhaus);
    transition-delay: 1300ms;
}

.hero.is-ready .hero-nav {
    opacity: 1;
}

.hero-nav-link {
    color: var(--ink);
    text-decoration: none;
    position: relative;
    padding: 4px 0;
}

.hero-nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--coral);
    transition: width 400ms var(--ease-bauhaus);
}

.hero-nav-link:hover::after {
    width: 100%;
}

.hero-nav-dot {
    width: 6px;
    height: 6px;
    background: var(--amber);
    border-radius: 50%;
    display: inline-block;
}

/* ------------------------------------------------------------
   Generic Section Layout
   ------------------------------------------------------------ */
.section {
    max-width: var(--column);
    margin: 0 auto;
    padding: var(--gap-section) 24px;
}

.amber-rule {
    border: none;
    height: 3px;
    background: var(--rule-strong);
    width: min(40em, calc(100% - 48px));
    margin: 0 auto;
    opacity: 0.85;
    /* Sharp-angle motif: skew the divider very slightly */
    transform: skewY(-1.2deg);
}

.section-head {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    column-gap: 18px;
    margin-bottom: 36px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--rule);
}

.section-marker {
    width: 40px;
    height: 40px;
    display: inline-block;
    transform: scale(0.6);
    opacity: 0;
    transition: transform 500ms var(--ease-bauhaus), opacity 500ms var(--ease-bauhaus);
}

.section.in-view .section-marker,
.section-head-footer .section-marker {
    transform: scale(1);
    opacity: 1;
}

.section-marker-circle {
    background: var(--amber);
    border-radius: 50%;
}

.section-marker-square {
    background: var(--coral);
}

.section-marker-triangle {
    background:
        linear-gradient(to top right, transparent 49.5%, var(--gold) 50%) right top / 50% 100% no-repeat,
        linear-gradient(to top left,  transparent 49.5%, var(--gold) 50%) left  top / 50% 100% no-repeat;
    background-color: transparent;
}

.section-title {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 52px);
    letter-spacing: 0.02em;
    color: var(--ink);
    line-height: 1.05;
}

.section-meta {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: transparent;
    padding: 0;
    text-align: right;
}

.section-lede {
    font-size: clamp(16px, 1.4vw, 18px);
    color: var(--warm-gray);
    margin-bottom: 36px;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--ink);
}

.legend-shape {
    display: inline-block;
    width: 12px;
    height: 12px;
    vertical-align: middle;
}

.legend-shape.circle {
    background: var(--amber);
    border-radius: 50%;
}

.legend-shape.square {
    background: var(--coral);
}

.legend-shape.triangle {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 12px solid var(--gold);
    background: transparent;
}

/* ------------------------------------------------------------
   Index Section
   ------------------------------------------------------------ */
.index-list {
    list-style: none;
}

.entry {
    display: grid;
    grid-template-columns: 28px 1fr;
    align-items: start;
    column-gap: 18px;
    padding: 22px 4px;
    border-bottom: 2px solid var(--rule);
    cursor: pointer;
    position: relative;
}

.entry:last-child {
    border-bottom: none;
}

.entry-shape {
    width: 16px;
    height: 16px;
    margin-top: 10px;
    transition: transform 200ms var(--ease-bauhaus);
    display: inline-block;
}

.entry[data-category="circle"] .entry-shape {
    background: var(--amber);
    border-radius: 50%;
}

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

.entry[data-category="triangle"] .entry-shape {
    width: 0;
    height: 0;
    background: transparent;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 16px solid var(--gold);
    margin-top: 12px;
}

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

.entry-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.entry-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(20px, 2vw, 26px);
    letter-spacing: 0.02em;
    color: var(--ink);
    line-height: 1.3;
    position: relative;
    display: inline-block;
    align-self: flex-start;
    padding-bottom: 4px;
}

.entry-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--coral);
    transition: width 400ms var(--ease-bauhaus);
}

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

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

.entry-desc {
    color: var(--warm-gray);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 300ms var(--ease-bauhaus), opacity 300ms var(--ease-bauhaus), margin-top 300ms var(--ease-bauhaus);
    margin-top: 0;
}

.entry:hover .entry-desc,
.entry.is-active .entry-desc {
    max-height: 200px;
    opacity: 1;
    margin-top: 8px;
}

/* ------------------------------------------------------------
   Article Section
   ------------------------------------------------------------ */
.article-section {
    max-width: var(--column);
}

.article-lede {
    font-size: clamp(17px, 1.6vw, 20px);
    color: var(--ink);
    margin-bottom: 32px;
    font-weight: 400;
}

.article-h3 {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(20px, 2vw, 26px);
    letter-spacing: 0.02em;
    color: var(--ink);
    margin-top: 48px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.h3-marker {
    display: inline-block;
    width: 16px;
    height: 16px;
}

.h3-marker.circle  { background: var(--amber); border-radius: 50%; }
.h3-marker.square  { background: var(--coral); }
.h3-marker.triangle {
    width: 0; height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 16px solid var(--gold);
    background: transparent;
}

.article-section p {
    color: var(--ink);
    margin-bottom: 18px;
}

.article-section em {
    font-style: italic;
    color: var(--coral);
}

.article-coda {
    margin-top: 40px;
    color: var(--warm-gray);
    font-size: 0.95em;
}

/* Pull quote with sharp-angle left bar */
.pullquote {
    position: relative;
    margin: 40px 0;
    padding: 18px 24px 18px 36px;
    background: rgba(212, 148, 58, 0.06);
    overflow: hidden;
}

.pullquote-bar {
    position: absolute;
    left: 0;
    top: -8px;
    bottom: -8px;
    width: 6px;
    background: var(--coral);
    transform-origin: top left;
    transform: skewY(0deg);
    transition: transform 300ms var(--ease-bauhaus);
}

.pullquote.in-view .pullquote-bar {
    transform: skewY(3deg);
}

.pullquote-text {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(18px, 1.8vw, 22px);
    line-height: 1.55;
    color: var(--ink);
    letter-spacing: 0.01em;
}

/* Figure block */
.figure {
    margin: 48px 0;
    padding: 32px 16px;
    border-top: 2px solid var(--rule);
    border-bottom: 2px solid var(--rule);
    text-align: center;
}

.figure-diagram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 18px;
}

.diagram-shape {
    width: 40px;
    height: 40px;
    display: inline-block;
}

.diagram-shape.circle {
    background: var(--amber);
    border-radius: 50%;
}

.diagram-shape.square {
    background: var(--coral);
}

.diagram-shape.triangle {
    background: transparent;
    width: 44px;
    height: 40px;
}

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

.diagram-shape.triangle svg polygon {
    fill: var(--gold);
}

.diagram-arrow {
    color: var(--warm-gray);
    font-size: 24px;
    font-family: 'Fira Mono', monospace;
}

.figure-caption {
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------
   Reference Section (three primary cards, centered)
   ------------------------------------------------------------ */
.reference-section {
    max-width: 60em;
}

.reference-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 760px) {
    .reference-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

.reference-card {
    background: var(--bg);
    border: 2px solid var(--rule);
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    transition: border-color 300ms var(--ease-bauhaus), transform 300ms var(--ease-bauhaus);
}

.reference-card:hover {
    transform: translateY(-2px);
}

.reference-card[data-category="circle"]:hover { border-color: var(--amber); }
.reference-card[data-category="square"]:hover { border-color: var(--coral); }
.reference-card[data-category="triangle"]:hover { border-color: var(--gold); }

.reference-shape {
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
    transition: transform 300ms var(--ease-bauhaus);
}

.reference-card:hover .reference-shape {
    transform: scale(1.1) rotate(0deg);
}

.reference-card[data-category="circle"] .reference-shape {
    background: var(--amber);
    border-radius: 50%;
}

.reference-card[data-category="square"] .reference-shape {
    background: var(--coral);
}

.reference-card[data-category="triangle"] .reference-shape {
    background: transparent;
    width: 60px;
    height: 56px;
}

.reference-card[data-category="triangle"] .reference-shape svg {
    width: 100%;
    height: 100%;
}

.reference-card[data-category="triangle"] .reference-shape svg polygon {
    fill: var(--gold);
}

.reference-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.02em;
    color: var(--ink);
}

.reference-text {
    color: var(--warm-gray);
    font-size: 15px;
    line-height: 1.6;
    flex-grow: 1;
}

.reference-code {
    align-self: flex-start;
    margin-top: 4px;
}

/* ------------------------------------------------------------
   Glossary Footer
   ------------------------------------------------------------ */
.glossary {
    margin-top: var(--gap-section);
    padding: var(--gap-section) 24px;
    position: relative;
    isolation: isolate;
}

.glossary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--amber), var(--coral), var(--gold));
    opacity: 0.10;
    z-index: -1;
}

.glossary::after {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--rule-strong);
    transform: skewY(-0.8deg);
    transform-origin: left center;
}

.glossary-inner {
    max-width: var(--column);
    margin: 0 auto;
}

.section-head-footer {
    margin-bottom: 28px;
}

.glossary-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.term {
    display: grid;
    grid-template-columns: 24px auto 1fr;
    align-items: baseline;
    column-gap: 14px;
    padding: 12px 4px;
    border-bottom: 2px solid var(--rule);
    position: relative;
}

.term:last-child {
    border-bottom: none;
}

.term-shape {
    width: 12px;
    height: 12px;
    align-self: center;
    transition: transform 200ms var(--ease-bauhaus);
}

.term[data-category="circle"] .term-shape {
    background: var(--amber);
    border-radius: 50%;
}

.term[data-category="square"] .term-shape {
    background: var(--coral);
}

.term[data-category="triangle"] .term-shape {
    width: 0;
    height: 0;
    background: transparent;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 12px solid var(--gold);
}

.term-name {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 2px;
    align-self: center;
}

.term-name::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--coral);
    transition: width 400ms var(--ease-bauhaus);
}

.term[data-category="circle"] .term-name::after { background: var(--amber); }
.term[data-category="square"] .term-name::after { background: var(--coral); }
.term[data-category="triangle"] .term-name::after { background: var(--gold); }

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

.term:hover .term-shape {
    transform: scale(1.25);
}

.term-def {
    font-size: 14px;
    color: var(--warm-gray);
    line-height: 1.6;
    align-self: center;
}

.glossary-coda {
    margin-top: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Fira Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    justify-content: center;
}

.coda-shape {
    display: inline-block;
    width: 14px;
    height: 14px;
}

.coda-shape.circle {
    background: var(--amber);
    border-radius: 50%;
}

.coda-shape.square {
    background: var(--coral);
}

.coda-shape.triangle {
    background: transparent;
    width: 16px;
    height: 14px;
}

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

.coda-shape.triangle svg polygon {
    fill: var(--gold);
}

.coda-text {
    margin-left: 4px;
}

/* ------------------------------------------------------------
   Responsive adjustments
   ------------------------------------------------------------ */
@media (max-width: 600px) {
    .section-head {
        grid-template-columns: 32px 1fr;
        row-gap: 6px;
    }
    .section-head .section-meta {
        grid-column: 1 / -1;
        text-align: left;
    }
    .shape, .shape-triangle {
        width: 96px;
        height: 96px;
    }
    .shape-triangle {
        width: 108px;
    }
    .term {
        grid-template-columns: 20px auto;
        row-gap: 4px;
    }
    .term-def {
        grid-column: 1 / -1;
    }
    .figure-diagram {
        gap: 10px;
    }
    .diagram-shape {
        width: 28px;
        height: 28px;
    }
}
