:root {
    --abyss: #0D0C0B;
    --soot: #1A1917;
    --graphite: #2E2D2A;
    --pencil: #6B6862;
    --parchment: #C8C3B8;
    --chalk: #E8E4DB;
    --lamplight: #B8963E;
    --font-display: 'Caveat', cursive;
    --font-body: 'Libre Baskerville', serif;
    --font-meta: 'JetBrains Mono', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--abyss);
    color: var(--parchment);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(184, 150, 62, 0.15);
}

/* Lamp Glow */
.lamp-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(184, 150, 62, 0.03) 0%, transparent 70%);
}

/* Desk Ghost SVGs */
.desk-ghosts {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Ink Spots */
.ink-spot {
    position: fixed;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--graphite);
    pointer-events: none;
    z-index: 0;
}

/* Ink Navigation */
.ink-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
}

.ink-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pencil);
    cursor: pointer;
    transition: background 300ms ease;
}

.ink-dot:hover {
    background: var(--lamplight);
}

.ink-nav-menu {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: var(--soot);
    border: 1px solid var(--graphite);
}

.ink-nav:hover .ink-nav-menu,
.ink-nav.open .ink-nav-menu {
    display: flex;
}

.ink-link {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pencil);
    text-decoration: none;
    transition: color 200ms ease;
}

.ink-link:hover {
    color: var(--chalk);
}

/* The Lamp Section */
.lamp-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.lamp-content {
    text-align: center;
    opacity: 0;
    animation: lamp-on 1.2s ease-out 0.8s forwards;
}

@keyframes lamp-on {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.lamp-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5rem);
    color: var(--chalk);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.lamp-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    color: var(--pencil);
    margin-top: 1rem;
    max-width: 35ch;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    animation: fade-in 600ms ease-out 2s forwards;
}

@keyframes fade-in {
    to { opacity: 1; }
}

/* Pinboard */
.pinboard {
    position: relative;
    z-index: 1;
    padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 4vw, 4rem);
    max-width: 1200px;
    margin: 0 auto;
    margin-left: calc(50% - 612px);
}

@media (max-width: 1224px) {
    .pinboard { margin-left: auto; }
}

.pinboard-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--chalk);
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
}

.pin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(16px, 3vw, 40px);
}

/* Pin Cards */
.pin-card {
    background: var(--soot);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    position: relative;
    transition: transform 300ms ease-out, box-shadow 300ms ease-out;
}

.pin-wide {
    grid-column: span 2;
}

.pin-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 0 20px rgba(184, 150, 62, 0.12);
}

/* Blob Shadow */
.blob-shadow {
    position: absolute;
    inset: -20px;
    z-index: -1;
    background: var(--soot);
    border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
    opacity: 0.4;
    animation: blob-morph 25s ease-in-out infinite;
}

@keyframes blob-morph {
    0% { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }
    25% { border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%; }
    50% { border-radius: 45% 55% 60% 40% / 55% 45% 45% 55%; }
    75% { border-radius: 60% 40% 45% 55% / 40% 60% 55% 45%; }
    100% { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }
}

/* Zoom Focus Animation */
.zoom-focus {
    opacity: 0;
    transform: scale(0.85);
    filter: blur(3px);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-delay: calc(var(--focus-delay, 0) * 120ms);
}

.zoom-focus.visible {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* Card Typography */
.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--chalk);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.65;
    color: var(--parchment);
    margin-bottom: 0.75rem;
}

.card-meta {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pencil);
}

/* Section Flourish */
.section-flourish {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
    position: relative;
    z-index: 1;
}

/* Marginalia Section */
.marginalia-section {
    position: relative;
    z-index: 1;
    min-height: 50vh;
    padding: clamp(4rem, 8vw, 8rem) clamp(2rem, 6vw, 6rem);
    background: #131210;
}

.ruled-bg {
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        transparent,
        transparent calc(1.72em - 1px),
        rgba(26, 25, 23, 0.8) calc(1.72em - 1px),
        rgba(26, 25, 23, 0.8) 1.72em
    );
    pointer-events: none;
    opacity: 0.5;
}

.marginalia-content {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.marginalia-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--chalk);
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    transform: rotate(-0.5deg);
}

.marginalia-text {
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--parchment);
    margin-bottom: 1.5rem;
    transform: rotate(-0.5deg);
}

.margin-reveal {
    opacity: 0;
    transform: rotate(-1deg) translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.margin-reveal.visible {
    opacity: 1;
    transform: rotate(-0.5deg) translateY(0);
}

/* The Drawer */
.drawer-section {
    position: relative;
    z-index: 1;
    padding: clamp(3rem, 6vw, 6rem) clamp(2rem, 4vw, 4rem);
    min-height: 30vh;
}

.drawer-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--chalk);
    text-align: center;
    margin-bottom: 2rem;
}

.drawer-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.drawer-card {
    background: var(--soot);
    border: 1px solid var(--graphite);
    padding: 1.5rem 2rem;
    text-decoration: none;
    clip-path: polygon(2% 0%, 100% 1%, 98% 100%, 0% 99%);
    transform: rotate(var(--tilt, 0deg));
    transition: transform 300ms ease-out, box-shadow 300ms ease-out;
}

.drawer-card:hover {
    transform: rotate(0deg) perspective(800px) rotateX(2deg) rotateY(-3deg);
    box-shadow: 0 0 20px rgba(184, 150, 62, 0.12);
}

.drawer-reveal {
    opacity: 0;
    transform: rotate(var(--tilt, 0deg)) translateY(20px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.drawer-reveal.visible {
    opacity: 1;
    transform: rotate(var(--tilt, 0deg)) translateY(0);
}

.drawer-label {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pencil);
    display: block;
    margin-bottom: 0.25rem;
}

.drawer-value {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--parchment);
}

.drawer-footer {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--pencil);
    text-align: center;
    margin-top: 3rem;
    opacity: 0.4;
}

/* Responsive */
@media (max-width: 768px) {
    .pin-wide { grid-column: span 1; }
    .ink-nav { top: 12px; right: 12px; }
    .desk-ghosts { display: none; }
    .ink-spot { display: none; }

    .marginalia-section {
        padding: 3rem 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lamp-content {
        opacity: 1;
        animation: none;
    }

    .lamp-subtitle {
        opacity: 1;
        animation: none;
    }

    .blob-shadow { animation: none; }

    .zoom-focus {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    .margin-reveal {
        opacity: 1;
        transform: rotate(-0.5deg);
        transition: none;
    }

    .drawer-reveal {
        opacity: 1;
        transition: none;
    }
}
