/* ==========================================================================
   lrx.sh - License and Right eXchange
   Design: Minimalist authority, Scandinavian warmth, circuit trace motifs
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --warm-parchment: #FAF6F2;
    --terracotta-clay: #C4836A;
    --burnt-sienna: #A0522D;
    --birch-gray: #8B7B6B;
    --charcoal-ink: #2A2420;
    --warm-white: #F5EDE5;
    --circuit-copper: #D4956B;

    --font-headline: 'Albert Sans', sans-serif;
    --font-body: 'Source Serif 4', Georgia, serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --cursor-x: 50vw;
    --cursor-y: 50vh;
    --section-opacity: 1;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 19px);
    line-height: 1.75;
    color: var(--charcoal-ink);
    background-color: var(--warm-parchment);
    font-feature-settings: "liga" 1, "kern" 1;
    overflow-x: hidden;
    position: relative;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-headline);
    text-wrap: balance;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(16px, 1.1vw, 19px);
    line-height: 1.75;
    color: var(--charcoal-ink);
    hyphens: auto;
    -webkit-hyphens: auto;
    hyphenate-limit-chars: 6 3 2;
    text-shadow: 0 0 0.5px rgba(42, 36, 32, 0.1);
    margin-bottom: 1.5em;
}

.body-text:last-child {
    margin-bottom: 0;
}

.meta-label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--birch-gray);
    margin-top: 2em;
}

.mono-highlight {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--burnt-sienna);
    background: rgba(196, 131, 106, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
}

/* --- Circuit Trace Overlay --- */
.circuit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.trace-line {
    fill: none;
    stroke: var(--circuit-copper);
    stroke-width: 1;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.5s ease-out;
}

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

.trace-junction {
    fill: var(--circuit-copper);
    opacity: 0;
    transition: opacity 0.6s ease-out 0.8s;
}

.trace-line.drawn ~ .trace-junction {
    opacity: 1;
}

.trace-group .trace-junction {
    transition: transform 0.15s ease-out;
}

/* --- Logotype --- */
.logotype {
    position: absolute;
    top: 40px;
    left: 48px;
    z-index: 10;
}

.logotype-text {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(24px, 3.5vw, 48px);
    color: var(--charcoal-ink);
    letter-spacing: -0.02em;
}

.logotype-ext {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: clamp(24px, 3.5vw, 48px);
    color: var(--terracotta-clay);
    letter-spacing: -0.02em;
}

/* --- Sections --- */
.section {
    position: relative;
    z-index: 2;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 48px;
    transition: opacity 0.4s ease;
}

.section--hero {
    min-height: 100vh;
    background: linear-gradient(
        180deg,
        rgba(196, 131, 106, 0.15) 0%,
        var(--warm-parchment) 100%
    );
    padding-top: 0;
    padding-bottom: 0;
}

.section--parchment {
    background: var(--warm-parchment);
}

.section--warm-white {
    background: var(--warm-white);
}

/* Gradient transitions between sections */
.section--parchment + .section--warm-white {
    background: linear-gradient(
        180deg,
        var(--warm-parchment) 0%,
        var(--warm-white) 100px,
        var(--warm-white) 100%
    );
}

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

/* Section content opacity via Intersection Observer */
.section-content {
    opacity: var(--section-opacity, 1);
    transition: opacity 0.5s ease;
}

/* --- Hero --- */
.hero-inner {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

.hero-statement {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(24px, 3.5vw, 48px);
    line-height: 1.3;
    color: var(--charcoal-ink);
    text-wrap: balance;
}

.hero-divider {
    margin-top: 48px;
    width: 200px;
}

.divider-line {
    width: 100%;
    height: 1px;
}

.scroll-invitation {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0.6;
    animation: scrollPulse 3s ease-in-out infinite;
}

.scroll-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--birch-gray);
}

.scroll-arrow {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

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

/* --- Section Content --- */
.section-content {
    max-width: 580px;
    width: 100%;
}

.section-heading {
    font-family: var(--font-headline);
    font-weight: 500;
    font-size: clamp(24px, 3.5vw, 48px);
    color: var(--charcoal-ink);
    margin-bottom: 1em;
    line-height: 1.2;
}

/* --- Code Block --- */
.code-block {
    margin-top: 2em;
    padding: 24px;
    background: rgba(42, 36, 32, 0.03);
    border-left: 2px solid var(--circuit-copper);
    border-radius: 0 4px 4px 0;
}

.code-block .meta-label {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.code-content {
    margin: 0;
}

.code-content code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.65;
    color: var(--charcoal-ink);
    white-space: pre;
    display: block;
}

/* --- Architecture Items --- */
.architecture-items {
    margin-top: 2.5em;
    display: flex;
    flex-direction: column;
    gap: 2.5em;
}

.arch-item {
    padding-left: 20px;
    border-left: 1px solid rgba(196, 131, 106, 0.4);
}

.arch-label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--burnt-sienna);
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.75em;
}

.arch-item .body-text {
    font-size: clamp(14px, 1vw, 17px);
    margin-bottom: 0;
}

/* --- Seal Section --- */
.seal-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 40px;
}

.embossed-seal {
    position: relative;
}

.seal-svg {
    filter: drop-shadow(0 1px 0 rgba(250, 246, 242, 0.8)) drop-shadow(0 -1px 0 rgba(42, 36, 32, 0.04));
}

/* --- Horizontal Rules (ornamental) --- */
.section + .section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 1px;
    background: rgba(196, 131, 106, 0.3);
}

/* Diamond ornaments at rule endpoints */
.section + .section::after {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 6px;
    height: 6px;
    background: rgba(196, 131, 106, 0.2);
}

/* --- Footer --- */
.site-footer {
    position: relative;
    z-index: 2;
    padding: 48px;
    background: var(--warm-parchment);
    border-top: 1px solid rgba(196, 131, 106, 0.2);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-logotype {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 18px;
    color: var(--charcoal-ink);
}

.footer-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--birch-gray);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section {
        padding: 80px 24px;
    }

    .logotype {
        top: 24px;
        left: 24px;
    }

    .hero-statement {
        font-size: clamp(20px, 6vw, 36px);
    }

    .section-heading {
        font-size: clamp(20px, 6vw, 36px);
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .circuit-overlay {
        display: none;
    }

    .code-content code {
        font-size: 11px;
        overflow-x: auto;
    }

    .code-block {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 60px 16px;
    }

    .logotype {
        top: 16px;
        left: 16px;
    }

    .body-text {
        font-size: 15px;
    }

    .section-content {
        max-width: 100%;
    }
}

/* --- Selection Color --- */
::selection {
    background: rgba(196, 131, 106, 0.25);
    color: var(--charcoal-ink);
}

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

::-webkit-scrollbar-track {
    background: var(--warm-parchment);
}

::-webkit-scrollbar-thumb {
    background: rgba(196, 131, 106, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 131, 106, 0.5);
}

/* --- Link Styles --- */
a {
    color: var(--burnt-sienna);
    text-decoration: none;
    border-bottom: 1px solid rgba(160, 82, 45, 0.3);
    transition: border-color 0.3s ease, color 0.3s ease;
}

a:hover {
    color: var(--terracotta-clay);
    border-bottom-color: var(--terracotta-clay);
}
