/* =============================================================
   namu.works — woodworking portfolio
   Mid-century modern × hand-drawn × engineering paper
   ============================================================= */

:root {
    /* Palette — exact hex values from DESIGN.md */
    --dark-walnut: #2c2418;
    --honey-oak:   #c4a070;
    --sawdust:     #faf5ed;
    --teak:        #8b5e34;
    --maple:       #d4c4a8;
    --pencil-red:  #e63946;
    --workshop-green: #4a6741;
    --bark:        #6b5b4a;
    --steel-blue:  #d0dce8;

    /* Blueprint paper */
    --blueprint-bg: #f0f4f8;

    /* Type scale */
    --display: 'Bebas Neue', sans-serif;
    --body:    'Source Sans 3', sans-serif;
    --tech:    'Courier Prime', monospace;

    /* Motion */
    --slide-easing: cubic-bezier(0.65, 0, 0.35, 1);
    --slide-dur: 0.8s;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--sawdust);
    color: var(--dark-walnut);
    font-family: var(--body);
    font-size: 1rem;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }

/* =============================================================
   HERO — diagonal split: wood-grain triangle vs. cream triangle
   ============================================================= */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 640px;
    overflow: hidden;
    background: var(--sawdust);
}

.hero-wood {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* upper-left triangle */
    clip-path: polygon(0 0, 100% 0, 0 100%);
    background:
        repeating-linear-gradient(3deg,
            #c4a070 0px,
            #b8935a 2px,
            #c4a070 4px),
        var(--honey-oak);
}

.wood-grain-overlay {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(87deg,
            transparent 0px,
            rgba(139, 94, 52, 0.08) 1px,
            transparent 2px),
        repeating-linear-gradient(2deg,
            transparent 0px,
            rgba(44, 36, 24, 0.06) 8px,
            transparent 16px),
        repeating-linear-gradient(5deg,
            transparent 0px,
            rgba(139, 94, 52, 0.04) 1px,
            transparent 30px);
    pointer-events: none;
}

.hero-cream {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* lower-right triangle (complement) */
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    background:
        var(--sawdust)
        radial-gradient(circle at 75% 65%, rgba(196, 160, 112, 0.08), transparent 60%);
    /* engineering paper grid hint */
    background-image:
        linear-gradient(rgba(208, 220, 232, 0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(208, 220, 232, 0.35) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px;
    background-color: var(--sawdust);
}

.hero-meta {
    position: absolute;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.hero-meta-tl {
    top: 2rem;
    left: 2rem;
    color: var(--dark-walnut);
}
.hero-meta-br {
    bottom: 2rem;
    right: 2rem;
    color: var(--bark);
}
.meta-line {
    display: inline-block;
    width: 48px;
    height: 1px;
    background: currentColor;
    opacity: 0.55;
}
.meta-tag { opacity: 0.85; }

.hero-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    z-index: 5;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(3.5rem, 13vw, 11rem);
    line-height: 0.92;
    letter-spacing: 0.02em;
    text-align: center;
    color: var(--dark-walnut);
    pointer-events: none;
    white-space: nowrap;
    will-change: transform, opacity;
}
.hero-title-line {
    display: inline-block;
}
.hero-title-accent {
    color: var(--pencil-red);
}

.hero-subtitle {
    position: absolute;
    top: calc(50% + 4.5rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    font-family: var(--tech);
    font-size: 0.85rem;
    letter-spacing: 0.32em;
    text-transform: lowercase;
    color: var(--bark);
    text-align: center;
}

.hero-dimension {
    position: absolute;
    z-index: 6;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, 70vw);
    height: 1px;
    background: var(--pencil-red);
    opacity: 0.55;
    display: flex;
    justify-content: center;
}
.hero-dimension .dim-cap {
    position: absolute;
    top: -5px;
    width: 1px;
    height: 11px;
    background: var(--pencil-red);
    opacity: 0.7;
}
.dim-cap-l { left: 0; }
.dim-cap-r { right: 0; }
.hero-dimension .dim-text {
    position: absolute;
    top: -22px;
    background: var(--sawdust);
    padding: 0 0.5rem;
    font-family: var(--tech);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--pencil-red);
    opacity: 0.85;
}

.hero-scroll-hint {
    position: absolute;
    bottom: 1.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--tech);
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--bark);
    animation: float 2.4s ease-in-out infinite;
}
.scroll-mark {
    width: 1px;
    height: 28px;
    background: linear-gradient(to bottom, var(--bark), transparent);
}

@keyframes float {
    0%, 100% { transform: translate(-50%, 0); opacity: 0.85; }
    50%      { transform: translate(-50%, 6px); opacity: 0.55; }
}

/* =============================================================
   SAW-KERF DIVIDER — zigzag clip-path
   ============================================================= */

.kerf-divider {
    width: 100%;
    height: 14px;
    background: var(--bark);
    clip-path: polygon(
        0% 50%,    1.5% 0%,   3% 50%,   4.5% 100%,  6% 50%,
        7.5% 0%,   9% 50%,    10.5% 100%, 12% 50%,
        13.5% 0%,  15% 50%,   16.5% 100%, 18% 50%,
        19.5% 0%,  21% 50%,   22.5% 100%, 24% 50%,
        25.5% 0%,  27% 50%,   28.5% 100%, 30% 50%,
        31.5% 0%,  33% 50%,   34.5% 100%, 36% 50%,
        37.5% 0%,  39% 50%,   40.5% 100%, 42% 50%,
        43.5% 0%,  45% 50%,   46.5% 100%, 48% 50%,
        49.5% 0%,  51% 50%,   52.5% 100%, 54% 50%,
        55.5% 0%,  57% 50%,   58.5% 100%, 60% 50%,
        61.5% 0%,  63% 50%,   64.5% 100%, 66% 50%,
        67.5% 0%,  69% 50%,   70.5% 100%, 72% 50%,
        73.5% 0%,  75% 50%,   76.5% 100%, 78% 50%,
        79.5% 0%,  81% 50%,   82.5% 100%, 84% 50%,
        85.5% 0%,  87% 50%,   88.5% 100%, 90% 50%,
        91.5% 0%,  93% 50%,   94.5% 100%, 96% 50%,
        97.5% 0%,  99% 50%,   100% 50%,
        100% 100%, 0% 100%
    );
    opacity: 0.85;
}

/* =============================================================
   CHAPTER MARK
   ============================================================= */

.chapter-mark {
    background: var(--sawdust);
    padding: 7rem 2rem 5rem;
}

.chapter-inner {
    max-width: 880px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.chapter-num {
    display: inline-block;
    font-family: var(--display);
    font-size: clamp(3rem, 7vw, 5rem);
    color: var(--pencil-red);
    line-height: 1;
    margin-bottom: 1.25rem;
    letter-spacing: 0.05em;
}

.chapter-title {
    font-family: var(--display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--dark-walnut);
    margin-bottom: 1.75rem;
    text-transform: lowercase;
}

.chapter-lede {
    font-family: var(--body);
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--bark);
    max-width: 620px;
    margin: 0 auto 2rem;
}

.chapter-stamp {
    display: inline-block;
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--workshop-green);
    opacity: 0.8;
    padding: 0.4rem 1rem;
    border: 1px solid var(--workshop-green);
    border-opacity: 0.4;
    border-color: rgba(74, 103, 65, 0.4);
    border-radius: 1px;
}

/* =============================================================
   RULER RULE — thin line with notch marks
   ============================================================= */

.ruler-rule {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 4rem;
    height: 14px;
    padding: 0 2rem;
}
.ruler-track {
    position: relative;
    width: 100%;
    height: 1px;
    background: var(--bark);
    opacity: 0.5;
    background-image: linear-gradient(to right, var(--bark) 1px, transparent 1px);
}
.ruler-track::before,
.ruler-track::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 1px;
    height: 7px;
    background: var(--bark);
    opacity: 0.7;
}
.ruler-track::before { left: 0; }
.ruler-track::after  { right: 0; }
/* notch marks via repeating background */
.ruler-track {
    background:
        linear-gradient(var(--bark), var(--bark)) center / 100% 1px no-repeat,
        repeating-linear-gradient(to right,
            transparent 0px,
            transparent 39px,
            var(--bark) 39px,
            var(--bark) 40px) center / 100% 5px no-repeat;
    background-color: transparent;
    height: 5px;
}

/* =============================================================
   PORTFOLIO — magazine spreads, 55/45 alternating split
   ============================================================= */

.portfolio {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem clamp(1rem, 4vw, 4rem) 4rem;
}

.spread {
    position: relative;
    display: grid;
    grid-template-columns: 55fr 45fr;
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    padding: clamp(3rem, 7vw, 6rem) 0;
    border-bottom: 1px solid rgba(107, 91, 74, 0.18);
    overflow: hidden;
}

.spread:last-child {
    border-bottom: none;
}

.spread-reverse {
    grid-template-columns: 45fr 55fr;
}
.spread-reverse .spread-blueprint { order: 1; }
.spread-reverse .spread-text      { order: 2; }

/* Slide-reveal overlay — covers spread, slides away on reveal */
.reveal-overlay {
    position: absolute;
    inset: 0;
    background: var(--maple);
    z-index: 4;
    transform: translateX(0);
    transition: transform var(--slide-dur) var(--slide-easing);
    pointer-events: none;
}
.spread.revealed .reveal-overlay {
    transform: translateX(-110%);
}
.spread-reverse .reveal-overlay {
    background: var(--honey-oak);
}
.spread-reverse.revealed .reveal-overlay {
    transform: translateX(110%);
}

/* Text column */
.spread-text {
    position: relative;
    z-index: 2;
    padding: 1rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease 0.4s, transform 0.7s ease 0.4s;
}
.spread.revealed .spread-text {
    opacity: 1;
    transform: translateY(0);
}

.spread-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.spread-num {
    font-family: var(--display);
    font-size: 2rem;
    color: var(--pencil-red);
    line-height: 1;
}
.spread-tag {
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--workshop-green);
    padding-left: 1rem;
    border-left: 1px solid var(--bark);
    line-height: 1.5;
}

.spread-title {
    font-family: var(--display);
    font-size: clamp(2rem, 4.5vw, 3.4rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.04em;
    color: var(--dark-walnut);
    margin-bottom: 1.5rem;
    text-transform: lowercase;
}

.spread-body {
    font-family: var(--body);
    font-size: 1.02rem;
    line-height: 1.78;
    color: var(--dark-walnut);
    margin-bottom: 1.1rem;
    max-width: 38em;
}

.spec-list {
    list-style: none;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px dashed rgba(107, 91, 74, 0.4);
    display: grid;
    gap: 0.5rem;
}
.spec-list li {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 1rem;
    font-family: var(--tech);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}
.spec-key {
    color: var(--pencil-red);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    opacity: 0.85;
}
.spec-val {
    color: var(--dark-walnut);
}

/* Blueprint column */
.spread-blueprint {
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease 0.55s, transform 0.7s ease 0.55s;
}
.spread.revealed .spread-blueprint {
    opacity: 1;
    transform: translateY(0);
}

.blueprint-frame {
    position: relative;
    background: var(--blueprint-bg);
    background-image:
        linear-gradient(rgba(208, 220, 232, 0.55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(208, 220, 232, 0.55) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: -1px -1px;
    border: 1px solid rgba(107, 91, 74, 0.35);
    padding: 1.5rem;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
}

/* dimension lines around blueprint frame */
.blueprint-frame::before,
.blueprint-frame::after {
    content: '';
    position: absolute;
    background: var(--pencil-red);
    opacity: 0.55;
}
.blueprint-frame::before {
    top: -10px;
    left: 0;
    right: 0;
    height: 1px;
}
.blueprint-frame::after {
    top: -14px;
    left: 0;
    width: 1px;
    height: 9px;
    box-shadow:
        calc(100% - 1px) 0 0 var(--pencil-red);
}

.bp-svg {
    width: 100%;
    flex: 1;
    height: auto;
}

.bp-caption {
    display: block;
    margin-top: 0.85rem;
    text-align: center;
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--bark);
    opacity: 0.75;
}

/* =============================================================
   MATERIAL LIBRARY
   ============================================================= */

.material-library {
    background: var(--dark-walnut);
    color: var(--sawdust);
    padding: 6rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.material-library::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(89deg,
            transparent 0px,
            rgba(196, 160, 112, 0.04) 1px,
            transparent 2px);
    pointer-events: none;
}

.lib-header {
    max-width: 880px;
    margin: 0 auto 3.5rem;
    padding: 0 2rem;
    text-align: center;
    position: relative;
    z-index: 2;
}

.lib-eyebrow {
    display: inline-block;
    font-family: var(--tech);
    font-size: 0.72rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--pencil-red);
    margin-bottom: 1rem;
}

.lib-title {
    font-family: var(--display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--sawdust);
    margin-bottom: 1.25rem;
    text-transform: lowercase;
}

.lib-sub {
    font-family: var(--body);
    color: var(--maple);
    font-size: 1rem;
    max-width: 580px;
    margin: 0 auto;
    opacity: 0.85;
}

.swatch-strip {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem clamp(1.5rem, 5vw, 4rem) 2rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--bark) transparent;
    position: relative;
    z-index: 2;
}
.swatch-strip::-webkit-scrollbar {
    height: 6px;
}
.swatch-strip::-webkit-scrollbar-track {
    background: rgba(107, 91, 74, 0.2);
}
.swatch-strip::-webkit-scrollbar-thumb {
    background: var(--bark);
    border-radius: 3px;
}

.wood-swatch {
    flex: 0 0 220px;
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.4s var(--slide-easing);
}
.wood-swatch:hover {
    transform: translateY(-6px);
}

.swatch-block {
    position: relative;
    width: 100%;
    height: 280px;
    border: 1px solid rgba(196, 160, 112, 0.25);
    margin-bottom: 0.85rem;
    overflow: hidden;
}

/* dimension cap detail on swatches */
.swatch-block::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    height: 1px;
    background: rgba(230, 57, 70, 0.55);
}

/* Wood-specific gradients */
.swatch-oak {
    background:
        repeating-linear-gradient(3deg,
            #c4a070 0px, #b8935a 2px, #c4a070 4px),
        repeating-linear-gradient(87deg,
            transparent 0px, rgba(139,94,52,0.08) 1px, transparent 2px);
}
.swatch-walnut {
    background:
        repeating-linear-gradient(4deg,
            #6b5b4a 0px, #5a4a3a 3px, #6b5b4a 6px),
        repeating-linear-gradient(86deg,
            transparent 0px, rgba(44,36,24,0.15) 1px, transparent 2px);
}
.swatch-maple {
    background:
        repeating-linear-gradient(2deg,
            #d4c4a8 0px, #c8b698 2px, #d4c4a8 4px),
        repeating-linear-gradient(88deg,
            transparent 0px, rgba(196,160,112,0.1) 1px, transparent 3px);
}
.swatch-cherry {
    background:
        repeating-linear-gradient(3deg,
            #8b5e34 0px, #7a4f28 2px, #8b5e34 4px),
        repeating-linear-gradient(87deg,
            transparent 0px, rgba(44,36,24,0.12) 1px, transparent 2px);
}
.swatch-teak {
    background:
        repeating-linear-gradient(5deg,
            #a87a4f 0px, #8b5e34 2px, #a87a4f 4px),
        repeating-linear-gradient(85deg,
            transparent 0px, rgba(44,36,24,0.1) 1px, transparent 2px);
}

.swatch-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(196, 160, 112, 0.2);
}
.swatch-name {
    font-family: var(--display);
    font-size: 1.4rem;
    color: var(--sawdust);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.swatch-latin {
    font-family: var(--body);
    font-style: italic;
    font-size: 0.78rem;
    color: var(--maple);
    opacity: 0.75;
}
.swatch-hex {
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: var(--pencil-red);
    margin-top: 0.2rem;
}

.lib-rule {
    max-width: 1100px;
    margin: 2rem auto 0;
    height: 1px;
    background: rgba(196, 160, 112, 0.25);
}

/* =============================================================
   FOOTER
   ============================================================= */

.footer {
    background: var(--dark-walnut);
    color: var(--maple);
    padding: 4rem 2rem 3rem;
    position: relative;
    border-top: 1px solid rgba(196, 160, 112, 0.18);
}

.footer-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.footer-col-mark {
    align-items: center;
    text-align: center;
}
.footer-col-right {
    text-align: right;
}

.footer-eyebrow {
    font-family: var(--tech);
    font-size: 0.65rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--pencil-red);
    opacity: 0.85;
}

.footer-body {
    font-family: var(--body);
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--maple);
    opacity: 0.85;
}
.footer-body-quiet {
    font-style: italic;
    color: var(--honey-oak);
    opacity: 0.6;
    font-size: 0.82rem;
}

.footer-mark {
    font-family: var(--display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--sawdust);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.footer-tag {
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--workshop-green);
    opacity: 0.95;
}

.footer-rule {
    max-width: 1100px;
    margin: 2.5rem auto 1.5rem;
    height: 1px;
    background: rgba(196, 160, 112, 0.2);
    position: relative;
}
.footer-rule::before,
.footer-rule::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 1px;
    height: 7px;
    background: rgba(196, 160, 112, 0.4);
}
.footer-rule::before { left: 0; }
.footer-rule::after  { right: 0; }

.footer-bottom {
    text-align: center;
}
.footer-stamp {
    font-family: var(--tech);
    font-size: 0.7rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--bark);
    opacity: 0.85;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 900px) {
    .spread,
    .spread-reverse {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .spread-reverse .spread-blueprint { order: 2; }
    .spread-reverse .spread-text      { order: 1; }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.25rem;
        text-align: center;
    }
    .footer-col,
    .footer-col-right {
        text-align: center;
        align-items: center;
    }

    .hero-meta-tl,
    .hero-meta-br {
        font-size: 0.6rem;
        gap: 0.5rem;
    }
    .meta-line { width: 28px; }
    .hero-title {
        font-size: clamp(3rem, 18vw, 7rem);
    }
}

@media (max-width: 560px) {
    .blueprint-frame { padding: 1rem; }
    .swatch-block { height: 220px; }
    .wood-swatch { flex: 0 0 180px; }
    .hero-dimension { width: 80vw; }
    .chapter-mark { padding: 5rem 1.5rem 4rem; }
    .portfolio { padding: 1rem 1rem 3rem; }
    .spec-list li {
        grid-template-columns: 90px 1fr;
        font-size: 0.72rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
    .spread .reveal-overlay { display: none; }
    .spread .spread-text,
    .spread .spread-blueprint {
        opacity: 1;
        transform: none;
    }
}
