/* ============================================================
   gabs.boo — a tutorial on the cost of things
   centered single-column scroll-essay; analogous warm earth;
   monospaced instructional voice, Cormorant pull-quotes
   ============================================================ */

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

:root {
    --parchment-bone: #F4ECDD;
    --plaster-cream: #E8D5B7;
    --terracotta-anchor: #C97B5C;
    --burnt-sienna: #A85A3E;
    --walnut-ink: #5C3A26;
    --bistre: #3A2820;
    --honeyed-sand: #D8A878;
    --travertine-wash: #EFE0C9;

    --column-width: min(640px, 86vw);

    --mono-body: 'JetBrains Mono', ui-monospace, monospace;
    --mono-banner: 'Space Mono', monospace;
    --mono-num: 'IBM Plex Mono', monospace;
    --serif-ghost: 'Cormorant Garamond', 'Lora', serif;
}

html {
    background-color: var(--parchment-bone);
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment-bone);
    color: var(--bistre);
    font-family: var(--mono-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.02vw + 0.6rem, 1.08rem);
    line-height: 1.78;
    letter-spacing: 0.005em;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

/* ---------- center axis (the sacred hairline) ---------- */
.axis {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100vh;
    background-color: var(--terracotta-anchor);
    opacity: 0.12;
    pointer-events: none;
    z-index: 1;
}

.meander {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 0;
    background-color: var(--terracotta-anchor);
    opacity: 0.8;
    pointer-events: none;
    z-index: 2;
    transition: height 80ms linear;
}

/* ---------- margin fragments (the field of fragments) ---------- */
.margin-fragments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.fragment {
    position: absolute;
    opacity: 0;
    transition: opacity 1200ms ease-out;
    pointer-events: none;
}

.fragment.visible {
    opacity: var(--frag-opacity, 0.16);
}

.fragment svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---------- masthead ---------- */
.masthead {
    width: var(--column-width);
    text-align: center;
    padding-top: 12vh;
    padding-bottom: 6vh;
    position: relative;
    z-index: 3;
}

.wordmark {
    font-family: var(--mono-body);
    font-weight: 800;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    letter-spacing: -0.04em;
    color: var(--bistre);
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.word-gabs,
.word-boo {
    display: inline-block;
}

.word-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.7em;
    height: 0.7em;
    margin: 0 0.04em;
    transform: translateY(0.18em);
    transition: transform 800ms ease;
}

.word-dot:hover {
    transform: translateY(0.18em) rotate(1deg);
}

.obol-glyph {
    width: 0.65em;
    height: 0.65em;
    display: block;
}

.masthead-sub {
    margin-top: 1.5rem;
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--walnut-ink);
    letter-spacing: 0.005em;
}

/* ---------- main column ---------- */
main {
    width: var(--column-width);
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------- reveal pattern (fade-reveal) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 560ms ease-out, transform 560ms ease-out;
    width: 100%;
}

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

/* ---------- banner & capital ---------- */
.banner,
.capital {
    width: 100%;
    text-align: center;
    padding: 2.2rem 0 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.capital {
    min-height: 18vh;
    padding-top: 4vh;
}

.banner-text {
    font-family: var(--mono-banner);
    font-weight: 700;
    font-size: clamp(0.78rem, 0.95vw, 0.92rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--bistre);
}

.rule {
    display: block;
    width: min(420px, 70%);
    height: 1px;
    background-color: var(--terracotta-anchor);
    opacity: 0.55;
}

/* ---------- prologue / epilogue / TOC text ---------- */
.prologue,
.epilogue {
    padding: 4vh 0 6vh;
    position: relative;
}

.prologue p,
.epilogue p {
    margin: 0 auto 1.4rem;
    text-align: left;
    color: var(--bistre);
}

.opening {
    font-style: italic;
    font-family: var(--serif-ghost);
    font-size: clamp(1.1rem, 1.6vw, 1.35rem) !important;
    line-height: 1.55;
    color: var(--walnut-ink) !important;
    margin-bottom: 2rem !important;
}

.lecturer-bust {
    margin: 3.5rem auto 1rem;
    width: clamp(160px, 24vw, 220px);
    text-align: center;
}

.lecturer-bust svg {
    width: 100%;
    height: auto;
    display: block;
}

.figure-label {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--walnut-ink);
    margin-top: 0.6rem;
    letter-spacing: 0.02em;
}

/* ---------- table of contents ---------- */
.toc {
    padding: 6vh 0;
}

.toc-list {
    list-style: none;
    width: 100%;
    margin: 2.5rem 0 0;
    padding: 0;
    counter-reset: toc;
}

.toc-list li {
    display: grid;
    grid-template-columns: 3em 1fr auto auto;
    gap: 0.8rem;
    align-items: baseline;
    padding: 0.45rem 0;
    font-size: 0.96rem;
}

.toc-num {
    font-family: var(--mono-num);
    font-weight: 500;
    color: var(--terracotta-anchor);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.toc-title {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--walnut-ink);
}

.toc-leader {
    border-bottom: 1px dotted var(--bistre);
    opacity: 0.45;
    align-self: baseline;
    margin-bottom: 0.4em;
    height: 0;
}

.toc-page {
    font-family: var(--mono-num);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--bistre);
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

/* ---------- lesson plinth ---------- */
.lesson {
    min-height: 88vh;
    padding: 4vh 0 6vh;
    position: relative;
    background-color: transparent;
}

.lesson::before {
    /* whisper-quiet marble veining via inline SVG mask */
    content: '';
    position: absolute;
    inset: 4vh 0 6vh 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='800' viewBox='0 0 600 800'><path d='M0,160 Q150,140 300,180 T600,160' stroke='%23A85A3E' stroke-width='1.2' fill='none' opacity='0.06'/><path d='M0,360 Q200,330 400,380 T600,360' stroke='%23A85A3E' stroke-width='0.9' fill='none' opacity='0.06'/><path d='M0,560 Q150,540 320,580 T600,560' stroke='%23A85A3E' stroke-width='1' fill='none' opacity='0.06'/><path d='M0,700 Q200,680 380,720 T600,700' stroke='%23A85A3E' stroke-width='0.7' fill='none' opacity='0.06'/></svg>");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 0;
}

.lesson > * {
    position: relative;
    z-index: 1;
}

.shaft {
    width: 100%;
    padding: 2rem 0;
    position: relative;
}

.shaft p {
    margin-bottom: 1.4rem;
    text-align: left;
}

.shaft p em {
    font-family: var(--serif-ghost);
    font-style: italic;
    color: var(--walnut-ink);
    font-size: 1.06em;
}

.lesson-objective {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: 1.04rem !important;
    line-height: 1.55 !important;
    color: var(--walnut-ink);
    border-left: 1px solid var(--terracotta-anchor);
    padding-left: 1rem;
    margin-bottom: 2rem !important;
}

.lesson-objective .label {
    font-family: var(--mono-banner);
    font-weight: 700;
    font-style: normal;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--terracotta-anchor);
    margin-right: 0.45em;
}

/* ---------- caryatid in margin ---------- */
.caryatid {
    position: absolute;
    right: -120px;
    top: 4rem;
    width: 80px;
    height: 320px;
    opacity: 0.6;
    pointer-events: none;
}

.caryatid svg {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 900px) {
    .caryatid {
        right: -90px;
        width: 60px;
        height: 240px;
        opacity: 0.4;
    }
}

@media (max-width: 700px) {
    .caryatid {
        display: none;
    }
}

/* ---------- comparison tables (mono) ---------- */
.comparison {
    font-family: var(--mono-num);
    font-size: 0.86rem;
    line-height: 1.55;
    background-color: var(--travertine-wash);
    color: var(--bistre);
    padding: 1.2rem 1rem;
    margin: 1.8rem 0;
    border-top: 1px solid var(--terracotta-anchor);
    border-bottom: 1px solid var(--terracotta-anchor);
    overflow-x: auto;
    font-variant-numeric: tabular-nums;
    white-space: pre;
    text-align: left;
}

/* ---------- pull-quote ---------- */
.pullquote {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    line-height: 1.32;
    color: var(--walnut-ink);
    text-align: center;
    margin: 3rem auto;
    padding: 2rem 0.5rem;
    max-width: 100%;
    border-top: 1px solid var(--terracotta-anchor);
    border-bottom: 1px solid var(--terracotta-anchor);
    position: relative;
}

.pullquote::before,
.pullquote::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 1px;
    background-color: var(--burnt-sienna);
    top: 50%;
}

.pullquote::before {
    left: 0;
}

.pullquote::after {
    right: 0;
}

/* ---------- lists with weighing-stones ---------- */
.goodwill-list,
.invisible-list {
    list-style: none;
    margin: 2rem 0;
    padding: 0;
    counter-reset: gw;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2rem;
    row-gap: 0.6rem;
}

.invisible-list {
    grid-template-columns: 1fr;
}

.goodwill-list li,
.invisible-list li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--mono-body);
    font-size: 0.96rem;
    color: var(--bistre);
    counter-increment: gw;
}

.goodwill-list li::before {
    content: counter(gw, decimal-leading-zero) ".";
    font-family: var(--mono-num);
    font-size: 0.78rem;
    color: var(--terracotta-anchor);
    font-variant-numeric: tabular-nums;
    min-width: 2.4em;
}

.invisible-list li strong {
    font-family: var(--mono-banner);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    color: var(--burnt-sienna);
    text-transform: uppercase;
}

/* the weighing-stone bullet */
.ws {
    width: 14px;
    height: 8px;
    background-color: var(--honeyed-sand);
    border: 1px solid var(--bistre);
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    transform: rotate(-12deg);
    opacity: 0.85;
}

@media (max-width: 600px) {
    .goodwill-list {
        grid-template-columns: 1fr;
    }
}

/* ---------- base / receipt ---------- */
.base {
    width: 100%;
    padding: 3rem 0 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.receipt {
    width: min(460px, 92%);
    background-color: var(--plaster-cream);
    border: 1px solid var(--bistre);
    padding: 1.6rem 1.4rem;
    transform: rotate(0.6deg);
    box-shadow: 0 1px 0 rgba(58, 40, 32, 0.05);
    text-align: left;
    position: relative;
}

.receipt::before,
.receipt::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background-image: linear-gradient(90deg, transparent 0, transparent 4px, var(--bistre) 4px, var(--bistre) 6px, transparent 6px);
    background-size: 12px 1px;
    background-repeat: repeat-x;
    background-position: 0 50%;
    opacity: 0.18;
}

.receipt::before {
    top: 4px;
}

.receipt::after {
    bottom: 4px;
}

.receipt-label {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--walnut-ink);
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--bistre);
    opacity: 0.95;
}

.receipt-rows {
    font-family: var(--mono-num);
    font-weight: 500;
    font-size: 0.84rem;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
    color: var(--bistre);
}

.r-row {
    display: grid;
    grid-template-columns: 1.7fr 0.4fr 1.1fr 0.7fr;
    gap: 0.4rem;
    align-items: baseline;
}

.r-row span:first-child {
    text-align: left;
}

.r-row span:nth-child(2) {
    text-align: right;
    color: var(--terracotta-anchor);
}

.r-row span:nth-child(3) {
    text-align: left;
    opacity: 0.85;
    font-size: 0.78rem;
}

.r-row span:last-child {
    text-align: right;
    color: var(--bistre);
}

.r-row.ghost {
    opacity: 0.55;
    font-style: italic;
}

.r-rule {
    width: 100%;
    height: 1px;
    background-color: var(--bistre);
    margin: 0.6rem 0;
    opacity: 0.6;
}

.r-total {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    font-family: var(--mono-num);
    font-weight: 600;
    font-size: 0.94rem;
    color: var(--terracotta-anchor);
    font-variant-numeric: tabular-nums;
}

.r-total span:first-child {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    color: var(--bistre);
}

.moral {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    color: var(--walnut-ink);
    margin-top: 2rem;
    text-align: center;
    max-width: 90%;
    line-height: 1.5;
}

/* ---------- interlude ---------- */
.interlude {
    min-height: 100vh;
    width: 100%;
    background-color: var(--travertine-wash);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4vh 0;
    position: relative;
}

.interlude-figure {
    width: clamp(240px, 36vw, 400px);
    height: auto;
    max-height: 70vh;
}

.floating-capital {
    transform-origin: center;
    animation: floatCapital 8s ease-in-out infinite alternate;
}

@keyframes floatCapital {
    from {
        transform: translateY(-2px);
    }
    to {
        transform: translateY(2px);
    }
}

.balance-beam {
    transform-origin: 180px 88px;
    transition: transform 1400ms cubic-bezier(0.25, 0.6, 0.25, 1);
}

.balance-beam.tilted {
    transform: rotate(2deg);
}

.orbit-coin {
    transform-origin: 160px 180px;
    animation: orbit 18s linear infinite;
}

@keyframes orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------- footer ---------- */
footer {
    width: var(--column-width);
    margin: 8vh 0 6vh;
    padding: 3rem 0;
    text-align: center;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-rule {
    width: min(420px, 80%);
    height: 1px;
    background-color: var(--terracotta-anchor);
    opacity: 0.55;
    margin-bottom: 1.5rem;
}

.footer-wordmark {
    font-family: var(--mono-body);
    font-weight: 800;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    letter-spacing: -0.04em;
    color: var(--bistre);
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.footer-wordmark .word-dot {
    width: 0.7em;
    height: 0.7em;
    margin: 0 0.04em;
    transform: translateY(0.18em);
}

.footer-wordmark .obol-glyph {
    width: 0.65em;
    height: 0.65em;
}

.footer-epigraph {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--walnut-ink);
    margin-top: 0.4rem;
}

.footer-correspondence {
    font-family: var(--serif-ghost);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--walnut-ink);
    opacity: 0.85;
    margin-top: 0.4rem;
}

.footer-year {
    font-family: var(--mono-num);
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.3em;
    color: var(--terracotta-anchor);
    margin-top: 1rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- selection ---------- */
::selection {
    background-color: var(--honeyed-sand);
    color: var(--bistre);
}

/* ---------- responsive tightening ---------- */
@media (max-width: 720px) {
    .pullquote {
        font-size: clamp(1.4rem, 5vw, 1.9rem);
        padding: 1.4rem 0.2rem;
    }

    .receipt {
        padding: 1.2rem 1rem;
    }

    .r-row {
        grid-template-columns: 1.6fr 0.3fr 0.9fr 0.6fr;
        font-size: 0.78rem;
    }

    .r-row span:nth-child(3) {
        font-size: 0.7rem;
    }

    .comparison {
        font-size: 0.76rem;
        padding: 1rem 0.6rem;
    }
}
