/* ===========================
   desca.works - Ceramicist's Workshop
   =========================== */

:root {
    --charred-walnut: #2C2420;
    --bisque-porcelain: #F2EDE6;
    --kiln-gold: #C4A265;
    --raw-stoneware: #B8A898;
    --fired-umber: #6B5E52;
    --ash-white: #D4CFC8;
    --celadon-frost: #D4E4DC;
    --oxidized-copper: #5A8A7A;
    --workshop-dust: #8A7E72;
    --shelf-dark: #5C4A3A;
    --shelf-light: #7A6550;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bisque-porcelain);
    color: var(--fired-umber);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* Clay Texture Overlay (applied to cells) */
.clay-texture {
    background-image:
        radial-gradient(circle at 20% 30%, rgba(107, 94, 82, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, rgba(107, 94, 82, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(107, 94, 82, 0.03) 1px, transparent 1px),
        repeating-linear-gradient(1deg, rgba(107, 94, 82, 0.01) 0px, transparent 1px, transparent 3px);
    background-size: 8px 8px, 12px 12px, 6px 6px, 100% 4px;
}

/* ===========================
   Apprentice's Margin
   =========================== */
#apprentice-margin {
    position: fixed;
    left: 0;
    top: 0;
    width: 60px;
    height: 100vh;
    background-color: var(--bisque-porcelain);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    clip-path: polygon(0 0, 90% 0, 100% 3%, 92% 6%, 98% 10%, 91% 14%, 100% 18%, 93% 22%, 99% 26%, 90% 30%, 97% 34%, 91% 38%, 100% 42%, 92% 46%, 98% 50%, 90% 54%, 97% 58%, 92% 62%, 100% 66%, 91% 70%, 98% 74%, 93% 78%, 100% 82%, 90% 86%, 97% 90%, 92% 94%, 100% 98%, 90% 100%, 0 100%);
    border-right: 1px solid var(--raw-stoneware);
}

.margin-icon {
    width: 28px;
    height: 28px;
    transition: stroke 1.2s ease;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.margin-icon.active {
    stroke: var(--kiln-gold);
    stroke-dashoffset: 0;
}

.margin-icon.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.2s ease;
}

/* ===========================
   Ceramic Disk Navigation
   =========================== */
#ceramic-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 200;
}

.ceramic-disk {
    width: 48px;
    height: 48px;
    background-color: var(--raw-stoneware);
    border-radius: 47% 53% 42% 58% / 51% 49% 55% 45%;
    box-shadow:
        inset -3px -2px 6px rgba(44, 36, 32, 0.3),
        3px 2px 8px rgba(44, 36, 32, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 800ms ease;
    overflow: hidden;
    position: relative;
}

.ceramic-disk::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--kiln-gold);
    border-radius: 50%;
    opacity: 0.6;
}

.ceramic-disk:hover {
    width: 180px;
    height: 180px;
    transform: rotate(15deg);
}

.nav-label {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--charred-walnut);
    opacity: 0;
    transition: opacity 600ms ease 200ms;
    white-space: nowrap;
    cursor: pointer;
}

.ceramic-disk:hover .nav-label {
    opacity: 1;
}

.nav-label:nth-child(1) { top: 20%; left: 50%; transform: translate(-50%, -50%); }
.nav-label:nth-child(2) { top: 36%; left: 50%; transform: translate(-50%, -50%); }
.nav-label:nth-child(3) { top: 52%; left: 50%; transform: translate(-50%, -50%); }
.nav-label:nth-child(4) { top: 68%; left: 50%; transform: translate(-50%, -50%); }
.nav-label:nth-child(5) { top: 84%; left: 50%; transform: translate(-50%, -50%); }

/* ===========================
   The Kiln Door
   =========================== */
#kiln-door {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--charred-walnut);
    border: 12px solid var(--charred-walnut);
    box-shadow: inset 0 0 0 1px var(--kiln-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 50;
}

.kiln-door-upper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background-color: var(--charred-walnut);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2;
    transition: transform 0.1s linear, opacity 0.1s linear;
}

.kiln-door-lower {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background-color: var(--charred-walnut);
    z-index: 2;
    transition: transform 0.1s linear, opacity 0.1s linear;
}

.kintsugi-crack {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 5;
    pointer-events: none;
}

.fracture-line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: draw-fracture 3s ease forwards 2.5s;
}

@keyframes draw-fracture {
    to {
        stroke-dashoffset: 0;
    }
}

.kiln-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.title-desca {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: 8vw;
    font-weight: 400;
    color: var(--kiln-gold);
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
    line-height: 1;
    margin-bottom: 1rem;
}

.letter {
    display: inline-block;
    opacity: 0;
    animation: letter-appear 0.6s ease forwards;
}

@keyframes letter-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title-works {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.5em;
    color: var(--kiln-gold);
    opacity: 0;
    animation: fade-in-slow 1s ease forwards 2s;
}

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

.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: pulse-chevron 2s ease-in-out infinite;
}

.scroll-chevron svg {
    width: 32px;
    height: 32px;
}

@keyframes pulse-chevron {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 1; transform: translateX(-50%) translateY(6px); }
}

/* ===========================
   Transition Zone
   =========================== */
#transition-zone {
    height: 50vh;
    position: relative;
    background: linear-gradient(to bottom, var(--charred-walnut), var(--bisque-porcelain));
}

/* ===========================
   Workshop Grid (Main)
   =========================== */
#workshop {
    padding-left: 60px;
    position: relative;
}

.bento-section {
    padding: 2rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Shelf Dividers */
.shelf-divider {
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.shelf-bar {
    height: 6px;
    background: repeating-linear-gradient(
        90deg,
        var(--shelf-dark) 0px,
        var(--shelf-dark) 2px,
        var(--shelf-light) 2px,
        var(--shelf-light) 4px
    );
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
}

.shelf-label {
    position: absolute;
    top: -1.6rem;
    left: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--workshop-dust);
}

.shelf-prop {
    position: absolute;
    bottom: -8px;
    width: 12px;
    height: 8px;
}

.shelf-prop:nth-child(2) { left: 20%; }
.shelf-prop:nth-child(3) { left: 50%; }
.shelf-prop:nth-child(4) { left: 80%; }

/* ===========================
   Bento Grid System
   =========================== */
.bento-grid {
    display: grid;
    gap: 3px;
    background-color: var(--kiln-gold);
}

/* Material Grid */
.material-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto;
}

.material-grid .cell-wide {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.material-grid .cell-element:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
}

.material-grid .cell-element:nth-child(3) {
    grid-column: 4;
    grid-row: 1;
}

.material-grid .cell-element:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
}

.material-grid .cell-element:nth-child(5) {
    grid-column: 4;
    grid-row: 2;
}

/* Process Grid */
.process-grid {
    grid-template-columns: repeat(5, 1fr);
}

/* Imperfection Grid */
.imperfection-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
}

.imperfection-grid .cell-kintsugi-art {
    grid-column: 1;
    grid-row: 1 / 3;
}

.imperfection-grid .cell-misaligned:nth-child(2) {
    grid-column: 2 / 4;
    grid-row: 1;
}

.imperfection-grid .cell-misaligned:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.imperfection-grid .cell-misaligned:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
}

.imperfection-grid .cell-tall {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Glaze Grid */
.glaze-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
}

.glaze-grid .cell-wide {
    grid-column: 1 / 3;
}

/* ===========================
   Bento Cell Styles
   =========================== */
.bento-cell {
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    /* Clay texture overlay */
    background-image:
        radial-gradient(circle at 20% 30%, rgba(107, 94, 82, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, rgba(107, 94, 82, 0.03) 1px, transparent 1px),
        repeating-linear-gradient(1deg, rgba(107, 94, 82, 0.01) 0px, transparent 1px, transparent 3px);
    background-size: 8px 8px, 12px 12px, 100% 4px;
}

.bento-cell.animate-ready {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.bento-cell.animated {
    opacity: 1;
    transform: translateY(0) !important;
}

/* Keep deliberate rotations on misaligned cells */
.cell-misaligned.animated {
    transform: none !important;
}

/* Cell Color Variants */
.cell-dark,
.cell-charred {
    background-color: var(--charred-walnut);
    color: var(--ash-white);
}

.cell-clay {
    background-color: var(--raw-stoneware);
    color: var(--charred-walnut);
}

.cell-bisque {
    background-color: var(--bisque-porcelain);
    color: var(--fired-umber);
}

.cell-celadon {
    background-color: var(--celadon-frost);
    color: var(--charred-walnut);
}

.cell-teal {
    background-color: var(--oxidized-copper);
    color: var(--bisque-porcelain);
}

.cell-bisque-accent {
    background-color: var(--bisque-porcelain);
    color: var(--fired-umber);
}

.cell-celadon-deep {
    background-color: #C2D8D0;
    color: var(--charred-walnut);
}

.cell-teal-light {
    background-color: #6A9A8A;
    color: var(--bisque-porcelain);
}

/* ===========================
   Typography
   =========================== */
.philosophy-text {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 400;
    line-height: 1.8;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
}

.cell-dark .philosophy-text,
.cell-charred .philosophy-text {
    color: var(--kiln-gold);
}

.element-word {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 6rem;
    font-weight: 400;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1;
    color: var(--fired-umber);
}

.imperfection-word {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 5rem;
    font-weight: 400;
    font-style: italic;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 160px;
    line-height: 1;
    color: var(--kiln-gold);
}

/* Section Headings */
.bento-cell h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 500;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 48;
    margin-bottom: 1rem;
    color: inherit;
}

.cell-dark h3,
.cell-charred h3 {
    color: var(--kiln-gold);
}

.cell-celadon h3 {
    color: var(--charred-walnut);
}

.cell-teal h3,
.cell-teal-light h3 {
    color: var(--bisque-porcelain);
}

/* Process section */
.cell-process {
    text-align: center;
}

.process-icon {
    width: 2rem;
    height: 2rem;
    margin-bottom: 1rem;
    color: inherit;
}

.cell-charred .process-icon {
    color: var(--kiln-gold);
}

/* Kintsugi border animation for process cells */
.cell-process {
    border: 2px solid transparent;
    transition: border-color 800ms ease;
}

.cell-process.kintsugi-revealed {
    border-color: var(--kiln-gold);
}

/* Kintsugi art cell */
.cell-kintsugi-art {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.kintsugi-pattern {
    width: 100%;
    height: 100%;
    min-height: 280px;
}

/* Hand-stamped text */
.hand-stamped .stamp-word {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* ===========================
   Glaze Interactive Effect
   =========================== */
.cell-glaze-interactive {
    transition: background 1.2s ease;
    cursor: crosshair;
}

/* ===========================
   Section: Rest
   =========================== */
#section-rest {
    padding: 0;
    max-width: 100%;
}

.rest-container {
    width: 100%;
    background-color: var(--bisque-porcelain);
    padding: 8rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.resting-disk {
    width: 120px;
    height: 120px;
    animation: slow-rotate 60s linear infinite;
    margin-bottom: 3rem;
}

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

.rest-quote {
    font-family: 'Fraunces', Georgia, serif;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 400;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72;
    color: var(--fired-umber);
    max-width: 600px;
    line-height: 1.6;
}

/* ===========================
   Workshop Floor (Footer)
   =========================== */
#workshop-floor {
    width: 100%;
    height: 100vh;
    background-color: var(--charred-walnut);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 60px;
}

.floor-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.floor-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: var(--workshop-dust);
    white-space: nowrap;
}

.floor-line-left,
.floor-line-right {
    width: 120px;
    height: 1px;
    background-color: var(--kiln-gold);
    opacity: 0.5;
}

.floor-disk {
    width: 80px;
    height: 80px;
    opacity: 0.4;
}

/* ===========================
   Kintsugi Hover Effects
   =========================== */
.kintsugi-crack .fracture-line {
    transition: opacity 600ms ease-out;
    opacity: 0.6;
}

.kintsugi-crack:hover .fracture-line {
    opacity: 1;
}

/* ===========================
   Reduced Motion
   =========================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .letter {
        opacity: 1;
    }

    .title-works {
        opacity: 1;
    }

    .fracture-line {
        stroke-dashoffset: 0;
    }

    .margin-icon {
        stroke-dashoffset: 0;
    }

    .bento-cell.animate-ready {
        opacity: 1;
        transform: none;
    }
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 900px) {
    #apprentice-margin {
        display: none;
    }

    #workshop {
        padding-left: 0;
    }

    #workshop-floor {
        padding-left: 0;
    }

    .material-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .material-grid .cell-wide {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .material-grid .cell-element:nth-child(2) { grid-column: 1; grid-row: 2; }
    .material-grid .cell-element:nth-child(3) { grid-column: 2; grid-row: 2; }
    .material-grid .cell-element:nth-child(4) { grid-column: 1; grid-row: 3; }
    .material-grid .cell-element:nth-child(5) { grid-column: 2; grid-row: 3; }

    .process-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .imperfection-grid {
        grid-template-columns: 1fr 1fr;
    }

    .imperfection-grid .cell-kintsugi-art {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .imperfection-grid .cell-misaligned:nth-child(2) {
        grid-column: 1 / 3;
        grid-row: 2;
    }

    .imperfection-grid .cell-misaligned:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }

    .imperfection-grid .cell-misaligned:nth-child(4) {
        grid-column: 2;
        grid-row: 3;
    }

    .imperfection-grid .cell-tall {
        grid-column: 1 / 3;
        grid-row: 4;
    }

    .glaze-grid {
        grid-template-columns: 1fr 1fr;
    }

    .glaze-grid .cell-wide {
        grid-column: 1 / 3;
    }

    .element-word {
        font-size: 4rem;
    }

    .imperfection-word {
        font-size: 3.5rem;
    }
}

@media (max-width: 600px) {
    .material-grid,
    .process-grid,
    .imperfection-grid,
    .glaze-grid {
        grid-template-columns: 1fr;
    }

    .material-grid .cell-wide,
    .material-grid .cell-element,
    .imperfection-grid .cell-kintsugi-art,
    .imperfection-grid .cell-misaligned,
    .imperfection-grid .cell-tall,
    .glaze-grid .cell-wide {
        grid-column: 1;
        grid-row: auto;
    }

    .bento-cell {
        padding: 2rem 1.5rem;
    }

    .element-word {
        font-size: 3rem;
    }

    .imperfection-word {
        font-size: 2.5rem;
        min-height: 100px;
    }

    .rest-container {
        padding: 5rem 1.5rem;
    }

    .floor-line-left,
    .floor-line-right {
        width: 60px;
    }

    #ceramic-nav {
        bottom: 1rem;
        right: 1rem;
    }
}
