/* licensor.directory -- 19th-Century Patent Registry */

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

:root {
    --ledger-ink: #1A1420;
    --aged-parchment: #F2E8D5;
    --registry-gold: #C8A84E;
    --sealing-wax: #8B2E23;
    --midnight-vault: #0B1026;
    --foxed-margin: #D4C4A8;
    --faded-annotation: #8A7E70;
    --leather-spine: #3D2B1F;
    --brass-clasp: #B8963E;
    --font-display: 'Playfair Display SC', serif;
    --font-body: 'Cormorant Garamond', serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
    background: var(--aged-parchment);
    color: #2C2420;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 100;
    transform: translateX(-60px);
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.sidebar.visible {
    transform: translateX(0);
}

.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    background: var(--foxed-margin);
    border: 1px solid var(--faded-annotation);
    border-left: none;
    border-radius: 0 4px 4px 0;
    text-decoration: none;
    color: var(--faded-annotation);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin: 2px 0;
    transition: width 0.3s ease, background 0.05s ease, color 0.05s ease;
}

.tab.active {
    width: 60px;
    background: var(--registry-gold);
    color: var(--ledger-ink);
    border-color: var(--brass-clasp);
}

/* ---- Sections ---- */
.section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 4vw, 4rem);
}

/* ---- Frontispiece ---- */
.frontispiece {
    background: var(--leather-spine);
    flex-direction: column;
    overflow: hidden;
}

.leather-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, #4A3528 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, #4A3528 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, #3D2B1F 0%, #2E1F15 100%);
    filter: contrast(1.05) brightness(0.98);
    pointer-events: none;
}

.frontispiece-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.ornate-border {
    width: clamp(300px, 60vw, 600px);
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.border-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-in-out;
}

.border-path.drawn {
    stroke-dashoffset: 0;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--registry-gold);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1.2s ease, transform 1.2s ease, letter-spacing 1.2s ease;
}

.site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-line {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--foxed-margin);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1s ease 0.6s;
}

.colophon-line.visible {
    opacity: 1;
}

.wax-seal-hero {
    width: 120px;
    height: 120px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wax-seal-hero.visible {
    opacity: 1;
    transform: scale(1);
}

.seal-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)) drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    animation: sealRotate 120s linear infinite;
}

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

/* ---- Marbled Paper Transitions ---- */
.registry-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(200, 168, 78, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 30%, rgba(139, 46, 35, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 60%, rgba(61, 43, 31, 0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 35% 70%, rgba(200, 168, 78, 0.05) 0%, transparent 55%),
        radial-gradient(ellipse at 65% 40%, rgba(184, 150, 62, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 80%, rgba(139, 46, 35, 0.05) 0%, transparent 40%);
    background-size: 200px 160px, 180px 140px, 220px 180px, 160px 200px, 190px 170px, 210px 150px;
    pointer-events: none;
}

/* ---- Container ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* ---- Registry Section ---- */
.registry-section {
    background: var(--aged-parchment);
    display: block;
    padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 4vw, 4rem);
    padding-left: 84px;
    min-height: auto;
}

/* Foxing spots */
.registry-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle 3px at 15% 25%, rgba(184, 150, 62, 0.12) 0%, transparent 100%),
        radial-gradient(circle 2px at 45% 18%, rgba(184, 150, 62, 0.10) 0%, transparent 100%),
        radial-gradient(circle 4px at 72% 55%, rgba(184, 150, 62, 0.08) 0%, transparent 100%),
        radial-gradient(circle 2px at 28% 72%, rgba(184, 150, 62, 0.11) 0%, transparent 100%),
        radial-gradient(circle 3px at 85% 35%, rgba(184, 150, 62, 0.09) 0%, transparent 100%),
        radial-gradient(circle 5px at 55% 88%, rgba(184, 150, 62, 0.10) 0%, transparent 100%);
    background-size: 400px 300px, 350px 280px, 320px 350px, 380px 320px, 360px 340px, 300px 360px;
    pointer-events: none;
    z-index: 0;
}

.registry-section .container {
    position: relative;
    z-index: 1;
}

/* ---- Registry Entry ---- */
.registry-entry {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    padding: clamp(2rem, 4vw, 4rem) 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.registry-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Entry Meta (Ledger Column) ---- */
.entry-meta {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.registry-entry.visible .entry-meta {
    opacity: 1;
    transform: translateY(0);
}

.ledger-lines {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(1.72rem - 1px),
        rgba(212, 196, 168, 0.3) calc(1.72rem - 1px),
        rgba(212, 196, 168, 0.3) 1.72rem
    );
    padding: 0.5rem 0;
}

.meta-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0;
    line-height: 1.72;
}

.meta-label {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--faded-annotation);
    letter-spacing: 0.02em;
}

.meta-value {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #5A4E42;
    font-variant-numeric: tabular-nums;
}

/* ---- Entry Narrative ---- */
.entry-narrative {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 120ms, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 120ms;
}

.registry-entry.visible .entry-narrative {
    opacity: 1;
    transform: translateY(0);
}

.entry-narrative p {
    text-align: justify;
    hyphens: auto;
}

/* ---- Fleuron Dividers ---- */
.fleuron-divider {
    display: flex;
    justify-content: center;
    padding: clamp(1rem, 2vw, 2rem) 0;
}

.fleuron-svg {
    width: clamp(200px, 40vw, 400px);
    height: 20px;
}

.fleuron-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease-in-out;
}

.fleuron-path.drawn {
    stroke-dashoffset: 0;
}

/* ---- Seal Chamber ---- */
.seal-chamber {
    background: linear-gradient(180deg, var(--foxed-margin) 0%, var(--ledger-ink) 15%, var(--midnight-vault) 50%, var(--ledger-ink) 85%, var(--aged-parchment) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.embossing-seal {
    width: 60vmin;
    height: 60vmin;
    max-width: 400px;
    max-height: 400px;
}

.seal-ring {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.seal-ring.revealed {
    stroke-dashoffset: 0;
}

.outer-ring { transition-delay: 0ms; }
.inner-ring { transition-delay: 300ms; stroke-dasharray: 1000; stroke-dashoffset: 1000; }
.core-ring { transition-delay: 600ms; stroke-dasharray: 800; stroke-dashoffset: 800; }
.center-disc { transition-delay: 900ms; stroke-dasharray: 400; stroke-dashoffset: 400; }

.seal-text {
    opacity: 0;
    transition: opacity 0.8s ease 1.2s;
}

.seal-text.revealed {
    opacity: 1;
}

.shield-device {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease 1s;
}

.shield-device.revealed {
    stroke-dashoffset: 0;
}

/* ---- Colophon ---- */
.colophon-section {
    background: linear-gradient(180deg, #F2E8D5 0%, #E8D9BE 60%, #D4C4A8 100%);
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 2.5rem);
    text-align: center;
}

.colophon-inner {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2vw, 2rem);
}

.colophon-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.72;
    color: var(--faded-annotation);
    max-width: 600px;
}

.tailpiece {
    display: flex;
    justify-content: center;
}

.tailpiece-svg {
    width: 100px;
    height: 30px;
    opacity: 0.6;
}

.colophon-seal {
    width: 80px;
    height: 80px;
    transform: scale(1.3);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.colophon-seal.pressed {
    transform: scale(1);
    opacity: 1;
}

.colophon-seal-svg {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.colophon-seal.pressed .colophon-seal-svg {
    filter: drop-shadow(0 4px 20px rgba(139, 46, 35, 0.4));
    transition: filter 0.6s ease;
}

.footer-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faded-annotation);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        justify-content: center;
        gap: 4px;
        transform: translateY(48px);
    }

    .sidebar.visible {
        transform: translateY(0);
    }

    .tab {
        width: 48px;
        height: 36px;
        border-radius: 4px 4px 0 0;
        border: 1px solid var(--faded-annotation);
        border-bottom: none;
    }

    .tab.active {
        width: 56px;
        height: 40px;
    }

    .registry-section {
        padding-left: clamp(1.5rem, 4vw, 4rem);
    }

    .registry-entry {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .section {
        padding: clamp(3rem, 6vw, 4rem) clamp(1rem, 3vw, 2rem);
    }

    .site-title {
        font-size: clamp(1.8rem, 8vw, 3rem);
        letter-spacing: 0.12em;
    }

    .ornate-border {
        width: 90vw;
    }

    .embossing-seal {
        width: 70vmin;
        height: 70vmin;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .site-title { opacity: 1; transform: none; transition: none; }
    .colophon-line { opacity: 1; transition: none; }
    .wax-seal-hero { opacity: 1; transform: scale(1); transition: none; }
    .seal-svg { animation: none; }
    .border-path { stroke-dashoffset: 0; transition: none; }
    .registry-entry { opacity: 1; transform: none; transition: none; }
    .entry-meta { opacity: 1; transform: none; transition: none; }
    .entry-narrative { opacity: 1; transform: none; transition: none; }
    .fleuron-path { stroke-dashoffset: 0; transition: none; }
    .seal-ring { stroke-dashoffset: 0; transition: none; }
    .seal-text { opacity: 1; transition: none; }
    .shield-device { stroke-dashoffset: 0; transition: none; }
    .colophon-seal { transform: scale(1); opacity: 1; transition: none; }
    .sidebar { transform: translateX(0); transition: none; }
}
