/* ============================================================
   lrx.sh — License and Right eXchange (v2)
   Design language: minimalist authority, immersive scroll,
   terracotta + circuit-copper, Albert Sans / Source Serif 4 / IBM Plex Mono.
   ============================================================ */

:root {
    /* Palette (from DESIGN.md) */
    --warm-parchment: #FAF6F2;
    --warm-white: #F5EDE5;
    --terracotta-clay: #C4836A;
    --burnt-sienna: #A0522D;
    --circuit-copper: #D4956B;
    --birch-gray: #8B7B6B;
    --charcoal-ink: #2A2420;

    /* Cursor tracking custom properties (updated by JS) */
    --cursor-x: 50vw;
    --cursor-y: 50vh;
    --cursor-x-norm: 0.5;
    --cursor-y-norm: 0.5;

    /* Typography ramp */
    --type-display: clamp(36px, 5.4vw, 72px);
    --type-h2: clamp(28px, 3.6vw, 48px);
    --type-h3: clamp(20px, 2vw, 26px);
    --type-body: clamp(16px, 1.05vw, 19px);
    --type-meta: 13px;

    /* Reading column */
    --col-width: 600px;

    /* Section vertical rhythm */
    --section-pad: clamp(96px, 12vw, 160px);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--warm-parchment);
    color: var(--charcoal-ink);
    font-family: "Source Serif 4", Georgia, serif;
    font-size: var(--type-body);
    line-height: 1.75;
    font-feature-settings: "liga" 1, "kern" 1;
    text-shadow: 0 0 0.5px rgba(42, 36, 32, 0.08);
    overflow-x: hidden;
    position: relative;
}

/* Subtle top-down warmth wash */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%,
            rgba(196, 131, 106, 0.10) 0%,
            rgba(196, 131, 106, 0) 55%),
        radial-gradient(ellipse at 80% 100%,
            rgba(212, 149, 107, 0.06) 0%,
            rgba(212, 149, 107, 0) 60%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   Cursor aura — soft warm glow that follows the cursor
   ============================================================ */
.cursor-aura {
    position: fixed;
    top: 0;
    left: 0;
    width: 360px;
    height: 360px;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at center,
        rgba(212, 149, 107, 0.18) 0%,
        rgba(212, 149, 107, 0.08) 35%,
        rgba(212, 149, 107, 0) 70%);
    transform: translate3d(calc(var(--cursor-x) - 180px), calc(var(--cursor-y) - 180px), 0);
    transition: opacity 0.6s ease;
    mix-blend-mode: multiply;
    z-index: 1;
    opacity: 0.85;
}

@media (hover: none) {
    .cursor-aura { display: none; }
}

/* ============================================================
   Circuit overlay — fixed, full-page SVG that draws traces
   ============================================================ */
.circuit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.trace-line {
    fill: none;
    stroke: var(--circuit-copper);
    stroke-width: 1;
    stroke-opacity: 0.55;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    pathLength: 1;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.22, 1, 0.36, 1),
                stroke-opacity 0.6s ease;
}

.trace-line.is-drawn {
    stroke-dashoffset: 0;
}

.trace-junction {
    fill: var(--circuit-copper);
    fill-opacity: 0.7;
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                fill-opacity 0.4s ease;
}

.trace-junction.is-near {
    fill-opacity: 1;
    fill: var(--burnt-sienna);
}

/* ============================================================
   Hero / opening viewport
   ============================================================ */
.hero {
    position: relative;
    min-height: 100vh;
    padding: clamp(36px, 5vw, 72px) clamp(24px, 5vw, 80px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(180deg,
            rgba(196, 131, 106, 0.15) 0%,
            rgba(196, 131, 106, 0.06) 60%,
            rgba(196, 131, 106, 0) 100%),
        var(--warm-parchment);
    z-index: 2;
}

.hero__inner {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: clamp(40px, 6vw, 80px);
    height: 100%;
    flex: 1;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 18px;
    flex-wrap: wrap;
}

.brand__mark {
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 600;
    font-size: clamp(22px, 2vw, 28px);
    letter-spacing: -0.01em;
    color: var(--charcoal-ink);
    line-height: 1;
}

.brand__name {
    color: var(--charcoal-ink);
}

.brand__ext {
    color: var(--terracotta-clay);
    font-weight: 500;
}

.brand__tag {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.04em;
    color: var(--birch-gray);
    text-transform: uppercase;
}

.hero__statement {
    align-self: center;
    max-width: 920px;
    margin: 0 auto;
    text-align: left;
    padding: 0 8px;
}

.kicker {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
    color: var(--birch-gray);
    text-transform: uppercase;
    margin-bottom: 22px;
}

.hero__title {
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 500;
    font-size: var(--type-display);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--charcoal-ink);
    text-wrap: balance;
    margin-bottom: 28px;
}

.hero__sub {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(17px, 1.25vw, 21px);
    line-height: 1.6;
    color: var(--birch-gray);
    max-width: 680px;
}

.hero__rule {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
}

.rule-line {
    flex: 1;
    height: 1px;
    background: var(--terracotta-clay);
    opacity: 0.4;
}

.rule-ornament {
    width: 6px;
    height: 6px;
    background: var(--terracotta-clay);
    opacity: 0.5;
    transform: rotate(45deg);
}

.hero__invite {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
    color: var(--birch-gray);
    text-transform: uppercase;
    align-self: end;
}

.invite-arrow {
    width: 1px;
    height: 28px;
    background: var(--terracotta-clay);
    position: relative;
    animation: invite-pulse 2.4s ease-in-out infinite;
}

.invite-arrow::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-right: 1px solid var(--terracotta-clay);
    border-bottom: 1px solid var(--terracotta-clay);
}

@keyframes invite-pulse {
    0%, 100% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(4px); }
}

/* ============================================================
   Flow sections — immersive, no hard borders
   ============================================================ */
.flow {
    position: relative;
    padding: var(--section-pad) clamp(24px, 5vw, 80px);
    z-index: 2;
    transition: background 0.6s ease;
}

.flow--parchment {
    background: linear-gradient(180deg,
        var(--warm-parchment) 0%,
        var(--warm-parchment) 100%);
}

.flow--warm-white {
    background: linear-gradient(180deg,
        var(--warm-white) 0%,
        var(--warm-white) 100%);
}

/* Smooth dissolves at section boundaries */
.flow::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
    z-index: 0;
}

.flow--warm-white::before {
    background: linear-gradient(180deg,
        var(--warm-parchment) 0%,
        var(--warm-white) 100%);
}

.flow--parchment::before {
    background: linear-gradient(180deg,
        var(--warm-white) 0%,
        var(--warm-parchment) 100%);
}

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

.flow__column {
    max-width: var(--col-width);
    margin: 0 auto;
    opacity: var(--section-opacity, 0.92);
    transition: opacity 0.6s ease;
}

.flow.is-in-focus .flow__column {
    opacity: 1;
}

.meta-label {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
    color: var(--birch-gray);
    text-transform: uppercase;
    display: block;
    margin-bottom: 28px;
}

.section-heading {
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 500;
    font-size: var(--type-h2);
    line-height: 1.18;
    letter-spacing: -0.015em;
    color: var(--charcoal-ink);
    text-wrap: balance;
    margin-bottom: 36px;
}

.body {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: var(--type-body);
    line-height: 1.78;
    color: var(--charcoal-ink);
    margin-bottom: 24px;
    hyphens: auto;
    -webkit-hyphens: auto;
    hyphenate-limit-chars: 6 3 2;
}

.body em {
    font-style: italic;
    color: var(--burnt-sienna);
    font-weight: 500;
}

.aside {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.04em;
    color: var(--birch-gray);
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid rgba(196, 131, 106, 0.25);
}

.mono {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.92em;
    color: var(--burnt-sienna);
    letter-spacing: 0.02em;
}

/* ============================================================
   Codeplate — for shell / yaml examples
   ============================================================ */
.codeplate {
    margin: 44px 0 8px;
    border: 1px solid rgba(196, 131, 106, 0.35);
    background: var(--warm-parchment);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 1px 0 rgba(42, 36, 32, 0.04),
        0 12px 24px -16px rgba(42, 36, 32, 0.18);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.codeplate::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--circuit-copper) 30%,
        var(--circuit-copper) 70%,
        transparent);
    opacity: 0.4;
}

.codeplate__cap {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--birch-gray);
    text-transform: uppercase;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(196, 131, 106, 0.18);
    background: rgba(196, 131, 106, 0.06);
}

.codeplate__body {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--charcoal-ink);
    padding: 22px 24px;
    white-space: pre;
    overflow-x: auto;
    background: var(--warm-parchment);
}

.codeplate__body .kw { color: var(--burnt-sienna); font-weight: 500; }
.codeplate__body .flag { color: var(--terracotta-clay); }
.codeplate__body .str { color: var(--charcoal-ink); }
.codeplate__body .num { color: var(--burnt-sienna); }

/* ============================================================
   Layered architecture list
   ============================================================ */
.layers {
    list-style: none;
    margin: 40px 0 8px;
    padding: 0;
    counter-reset: layer;
}

.layer {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 22px;
    padding: 28px 0;
    border-top: 1px solid rgba(196, 131, 106, 0.22);
    position: relative;
}

.layer:last-child {
    border-bottom: 1px solid rgba(196, 131, 106, 0.22);
}

.layer::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 36px;
    height: 1px;
    background: var(--terracotta-clay);
    opacity: 0.65;
}

.layer__num {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--terracotta-clay);
    padding-top: 4px;
}

.layer__name {
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 500;
    font-size: var(--type-h3);
    color: var(--charcoal-ink);
    margin-bottom: 12px;
    letter-spacing: -0.005em;
}

.layer__body .body {
    margin-bottom: 0;
}

/* ============================================================
   Embossed seal
   ============================================================ */
.flow--seal .flow__column {
    text-align: left;
}

.seal {
    margin-top: 56px;
    text-align: center;
    padding: 48px 24px 36px;
    border-top: 1px solid rgba(196, 131, 106, 0.22);
    border-bottom: 1px solid rgba(196, 131, 106, 0.22);
}

.seal__svg {
    display: block;
    margin: 0 auto 24px;
    filter:
        drop-shadow(0 1px 0 rgba(255, 255, 255, 0.65))
        drop-shadow(0 -1px 0 rgba(42, 36, 32, 0.08));
}

.seal__text {
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 700;
    font-size: 32px;
    fill: var(--charcoal-ink);
    fill-opacity: 0.14;
    letter-spacing: 0.18em;
}

.seal__caption {
    font-family: "Source Serif 4", Georgia, serif;
    font-style: italic;
    font-size: 15px;
    color: var(--birch-gray);
    max-width: 420px;
    margin: 0 auto 18px;
    line-height: 1.6;
}

.seal__meta {
    margin-top: 4px;
    margin-bottom: 0;
}

/* ============================================================
   Footer / Ledger
   ============================================================ */
.ledger {
    position: relative;
    padding: clamp(72px, 9vw, 120px) clamp(24px, 5vw, 80px) 56px;
    background: var(--warm-parchment);
    z-index: 2;
}

.ledger::before {
    content: "";
    position: absolute;
    top: 0;
    left: clamp(24px, 5vw, 80px);
    right: clamp(24px, 5vw, 80px);
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        var(--terracotta-clay) 20%,
        var(--terracotta-clay) 80%,
        transparent);
    opacity: 0.45;
}

.ledger__inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    gap: 48px;
}

.ledger__brand {
    display: flex;
    align-items: baseline;
    gap: 18px;
    flex-wrap: wrap;
    font-family: "Albert Sans", "Inter", system-ui, sans-serif;
    font-weight: 600;
    font-size: 24px;
}

.ledger__sub {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.06em;
    color: var(--birch-gray);
    text-transform: uppercase;
    font-weight: 400;
}

.ledger__cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 36px;
}

.ledger__col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ledger__col .meta-label {
    margin-bottom: 14px;
}

.ledger__col .mono {
    color: var(--charcoal-ink);
    font-size: 13px;
}

.ledger__link {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 15px;
    color: var(--charcoal-ink);
    text-decoration: none;
    border-bottom: 1px solid rgba(196, 131, 106, 0);
    padding-bottom: 1px;
    width: fit-content;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.ledger__link:hover {
    color: var(--burnt-sienna);
    border-bottom-color: var(--terracotta-clay);
}

.ledger__rule {
    height: 1px;
    background: rgba(196, 131, 106, 0.25);
}

.ledger__base {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: var(--type-meta);
    letter-spacing: 0.04em;
    color: var(--birch-gray);
}

/* ============================================================
   Responsive refinements
   ============================================================ */
@media (max-width: 760px) {
    :root {
        --col-width: 100%;
        --section-pad: clamp(72px, 14vw, 110px);
    }

    .hero {
        padding-top: 28px;
        padding-bottom: 48px;
    }

    .hero__inner {
        gap: 48px;
    }

    .hero__title {
        font-size: clamp(32px, 8vw, 48px);
    }

    .hero__sub {
        font-size: 17px;
    }

    .layer {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .layer__num {
        padding-top: 0;
    }

    .codeplate__body {
        font-size: 12.5px;
        padding: 18px;
    }

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

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

    .seal__svg {
        width: 160px;
        height: 160px;
    }
}
