/* ==========================================================================
   reasoner.studio
   Studio wall + single-column reasoning page
   Palette: linen, butter, dawn, cork, terracotta, walnut, slate, sketch blue
   --------------------------------------------------------------------------
   Typography note (per DESIGN.md):
   Display face: Caveat (Google Fonts) -- handwritten, scrawled-on-the-wall.
   Body / reasoning prose: Source Sans 3's generous x-height and open counters
   make it exceptionally legible at body sizes while maintaining a friendly,
   unpretentious character that complements the handwritten display face.
   Labels / annotations: Inconsolata (Google Fonts) -- monospaced metadata.
   --------------------------------------------------------------------------
   Animation note (per DESIGN.md):
   String-draw uses Intersection Observer on each string's midpoint, and the
   single-column transition uses an Intersection Observer on a sentinel element
   placed between sections.
   ========================================================================== */

:root {
    --bg-linen: #F5F0E8;
    --card-white: #FFFFFF;
    --card-warm: #FFF8F0;
    --card-cool: #F0F2F6;
    --cork: #C4956A;
    --walnut: #3A3226;
    --slate: #6B6358;
    --terracotta: #C85A3A;
    --sketch-blue: #4A7FB5;
    --sticky-yellow: #FFFDE7;
    --sticky-peach: #FFE0CC;

    --font-display: 'Caveat', cursive;
    --font-body: 'Source Sans 3', 'Inter', system-ui, sans-serif;
    --font-mono: 'Inconsolata', monospace;

    --gap: 12px;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 6px 22px rgba(58, 50, 38, 0.10);
    --shadow-sticky: 0 3px 6px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-linen);
    color: var(--walnut);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.68;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    background-image:
        radial-gradient(rgba(107, 99, 88, 0.08) 1px, transparent 1px),
        radial-gradient(rgba(107, 99, 88, 0.05) 1px, transparent 1px);
    background-size: 28px 28px, 14px 14px;
    background-position: 0 0, 7px 7px;
}

main {
    position: relative;
    z-index: 1;
}

/* ----- Progress bar ----- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--terracotta);
    z-index: 100;
    transition: width 0.08s linear;
}

/* ----- Floating domain label ----- */
.domain-label {
    position: fixed;
    top: 18px;
    left: 22px;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--walnut);
    z-index: 50;
    letter-spacing: 0.5px;
    transform: rotate(-2deg);
    background: rgba(245, 240, 232, 0.85);
    padding: 2px 10px;
    border-radius: 3px;
    backdrop-filter: blur(2px);
}

/* ==========================================================================
   STUDIO WALL
   ========================================================================== */

.studio-wall {
    position: relative;
    min-height: 150vh;
    padding: 84px 36px 96px;
    overflow: hidden;
}

.strings-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.strings-layer .string-path {
    fill: none;
    stroke: var(--cork);
    stroke-width: 2;
    stroke-dasharray: 8 4;
    stroke-linecap: round;
}

.strings-layer .pin {
    fill: var(--terracotta);
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.strings-layer .pin.visible { opacity: 1; }

.strings-layer .pin-ring {
    fill: none;
    stroke: var(--terracotta);
    stroke-width: 1;
    opacity: 0;
    transition: opacity 600ms ease-out 120ms;
}

.strings-layer .pin-ring.visible { opacity: 0.4; }

/* ----- Bento grid ----- */
.bento-grid {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 120px;
    gap: var(--gap);
    max-width: 1280px;
    margin: 0 auto;
}

/* Module sizes (varied bento) */
.module-title       { grid-column: span 2; grid-row: span 2; }
.module-diagram     { grid-column: span 2; grid-row: span 2; }
.module-quote       { grid-column: span 2; grid-row: span 1; }
.module-body        { grid-column: span 2; grid-row: span 2; }
.module-venn        { grid-column: span 2; grid-row: span 2; }
.module-list        { grid-column: span 2; grid-row: span 3; }
.module-swatches    { grid-column: span 2; grid-row: span 2; }
.module-flow        { grid-column: span 3; grid-row: span 2; }
.module-annotation  { grid-column: span 2; grid-row: span 2; }
.module-closing     { grid-column: span 3; grid-row: span 2; }

/* ----- Card base ----- */
.card {
    position: relative;
    background: var(--card-white);
    border-radius: 6px;
    padding: 22px 22px 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity 700ms cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 320ms ease;
    border-top: 1px solid rgba(58, 50, 38, 0.05);
}

.card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-white { background: var(--card-white); }
.card-warm  { background: var(--card-warm); }
.card-cool  { background: var(--card-cool); }

/* Card meta (Inconsolata corner label) */
.card-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--slate);
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    text-transform: lowercase;
}

/* ----- Card typography ----- */
.display-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--walnut);
    font-size: 56px;
    line-height: 1.02;
    margin: 0 0 12px;
    letter-spacing: 0.3px;
}

.display-title.small {
    font-size: 42px;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--walnut);
    font-size: 30px;
    line-height: 1.05;
    margin: 0 0 10px;
}

.card-body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.62;
    color: var(--walnut);
    margin: 0 0 10px;
}

.card-body:last-child { margin-bottom: 0; }

.display-quote {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--walnut);
    font-size: 36px;
    line-height: 1.1;
    margin: 8px 0 12px;
}

.card-cite {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate);
    margin: 0;
}

/* ----- Method list ----- */
.method-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
}

.method-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(196, 149, 106, 0.4);
    font-size: 15.5px;
    color: var(--walnut);
}

.method-list li:last-child { border-bottom: none; }

.method-list .num {
    font-family: var(--font-mono);
    color: var(--terracotta);
    font-size: 12px;
    font-weight: 500;
    min-width: 22px;
}

/* ----- Sketch SVG (diagrams) ----- */
.sketch-svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px;
    margin-top: 6px;
}

/* ----- Color swatches ----- */
.swatch-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.swatch {
    aspect-ratio: 1.2;
    border-radius: 3px;
    position: relative;
    border: 1px solid rgba(58, 50, 38, 0.08);
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 6px 8px;
}

.swatch span {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--slate);
}

.swatch span.dark {
    color: rgba(255, 248, 240, 0.92);
}

/* ----- Arrow down on closing card ----- */
.arrow-down {
    position: absolute;
    bottom: 18px;
    right: 22px;
    width: 28px;
    height: 28px;
    border-right: 2px solid var(--terracotta);
    border-bottom: 2px solid var(--terracotta);
    transform: rotate(45deg);
    opacity: 0.7;
}

/* ----- Sticky notes ----- */
.sticky-notes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.sticky {
    position: absolute;
    width: 96px;
    height: 96px;
    padding: 16px 12px 0;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--walnut);
    box-shadow: var(--shadow-sticky);
    line-height: 1.1;
    opacity: 0;
    transform: scale(0.85) rotate(0deg);
    transition: opacity 600ms ease, transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sticky.is-visible { opacity: 1; }

.sticky-yellow { background: var(--sticky-yellow); }
.sticky-peach  { background: var(--sticky-peach); }

/* ==========================================================================
   SECTION SENTINEL
   ========================================================================== */

.section-sentinel {
    width: 100%;
    height: 1px;
    pointer-events: none;
}

/* ==========================================================================
   PROCESS (single-column)
   ========================================================================== */

.process {
    max-width: 680px;
    margin: 0 auto;
    padding: 120px 28px 140px;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 700ms ease 100ms, transform 700ms ease 100ms;
}

.process.is-active {
    opacity: 1;
    transform: translateY(0);
}

.process-header {
    margin-bottom: 80px;
    text-align: left;
}

.kicker {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--terracotta);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    margin: 0 0 14px;
}

.process-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 78px;
    line-height: 1;
    color: var(--walnut);
    margin: 0 0 22px;
}

.process-lead {
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.6;
    color: var(--slate);
    margin: 0;
    max-width: 540px;
}

/* ----- Step ----- */
.step {
    position: relative;
    padding: 28px 0 36px 96px;
    margin-bottom: 26px;
    border-bottom: 1px dashed rgba(196, 149, 106, 0.4);
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity 700ms cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.step:last-of-type { border-bottom: none; }

.step-number {
    position: absolute;
    top: 14px;
    left: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 72px;
    line-height: 1;
    color: var(--terracotta);
    width: 78px;
    text-align: left;
    transform: rotate(-4deg);
}

.step-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 22px;
    line-height: 1.3;
    color: var(--walnut);
    margin: 0 0 14px;
}

.step-body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.72;
    color: var(--walnut);
    margin: 0;
}

/* ----- Process footer ----- */
.process-footer {
    margin-top: 80px;
    text-align: center;
}

.footer-mark {
    font-family: var(--font-display);
    font-size: 26px;
    color: var(--cork);
    margin: 0 0 8px;
    letter-spacing: 1px;
}

.footer-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--slate);
    margin: 0;
    letter-spacing: 0.04em;
}

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

@media (max-width: 880px) {
    .bento-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-auto-rows: 110px;
    }
    .module-title, .module-diagram, .module-quote, .module-body,
    .module-venn, .module-list, .module-swatches, .module-flow,
    .module-annotation, .module-closing {
        grid-column: span 2;
    }
    .display-title { font-size: 44px; }
    .display-title.small { font-size: 34px; }
    .display-quote { font-size: 30px; }
    .card-title { font-size: 26px; }
    .process-heading { font-size: 56px; }
    .step { padding-left: 80px; }
    .step-number { font-size: 60px; }
    .domain-label { font-size: 18px; top: 14px; left: 16px; padding: 2px 8px; }
    .studio-wall { padding: 70px 18px 80px; }
}

@media (max-width: 540px) {
    .bento-grid {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 100px;
    }
    .module-title, .module-diagram, .module-quote, .module-body,
    .module-venn, .module-list, .module-swatches, .module-flow,
    .module-annotation, .module-closing {
        grid-column: span 2;
    }
    .display-title { font-size: 38px; }
    .process-heading { font-size: 44px; }
    .step { padding-left: 0; padding-top: 60px; }
    .step-number {
        position: static;
        display: inline-block;
        margin-bottom: 4px;
        width: auto;
        font-size: 54px;
    }
    .sticky { display: none; }
}
