/* ===================================================
   quietjoon.net - Skeuomorphic Desk Study
   Colors: #0d0d0f #2a1f17 #4a3728 #f0e6d0 #c9a84c
           #e8d48b #1c1c1e #3a2a1a #d4874d #8b9aab
   Fonts: Cormorant Garamond, EB Garamond, Newsreader, Source Serif 4
   =================================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: #0d0d0f;
    color: #1c1c1e;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    /* deep night: #1a1a1a, urban charcoal: #1a1a1e */
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---- Desk Lamp Glow Overlay ---- */
#lamp-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    background: radial-gradient(
        ellipse 50% 60% at 50% 35%,
        rgba(201, 168, 76, 0.06) 0%,
        rgba(201, 168, 76, 0.03) 30%,
        rgba(212, 135, 77, 0.015) 60%,
        transparent 100%
    );
    transition: opacity 1.5s ease;
}

#lamp-glow.active {
    opacity: 1;
}

/* ---- Rain Effect ---- */
#rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 250px;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.raindrop {
    position: absolute;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(139, 154, 171, 0.12), transparent);
    animation: rain-fall linear infinite;
}

@keyframes rain-fall {
    0% { transform: translateY(-100px); }
    100% { transform: translateY(300px); }
}

/* ---- City Skyline ---- */
#city-skyline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 250px;
    z-index: 1;
    overflow: hidden;
}

.building {
    position: absolute;
    bottom: 0;
    background: linear-gradient(180deg, #1a1a1e 0%, #1a1a1a 40%, #0d0d0f 100%);
    border-top: 1px solid rgba(139, 154, 171, 0.05);
}

.window {
    position: absolute;
    width: 4px;
    height: 5px;
    background: #d4874d;
    opacity: 0.4;
    border-radius: 0.5px;
}

.window:nth-child(even) {
    opacity: 0.25;
    background: #e8d48b;
}

/* ---- Desk Surface ---- */
#desk-surface {
    position: relative;
    max-width: 1200px;
    margin: 200px auto 80px;
    padding: 60px 80px;
    min-height: 100vh;
    z-index: 10;
    opacity: 0;
    transition: opacity 1.5s ease 0.8s;
}

#desk-surface.visible {
    opacity: 1;
}

#desk-texture {
    position: absolute;
    top: -60px;
    left: -120px;
    right: -120px;
    bottom: -60px;
    background:
        linear-gradient(90deg,
            rgba(42, 31, 23, 0.3) 0px,
            transparent 1px,
            transparent 18px,
            rgba(42, 31, 23, 0.15) 19px,
            transparent 20px
        ),
        linear-gradient(180deg,
            rgba(42, 31, 23, 0.1) 0px,
            transparent 2px
        ),
        linear-gradient(135deg, #2a1f17 0%, #352a20 25%, #2a1f17 50%, #231a13 75%, #2a1f17 100%);
    background-size: 20px 20px, 100% 100px, 100% 100%;
    border-radius: 4px;
    z-index: -1;
    box-shadow:
        0 0 80px rgba(0, 0, 0, 0.6),
        inset 0 0 100px rgba(0, 0, 0, 0.2);
}

/* ---- Coffee Ring Stain ---- */
#coffee-ring {
    position: absolute;
    bottom: 120px;
    right: 100px;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        transparent 30px,
        rgba(74, 55, 40, 0.08) 31px,
        rgba(74, 55, 40, 0.15) 33px,
        rgba(74, 55, 40, 0.1) 36px,
        rgba(74, 55, 40, 0.04) 38px,
        transparent 40px
    );
    z-index: 2;
    transform: rotate(15deg);
}

#coffee-ring::after {
    content: '';
    position: absolute;
    top: 5px;
    left: -3px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        transparent 32px,
        rgba(74, 55, 40, 0.05) 33px,
        rgba(74, 55, 40, 0.08) 35px,
        transparent 38px
    );
}

/* ---- Brass-Framed Photograph ---- */
#photograph-frame {
    position: absolute;
    top: 20px;
    right: 80px;
    width: 280px;
    transform: rotate(2deg);
    z-index: 15;
}

.brass-frame {
    padding: 6px;
    background: linear-gradient(135deg, #c9a84c 0%, #e8d48b 40%, #c9a84c 60%, #8b6d2e 100%);
    border: 1px solid #8b6d2e;
    box-shadow:
        0 8px 24px rgba(26, 18, 10, 0.4),
        0 2px 6px rgba(26, 18, 10, 0.3),
        inset 0 1px 0 rgba(232, 212, 139, 0.5);
}

.frame-mat {
    padding: 16px;
    background: #e8dcc8;
}

.photo-content {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 1.2s ease;
}

.photo-content.revealed {
    opacity: 1;
}

.photo-city-scene {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        180deg,
        #0a0a14 0%,
        #0f0f1a 40%,
        #1a1520 60%,
        #2a1f28 80%,
        #1a1218 100%
    );
    position: relative;
    overflow: hidden;
}

.photo-street {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(
        180deg,
        rgba(26, 18, 24, 0.8) 0%,
        rgba(42, 35, 40, 0.9) 100%
    );
}

.photo-street::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(212, 135, 77, 0.15) 0%,
        rgba(201, 168, 76, 0.08) 100%
    );
}

.photo-bokeh {
    position: absolute;
    border-radius: 50%;
    filter: blur(3px);
}

.photo-bokeh.b1 { width: 12px; height: 12px; background: rgba(212, 135, 77, 0.6); top: 20%; left: 15%; }
.photo-bokeh.b2 { width: 18px; height: 18px; background: rgba(232, 212, 139, 0.4); top: 25%; left: 60%; }
.photo-bokeh.b3 { width: 8px; height: 8px; background: rgba(201, 168, 76, 0.7); top: 35%; left: 40%; }
.photo-bokeh.b4 { width: 14px; height: 14px; background: rgba(212, 135, 77, 0.5); top: 15%; left: 80%; }
.photo-bokeh.b5 { width: 10px; height: 10px; background: rgba(255, 100, 80, 0.4); top: 30%; left: 25%; }
.photo-bokeh.b6 { width: 16px; height: 16px; background: rgba(201, 168, 76, 0.35); top: 10%; left: 45%; }
.photo-bokeh.b7 { width: 6px; height: 6px; background: rgba(232, 212, 139, 0.6); top: 40%; left: 70%; }

.photo-neon {
    position: absolute;
    top: 30%;
    left: 20%;
    width: 40px;
    height: 8px;
    background: rgba(255, 80, 100, 0.3);
    filter: blur(2px);
    border-radius: 2px;
}

.photo-reflection {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(
        180deg,
        rgba(212, 135, 77, 0.08) 0%,
        rgba(201, 168, 76, 0.12) 30%,
        rgba(139, 154, 171, 0.06) 100%
    );
}

.brass-screw {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e8d48b, #c9a84c 50%, #8b6d2e);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.brass-screw::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 1px;
    width: 6px;
    height: 1px;
    background: rgba(139, 109, 46, 0.6);
    transform: rotate(45deg);
}

.screw-tl { top: 2px; left: 2px; }
.screw-tr { top: 2px; right: 2px; }
.screw-bl { bottom: 2px; left: 2px; }
.screw-br { bottom: 2px; right: 2px; }

/* ---- Leather Notebook ---- */
#notebook {
    position: relative;
    width: 65%;
    min-height: 500px;
    z-index: 20;
    margin-top: 40px;
}

#notebook-cover {
    position: relative;
    background:
        linear-gradient(135deg, #4a3728 0%, #3a2a1a 100%);
    border-radius: 4px 8px 8px 4px;
    padding: 3px;
    box-shadow:
        0 12px 40px rgba(26, 18, 10, 0.5),
        0 4px 12px rgba(26, 18, 10, 0.3),
        inset 0 1px 0 rgba(100, 80, 60, 0.2);
}

#notebook-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px 8px 8px 4px;
    opacity: 0.15;
    filter: url(#noise);
    background: rgba(74, 55, 40, 0.5);
    pointer-events: none;
}

/* Leather wear marks */
#notebook-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px 8px 8px 4px;
    background:
        radial-gradient(ellipse at 5% 5%, rgba(100, 80, 60, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 95% 95%, rgba(100, 80, 60, 0.1) 0%, transparent 35%),
        radial-gradient(ellipse at 95% 5%, rgba(100, 80, 60, 0.08) 0%, transparent 30%),
        radial-gradient(ellipse at 5% 95%, rgba(100, 80, 60, 0.12) 0%, transparent 35%);
    pointer-events: none;
    z-index: 1;
}

/* Corner protectors */
.corner-protector {
    position: absolute;
    width: 24px;
    height: 24px;
    z-index: 5;
    overflow: hidden;
}

.corner-protector::after {
    content: '';
    position: absolute;
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #c9a84c 0%, #e8d48b 50%, #c9a84c 100%);
    border: 1px solid #8b6d2e;
}

.cp-tl { top: 0; left: 0; }
.cp-tl::after { top: -17px; left: -17px; transform: rotate(0deg); }
.cp-tr { top: 0; right: 0; }
.cp-tr::after { top: -17px; right: -17px; transform: rotate(0deg); }
.cp-bl { bottom: 0; left: 0; }
.cp-bl::after { bottom: -17px; left: -17px; transform: rotate(0deg); }
.cp-br { bottom: 0; right: 0; }
.cp-br::after { bottom: -17px; right: -17px; transform: rotate(0deg); }

/* Spine stitching */
#notebook-spine {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 20px;
    width: 2px;
    background: repeating-linear-gradient(
        to bottom,
        #c9a84c 0px,
        #c9a84c 8px,
        transparent 8px,
        transparent 14px
    );
    z-index: 3;
    opacity: 0.7;
}

/* Page edges */
#page-edges {
    position: absolute;
    top: 8px;
    bottom: 8px;
    right: 0;
    width: 10px;
    z-index: 2;
}

.page-edge {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 1px;
}

/* Notebook pages */
#notebook-pages {
    position: relative;
    background: #f0e6d0;
    min-height: 480px;
    border-radius: 2px 6px 6px 2px;
    overflow: hidden;
    margin-left: 30px;
}

#notebook-pages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.04;
    filter: url(#paper-noise);
    background: #f0e6d0;
    pointer-events: none;
    z-index: 1;
}

.notebook-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 48px 50px 48px 40px;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
    overflow-y: auto;
}

.notebook-page.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    position: relative;
}

.page-content {
    position: relative;
    z-index: 2;
}

h1, h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #c9a84c;
    letter-spacing: 0.03em;
}

h1 {
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 12px;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    font-weight: 600;
    margin-bottom: 12px;
}

h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: #3a2a1a;
    margin-bottom: 16px;
}

.title-rule {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #c9a84c, rgba(201, 168, 76, 0.2));
    margin-bottom: 24px;
}

.subtitle {
    font-family: 'Newsreader', Georgia, serif;
    font-weight: 500;
    font-variant: small-caps;
    font-size: 0.95rem;
    color: #6b5b4a;
    margin-bottom: 32px;
    letter-spacing: 0.05em;
}

.page-text p {
    color: #1c1c1e;
    margin-bottom: 1.2em;
}

.page-text em {
    font-style: italic;
    color: #4a3728;
}

/* Work items */
.work-item {
    padding: 18px 0;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
}

.work-date {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.85rem;
    color: #6b5b4a;
    display: block;
    margin-bottom: 4px;
}

.work-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #3a2a1a;
}

.work-desc {
    font-size: 0.95rem;
    color: #4a3728;
    margin-top: 6px;
    margin-bottom: 0;
}

/* ---- Brass Tab Navigation ---- */
#brass-tabs {
    position: absolute;
    top: 40px;
    right: -38px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 30;
}

.brass-tab {
    display: block;
    width: 38px;
    padding: 12px 6px;
    border: 1px solid #8b6d2e;
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: linear-gradient(135deg, #c9a84c 0%, #e8d48b 40%, #c9a84c 60%, #8b6d2e 100%);
    background-size: 200% 200%;
    background-position: 0% 0%;
    cursor: pointer;
    box-shadow:
        2px 2px 6px rgba(26, 18, 10, 0.3),
        inset 0 1px 0 rgba(232, 212, 139, 0.4);
    transition: background-position 0.4s ease, box-shadow 0.3s ease, transform 0.3s ease;
    position: relative;
}

.brass-tab:hover {
    background-position: 100% 100%;
    box-shadow:
        3px 3px 10px rgba(26, 18, 10, 0.4),
        inset 0 1px 0 rgba(232, 212, 139, 0.6);
    transform: translateX(3px);
}

.brass-tab.active {
    background: linear-gradient(135deg, #e8d48b 0%, #c9a84c 50%, #e8d48b 100%);
    box-shadow:
        1px 1px 4px rgba(26, 18, 10, 0.2),
        inset 0 2px 0 rgba(232, 212, 139, 0.5);
}

.tab-label {
    font-family: 'Newsreader', Georgia, serif;
    font-weight: 500;
    font-variant: small-caps;
    font-size: 0.7rem;
    color: #3a2a1a;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.05em;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px); }
    30% { transform: translateX(5px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(1px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

.shake-error-flash {
    border-color: #a05040;
}

/* Deep night variants: #1a1a1a, #1a1a1e used in building gradients */

/* ---- Loose Papers ---- */
#loose-papers {
    position: relative;
    margin-top: 60px;
    width: 55%;
    margin-left: auto;
    z-index: 15;
}

.loose-paper {
    background: #f0e6d0;
    padding: 28px 32px;
    position: relative;
    box-shadow: 0 3px 10px rgba(26, 18, 10, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.loose-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.03;
    filter: url(#paper-noise);
    background: #f0e6d0;
    pointer-events: none;
}

.loose-paper:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(26, 18, 10, 0.3);
}

.paper-3 {
    transform: rotate(-1deg);
    margin-bottom: -15px;
    z-index: 1;
    padding: 18px 24px;
}

.paper-2 {
    transform: rotate(1.5deg);
    margin-bottom: -10px;
    z-index: 2;
}

.paper-1 {
    transform: rotate(-0.5deg);
    z-index: 3;
}

.paper-3:hover { transform: rotate(-1deg) translateY(-5px); }
.paper-2:hover { transform: rotate(1.5deg) translateY(-5px); }
.paper-1:hover { transform: rotate(-0.5deg) translateY(-5px); }

.paper-note {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    color: #6b5b4a;
    font-size: 0.9rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.contact-link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
    transition: border-color 0.3s ease;
}

.contact-link:hover {
    border-color: #c9a84c;
}

.link-label {
    font-family: 'Newsreader', Georgia, serif;
    font-variant: small-caps;
    font-weight: 500;
    font-size: 0.85rem;
    color: #3a2a1a;
}

.link-value {
    font-family: 'EB Garamond', Georgia, serif;
    color: #c9a84c;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.contact-link:hover .link-value {
    color: #e8d48b;
}

.paper-footer {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 0.8rem;
    color: #6b5b4a;
    font-style: italic;
    margin-top: 12px;
}

/* ---- Mobile Menu ---- */
#mobile-menu-trigger {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #8b6d2e;
    background: linear-gradient(135deg, #c9a84c 0%, #e8d48b 40%, #c9a84c 60%, #8b6d2e 100%);
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(26, 18, 10, 0.4);
    transition: transform 0.3s ease;
}

#mobile-menu-trigger.open {
    transform: rotate(45deg);
}

.menu-icon {
    display: block;
    width: 18px;
    height: 2px;
    background: #3a2a1a;
    margin: 0 auto;
    position: relative;
}

.menu-icon::before,
.menu-icon::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #3a2a1a;
    left: 0;
}

.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

#mobile-radial-menu {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 999;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#mobile-radial-menu.visible {
    opacity: 1;
    transform: translateY(0);
}

.radial-item {
    display: block;
    padding: 10px 20px;
    border: 1px solid #8b6d2e;
    border-radius: 4px;
    background: linear-gradient(135deg, #c9a84c 0%, #e8d48b 40%, #c9a84c 100%);
    font-family: 'Newsreader', Georgia, serif;
    font-variant: small-caps;
    font-size: 0.85rem;
    color: #3a2a1a;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(26, 18, 10, 0.3);
    text-align: right;
}

/* ---- Arrival Animation ---- */
@keyframes lamp-on {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    #desk-surface {
        padding: 40px 50px;
        margin-top: 180px;
    }

    #photograph-frame {
        position: relative;
        top: auto;
        right: auto;
        margin: 0 auto 30px;
        transform: rotate(1deg);
    }

    #notebook {
        width: 85%;
    }

    #loose-papers {
        width: 75%;
    }
}

@media (max-width: 768px) {
    #desk-surface {
        padding: 20px 16px;
        margin-top: 150px;
    }

    #desk-texture {
        left: -16px;
        right: -16px;
    }

    #photograph-frame {
        width: 90%;
        max-width: 300px;
    }

    #notebook {
        width: 100%;
    }

    #notebook-cover {
        border-radius: 4px;
    }

    .notebook-page {
        padding: 28px 20px 28px 28px;
    }

    #brass-tabs {
        display: none;
    }

    #mobile-menu-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #mobile-radial-menu {
        display: flex;
    }

    #loose-papers {
        width: 95%;
        margin-left: auto;
        margin-right: auto;
    }

    #coffee-ring {
        display: none;
    }

    #notebook-spine {
        left: 12px;
    }

    #page-edges {
        display: none;
    }

    h1 {
        font-size: clamp(1.8rem, 6vw, 2.8rem);
    }
}

/* ---- Page turn effect ---- */
.page-turning-out {
    animation: page-turn-out 0.5s ease forwards;
}

.page-turning-in {
    animation: page-turn-in 0.5s ease forwards;
}

@keyframes page-turn-out {
    0% { opacity: 1; transform: perspective(800px) rotateY(0deg) translateX(0); }
    100% { opacity: 0; transform: perspective(800px) rotateY(-15deg) translateX(-40px); }
}

@keyframes page-turn-in {
    0% { opacity: 0; transform: perspective(800px) rotateY(10deg) translateX(40px); }
    100% { opacity: 1; transform: perspective(800px) rotateY(0deg) translateX(0); }
}

/* Photo bloom effect */
@keyframes photo-bloom {
    0% {
        opacity: 0;
        box-shadow: 0 0 0 rgba(201, 168, 76, 0);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 30px rgba(201, 168, 76, 0.3);
    }
    100% {
        opacity: 1;
        box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    }
}

.photo-content.bloom {
    animation: photo-bloom 1.2s ease forwards;
}
