/* ==========================================================================
   desca.work — Styles
   Leather-craft digital workspace with glitch undercurrent
   ========================================================================== */

/* ---------- Palette ---------- */
:root {
    --deep-hide: #2C1E14;
    --raw-hide: #D4BFA0;
    --patina-teal: #3D7A7A;
    --oxidized-copper: #8B5E3C;
    --burnished-gold: #C9A84C;
    --glitch-cyan: #00E5CC;
    --bone-white: #E8DCC4;
    --char-black: #1A120D;
    --dark-brown: #3B2F2F;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #1A120D;
    color: #E8DCC4;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ---------- Typography ---------- */
h1, h2, h3 {
    font-family: 'Bitter', serif;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.site-title {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: #E8DCC4;
    letter-spacing: 0.04em;
    line-height: 1.2;
    opacity: 0;
    transform: translateY(20px);
}

.site-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: #8B5E3C;
    opacity: 0;
    transform: translateY(20px);
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
}

.section-heading {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    margin-bottom: 2.5rem;
}

.body-text {
    margin-bottom: 2.5rem;
    font-weight: 300;
}

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

.closing-statement {
    font-family: 'Bitter', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: #E8DCC4;
    text-align: center;
    line-height: 1.4;
    margin-top: 3rem;
}

/* ---------- Leather Texture (CSS-only) ---------- */
.leather-texture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(139, 94, 60, 0.04) 0px, transparent 1px),
        radial-gradient(ellipse at 80% 70%, rgba(139, 94, 60, 0.03) 0px, transparent 1px),
        radial-gradient(ellipse at 50% 50%, rgba(139, 94, 60, 0.05) 0px, transparent 1px),
        radial-gradient(ellipse at 10% 80%, rgba(139, 94, 60, 0.02) 0px, transparent 1px),
        radial-gradient(ellipse at 90% 20%, rgba(139, 94, 60, 0.04) 0px, transparent 1px),
        radial-gradient(ellipse at 35% 65%, rgba(139, 94, 60, 0.03) 0px, transparent 1px),
        radial-gradient(ellipse at 65% 35%, rgba(139, 94, 60, 0.05) 0px, transparent 1px),
        radial-gradient(ellipse at 45% 15%, rgba(139, 94, 60, 0.02) 0px, transparent 1px),
        repeating-radial-gradient(circle at 25% 25%, transparent 0px, transparent 1px, rgba(139, 94, 60, 0.03) 1px, transparent 2px),
        repeating-radial-gradient(circle at 75% 75%, transparent 0px, transparent 1px, rgba(139, 94, 60, 0.04) 1px, transparent 2px),
        repeating-radial-gradient(circle at 50% 10%, transparent 0px, transparent 1px, rgba(139, 94, 60, 0.02) 1px, transparent 2px),
        repeating-radial-gradient(circle at 15% 55%, transparent 0px, transparent 1px, rgba(139, 94, 60, 0.06) 1px, transparent 2px),
        repeating-radial-gradient(circle at 85% 45%, transparent 0px, transparent 1px, rgba(139, 94, 60, 0.03) 1px, transparent 2px),
        linear-gradient(175deg, rgba(139, 94, 60, 0.01) 0%, transparent 50%, rgba(139, 94, 60, 0.02) 100%),
        linear-gradient(85deg, rgba(139, 94, 60, 0.02) 0%, transparent 30%, rgba(139, 94, 60, 0.01) 100%);
}

/* ---------- Segments ---------- */
.segment {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.segment-1 {
    min-height: 100vh;
    background-color: #1A120D;
}

.segment-dark {
    background-color: #2C1E14;
    color: #E8DCC4;
}

.segment-light {
    background-color: #D4BFA0;
    color: #3B2F2F;
}

.segment-light .section-heading {
    color: #1A120D;
}

.segment-light .body-text {
    color: #3B2F2F;
}

.segment-closing {
    min-height: 80vh;
    background-color: #1A120D;
}

.segment-2,
.segment-3,
.segment-4 {
    padding: 6rem 1.5rem;
}

.segment-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    width: 100%;
    padding: 0 1.5rem;
}

.opening-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 4rem;
}

/* ---------- Section hover: leather darkening effect ---------- */
.segment:hover .leather-texture {
    filter: contrast(1.05) brightness(1.02);
    transition: filter 0.4s ease;
}

.leather-texture {
    transition: filter 0.4s ease;
}

/* ---------- Stagger Animation ---------- */
.stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Opening-specific: these are animated by JS with delays */
.segment-1 .site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

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

/* ---------- Tooling Marks (section dividers) ---------- */
.tooling-mark {
    width: 48px;
    height: 48px;
    margin: 0 auto 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tooling-mark-circle {
    border: 2px solid #8B5E3C;
    border-radius: 50%;
}

.tooling-mark-diamond {
    width: 36px;
    height: 36px;
    border: 2px solid #8B5E3C;
    transform: rotate(45deg);
    margin-bottom: 2.5rem;
    margin-left: auto;
    margin-right: auto;
    background: rgba(61, 122, 122, 0.2);
}

.tooling-mark-hexagon {
    width: 40px;
    height: 40px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: none;
    background: transparent;
    position: relative;
    margin-bottom: 2.5rem;
    margin-left: auto;
    margin-right: auto;
}

.tooling-mark-hexagon::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #2C1E14;
}

.tooling-mark-hexagon {
    background: #8B5E3C;
}

/* ---------- Geometric Stamps ---------- */
.stamp {
    display: inline-block;
    transition: transform 0.12s ease-in-out;
}

.stamp-circle {
    width: 48px;
    height: 48px;
    border: 2px solid #8B5E3C;
    border-radius: 50%;
}

.stamp-diamond {
    width: 36px;
    height: 36px;
    border: 2px solid #8B5E3C;
    transform: rotate(45deg);
    background: rgba(61, 122, 122, 0.2);
}

.stamp-hexagon {
    width: 40px;
    height: 40px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #8B5E3C;
    position: relative;
}

.stamp-hexagon::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #1A120D;
}

.segment-dark .stamp-hexagon::after {
    background: #2C1E14;
}

.segment-light .stamp-hexagon::after {
    background: #D4BFA0;
}

.segment-closing .stamp-hexagon::after,
.segment-1 .stamp-hexagon::after {
    background: #1A120D;
}

.stamp-chevron {
    width: 30px;
    height: 30px;
    border-left: 2px solid #8B5E3C;
    border-bottom: 2px solid #8B5E3C;
    transform: rotate(-45deg);
}

.stamp-cross {
    width: 24px;
    height: 24px;
    position: relative;
}

.stamp-cross::before,
.stamp-cross::after {
    content: '';
    position: absolute;
    background: #C9A84C;
}

.stamp-cross::before {
    width: 2px;
    height: 24px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.stamp-cross::after {
    width: 24px;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

/* ---------- Tooling Belts ---------- */
.tooling-belt {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    width: 100%;
    padding: 2rem 0;
    opacity: 0.3;
    position: relative;
    z-index: 1;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.segment-1 .tooling-belt {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    margin-top: 0;
}

/* Belt stamps appear one-by-one in the opening */
.segment-1 .tooling-belt .stamp {
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

.segment-1 .tooling-belt .stamp.belt-visible {
    opacity: 1;
}

/* ---------- Stitch Lines ---------- */
.stitch-line {
    position: relative;
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background-color: #2C1E14;
}

.stitch-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px dashed #8B5E3C;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%);
    transition: border-style 0.3s ease;
}

.stitch-line:hover::before {
    border-top-style: solid;
}

.stitch-stamp {
    position: relative;
    z-index: 3;
    transform: scale(0.6);
    background-color: #2C1E14;
    padding: 0 0.5rem;
}

.stitch-stamp.stamp-circle {
    background-color: transparent;
    box-shadow: 0 0 0 8px #2C1E14;
}

.stitch-stamp.stamp-diamond {
    box-shadow: none;
    background: rgba(61, 122, 122, 0.2);
}

.stitch-stamp.stamp-hexagon {
    background-color: #8B5E3C;
}

.stitch-stamp.stamp-cross {
    background-color: transparent;
}

/* Stitch line between light and dark segments */
.segment-light + .stitch-line {
    background-color: #D4BFA0;
}

.segment-light + .stitch-line .stitch-stamp.stamp-circle {
    box-shadow: 0 0 0 8px #D4BFA0;
}

/* Final stitch line in closing segment */
.stitch-line-final {
    background-color: transparent;
    margin-top: 3rem;
}

.stitch-line-final::before {
    border-top: 2px dashed #8B5E3C;
}

/* ---------- Closing Hexagon ---------- */
.closing-hexagon {
    width: 120px;
    height: 120px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #C9A84C;
    position: relative;
    animation: spin 30s linear infinite;
}

.closing-hexagon::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #1A120D;
}

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

/* ---------- Footer ---------- */
.site-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 0 3rem;
    margin-top: auto;
}

.footer-text {
    font-size: 0.75rem;
    color: #8B5E3C;
    opacity: 0.6;
    letter-spacing: 0.06em;
}

.footer-separator {
    opacity: 0.3;
}

/* ---------- Glitch Effect (applied via JS) ---------- */
.glitch-text {
    text-shadow: 2px 0 #00E5CC, -2px 0 #8B5E3C;
}

.glitch-stamp {
    transform: translateX(3px) !important;
}

/* Mobile glitch: reduced offset */
@media (max-width: 767px) {
    .glitch-text {
        text-shadow: 1px 0 #00E5CC, -1px 0 #8B5E3C;
    }

    .glitch-stamp {
        transform: translateX(1px) !important;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .segment-2,
    .segment-3,
    .segment-4 {
        padding: 4rem 1rem;
    }

    .segment-content {
        padding: 0 1rem;
    }

    .tooling-belt {
        gap: 1rem;
        padding: 1.5rem 0.5rem;
    }

    .stamp-circle {
        width: 32px;
        height: 32px;
    }

    .stamp-diamond {
        width: 24px;
        height: 24px;
    }

    .stamp-hexagon {
        width: 28px;
        height: 28px;
    }

    .stamp-chevron {
        width: 20px;
        height: 20px;
    }

    .stamp-cross {
        width: 18px;
        height: 18px;
    }

    .stamp-cross::before {
        height: 18px;
    }

    .stamp-cross::after {
        width: 18px;
    }

    .tooling-mark {
        width: 36px;
        height: 36px;
    }

    .tooling-mark-diamond {
        width: 28px;
        height: 28px;
    }

    .tooling-mark-hexagon {
        width: 32px;
        height: 32px;
    }

    .closing-hexagon {
        width: 80px;
        height: 80px;
    }

    .site-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .tooling-belt {
        gap: 0.75rem;
    }

    .segment-2,
    .segment-3,
    .segment-4 {
        padding: 3rem 0.75rem;
    }
}
