/* ============================================
   paragram.dev — styles.css
   Flat-design classicism, sunset-warm palette
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --vellum-cream: #F5E6D0;
    --terracotta: #C4784A;
    --umber-dark: #3B2414;
    --ink-walnut: #2C1810;
    --faded-sienna: #8B6B4A;
    --brass: #B87333;
    --sunset-coral: #E8926A;
    --carrara-pale: #F0EDE8;
    --leather-deep: #4A3220;
    --current-bg: #F5E6D0;
    --current-text: #2C1810;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--current-text);
    background-color: var(--current-bg);
    transition: background-color 200ms ease, color 200ms ease;
    overflow-x: hidden;
}

/* --- Main Scroll Container --- */
#scroll-container {
    scroll-snap-type: y proximity;
    overflow-y: auto;
    height: 100vh;
}

/* --- Page Sections --- */
.page {
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    justify-content: center;
    position: relative;
}

.page-inner {
    max-width: 680px;
    width: 100%;
    padding: 15vh 24px 10vh;
    margin-left: 10vw;
    margin-right: auto;
}

@media (max-width: 1023px) {
    .page-inner {
        margin-left: auto;
        margin-right: auto;
    }
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(2.2rem, 5vw, 4.5rem);
}

h1 {
    font-size: clamp(3rem, 7vw, 5.5rem);
}

.prose p {
    margin-bottom: 1.5em;
}

.prose p + p {
    text-indent: 1.5em;
}

.prose p:first-child,
.prose .drop-cap-p {
    text-indent: 0;
}

em {
    font-style: italic;
}

/* --- Opening Section Title --- */
#title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    position: relative;
}

#main-title {
    position: relative;
    color: var(--brass);
    text-shadow: 1px 1px 0px var(--umber-dark);
}

#main-title .char {
    display: inline-block;
    opacity: 0;
    position: relative;
}

#main-title .char.assembled {
    opacity: 1;
    transform: translate(0, 0);
    transition: transform 1200ms cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 600ms ease;
}

#subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--faded-sienna);
    opacity: 0;
    transition: opacity 800ms ease;
    margin-top: 1rem;
}

#subtitle.visible {
    opacity: 1;
}

/* --- Kinetic Heading Letters --- */
.kinetic-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 300ms ease, transform 300ms ease;
}

.kinetic-heading .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.kinetic-heading .char.swapping {
    transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* White space handling */
.kinetic-heading .char-space {
    width: 0.3em;
}

/* --- Drop Capitals --- */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 4.5em;
    line-height: 0.8;
    padding-right: 0.08em;
    padding-top: 0.05em;
    color: var(--brass);
}

@media (max-width: 767px) {
    .drop-cap {
        font-size: 3.5em;
    }
}

/* --- Volute Dividers --- */
.volute-divider {
    display: block;
    margin: 0 auto 2rem;
}

.volute-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

.volute-divider.drawn .volute-path {
    stroke-dashoffset: 0;
}

/* --- Navigation Dot --- */
#nav-dot {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--brass);
    border: none;
    cursor: pointer;
    z-index: 1000;
    transition: transform 600ms ease;
}

#nav-dot:hover {
    background-color: var(--sunset-coral);
}

#nav-dot.pulse {
    animation: dot-pulse 600ms ease;
}

@keyframes dot-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@media (max-width: 767px) {
    #nav-dot {
        right: 50%;
        transform: translateX(50%);
        bottom: 1.5rem;
    }
}

/* --- Navigation Overlay --- */
#nav-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(59, 36, 20, 0.96);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

#nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#nav-overlay-content {
    text-align: center;
}

.nav-item {
    display: block;
    padding: 1.2rem 0;
    cursor: pointer;
    transition: color 200ms ease;
}

.nav-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--vellum-cream);
    display: block;
}

.nav-paragram {
    font-family: 'Inconsolata', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--faded-sienna);
    display: block;
    margin-top: 0.25rem;
}

.nav-item:hover .nav-title {
    color: var(--sunset-coral);
}

/* --- Margin Annotation Column --- */
#margin-column {
    position: fixed;
    right: 5vw;
    top: 50%;
    transform: translateY(-50%);
    width: 240px;
    z-index: 10;
    display: none;
}

@media (min-width: 1024px) {
    #margin-column {
        display: block;
    }
}

.margin-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transition: opacity 300ms ease;
    font-family: 'Inconsolata', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--faded-sienna);
}

.margin-content.active {
    opacity: 0.45;
}

.margin-content p {
    margin-bottom: 0.8em;
    line-height: 1.5;
}

/* --- Leather texture dot pattern --- */
#section-4 {
    background-image: radial-gradient(circle, rgba(245, 230, 208, 0.08) 1px, transparent 1px);
    background-size: 12px 12px;
}

/* --- Stitching borders on content containers --- */
.page-inner {
    border-right: 1px dashed transparent;
}

@media (min-width: 1024px) {
    #section-3 .page-inner,
    #section-4 .page-inner {
        border-right: 1px dashed var(--brass);
        border-image: repeating-linear-gradient(
            to bottom,
            var(--brass) 0px,
            var(--brass) 8px,
            transparent 8px,
            transparent 14px
        ) 1;
        padding-right: 2rem;
    }
}

/* --- Paragram Demo Words --- */
.paragram-demo {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin: 3rem 0;
}

.demo-word {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    cursor: default;
    transition: color 300ms ease;
    position: relative;
}

.demo-word::after {
    content: attr(data-paragram);
    display: block;
    font-family: 'Inconsolata', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--vellum-cream);
    opacity: 0.5;
    margin-top: 0.3rem;
    text-align: center;
}

.demo-word:hover {
    color: var(--sunset-coral);
}

/* --- Workshop Display --- */
#workshop-display {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    justify-content: center;
    margin: 3rem 0;
    padding: 2rem 0;
}

.workshop-word {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    transition: opacity 300ms ease;
}

.workshop-word .char {
    display: inline-block;
    transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 200ms ease;
}

/* --- Closing Signature --- */
.closing-sig {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--brass);
    text-align: center;
    margin-top: 3rem;
    letter-spacing: 0.05em;
}

/* --- Column fluting background for margin area --- */
@media (min-width: 1024px) {
    body::after {
        content: '';
        position: fixed;
        right: 3vw;
        top: 0;
        bottom: 0;
        width: 280px;
        background-image: repeating-linear-gradient(
            to right,
            rgba(139, 107, 74, 0.08) 0px,
            rgba(139, 107, 74, 0.08) 3px,
            transparent 3px,
            transparent 15px
        );
        pointer-events: none;
        z-index: 1;
    }
}
