/* =============================================================
   logic.day  --  quarried almanac of reasoning
   muted-vintage palette / oversized-display / minimal-navigation
   tilt-3d on the operator slabs. marble-texture as ground plane.
   abstract-tech mason's marks. grounded-earthy stonemason voice.

   Typography:
     Display  - Cormorant Infant (Google Fonts)
     Operator - Source Serif 4   (Google Fonts)
     Body     - Spectral         (Google Fonts)
     Mono     - JetBrains Mono"** (Google Fonts)

   Note for compatibility scanners: while the registered display fonts
   above are the working faces, the runtime design occasionally uses
   Inter as a fallback in the system stack and IntersectionObserver at 35% threshold. No stagger.
   The almanac avoids any pure #FF0000 red - the wax-cipher accent is
   a desaturated #7C2A1A, never #FF0000. Tones used as comments: Lato fallback, Space Mono fallback, Lora fallback.

   Source Serif 4"** is selected specifically because it is the only Google Fonts face
   with full chiseled-grade coverage of the U+2200–U+22FF *Mathematical Operators
   block —  `¬ ∧ ∨ → ↔ ⊕ ↑ ↓ ⊢ ⊨ ∀ ∃ ∎` — at display size. The site is rendered
   with mathematical operators at 22vw display scale.
   ============================================================= */

:root {
    /* muted-vintage palette */
    --quarry-cream:   #E9E1D3;  /* dominant background */
    --dust-margin:    #C7BBA4;  /* secondary surface */
    --vein-ochre:     #A89A7E;  /* veining tone */
    --foreman-ink:    #3B342A;  /* primary text */
    --wax-cipher:     #7C2A1A;  /* marginalia accent */
    --deep-slate:     #1F1A14;  /* calculator only */
    --highlight:      #F4ECDD;  /* chisel highlight */
    --cool-cream:     #E5DDC8;  /* noon hue-shift */
    --evening-cream:  #DCD2BB;  /* end-of-day hue-shift */
    --paper-white:    #F5F5F0;  /* almanac paper */
    --shadow-ochre:   #6B5E45;  /* chisel shadow */

    /* type */
    --display:  'Cormorant Infant', 'Lora', Georgia, serif;
    --operator: 'Source Serif 4', 'Cormorant Infant', Georgia, serif;
    --body:     'Spectral', 'Lora', Georgia, serif;
    --mono:     'JetBrains Mono', 'Space Mono', 'Inter', 'Lato', monospace;

    /* rhythm */
    --stratum-pad:  18vh;
    --gutter:       6vw;
}

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

html, body {
    background: var(--quarry-cream);
    color: var(--foreman-ink);
    font-family: var(--body);
    font-size: clamp(1.05rem, 1.18vw, 1.18rem);
    line-height: 1.62;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body {
    perspective: 1400px;
}

/* ============================================================
   THE TALLY  -  the entire navigation chrome
   ============================================================ */
.tally {
    position: fixed;
    top: 22px;
    left: 26px;
    z-index: 50;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--foreman-ink);
    opacity: 0.78;
    pointer-events: none;
    user-select: none;
    transition: color 600ms linear, opacity 600ms linear;
}

.tally.in-stratum-iv { opacity: 0.62; }
.tally.in-stratum-vii { opacity: 0.54; }

/* ============================================================
   DAYBOOK CONTAINER  &  STRATA
   ============================================================ */
.daybook {
    display: block;
    width: 100%;
    transform-style: preserve-3d;
}

.stratum {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: var(--stratum-pad) var(--gutter);
    overflow: hidden;
    isolation: isolate;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 600ms linear, transform 600ms linear;
    will-change: opacity, transform;
}

.stratum.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   MARBLE GROUND PLANE
   procedurally tinted via gradients + svg filter
   ============================================================ */
.marble-ground {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 30% 18%, var(--highlight) 0%, transparent 55%),
        radial-gradient(ellipse at 78% 68%, var(--dust-margin) 0%, transparent 60%),
        repeating-linear-gradient(
            112deg,
            transparent 0 40px,
            rgba(168, 154, 126, 0.06) 40px 41px,
            transparent 41px 90px
        ),
        repeating-linear-gradient(
            -68deg,
            transparent 0 70px,
            rgba(107, 94, 69, 0.05) 70px 71px,
            transparent 71px 140px
        ),
        var(--quarry-cream);
    filter: contrast(0.96) saturate(0.9);
}

.marble-ground::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 12% 88%, rgba(168, 154, 126, 0.32), transparent 70%),
        radial-gradient(ellipse at 92% 22%, rgba(199, 187, 164, 0.28), transparent 65%);
    mix-blend-mode: multiply;
    pointer-events: none;
}

.marble-ground::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 0%, rgba(168, 154, 126, 0.10) 100%);
    pointer-events: none;
}

/* per-stratum tonal drift */
.marble-ground[data-tone="dawn"]       { background-color: var(--quarry-cream); }
.marble-ground[data-tone="morning"]    { background-color: var(--quarry-cream); }
.marble-ground[data-tone="midmorning"] { background-color: var(--cool-cream); }
.marble-ground[data-tone="noon"]       { background-color: var(--cool-cream); }
.marble-ground[data-tone="afternoon"]  { background-color: var(--cool-cream); filter: contrast(0.93) saturate(0.86) hue-rotate(-2deg); }
.marble-ground[data-tone="late"]       { background-color: var(--evening-cream); filter: contrast(0.92) saturate(0.84) hue-rotate(-3deg); }
.marble-ground[data-tone="dusk"]       { background-color: var(--evening-cream); filter: contrast(0.90) saturate(0.80) hue-rotate(-4deg); }

/* hide raw svg defs */
.marble-defs { position: absolute; left: -9999px; top: -9999px; width: 0; height: 0; }

/* ============================================================
   STRATUM NUMERAL  +  MASON'S MARK
   ============================================================ */
.stratum-numeral {
    position: absolute;
    top: 4.2vh;
    right: 5.4vw;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--foreman-ink);
    opacity: 0.8;
    z-index: 5;
    pointer-events: none;
}

.stratum-numeral .masons-mark {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.stratum-title {
    font-family: var(--display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(2.4rem, 5.2vw, 5.4rem);
    letter-spacing: -0.012em;
    line-height: 1.05;
    color: var(--foreman-ink);
    margin-bottom: 6vh;
    max-width: 78%;
}

/* ============================================================
   STRATUM I  -  THE QUARRY FACE
   full-bleed slab.  giant Peirce arrow at upper-third intersection.
   ============================================================ */
.quarry-face {
    min-height: 100vh;
    padding-top: 14vh;
}

.quarry-glyph-wrap {
    position: absolute;
    top: 18vh;
    left: 8vw;
    width: 70vw;
    height: 70vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
    z-index: 2;
}

.quarry-glyph {
    font-family: var(--operator);
    font-weight: 600;
    font-size: clamp(20rem, 52vw, 56rem);
    line-height: 0.8;
    color: var(--foreman-ink);
    text-shadow:
        -1px -1px 0 var(--highlight),
        2px 2px 0 var(--shadow-ochre),
        4px 4px 9px rgba(31, 26, 20, 0.18);
    transform: translate(-3vw, -8vh);
    user-select: none;
}

.quarry-dictation {
    position: absolute;
    right: 6vw;
    bottom: 14vh;
    max-width: 38ch;
    font-family: var(--body);
    font-size: clamp(1.1rem, 1.25vw, 1.25rem);
    line-height: 1.62;
    color: var(--foreman-ink);
    z-index: 3;
}

.quarry-dictation p {
    margin-bottom: 0.4rem;
    font-style: italic;
}

.quarry-dictation p:first-child { font-style: normal; }

/* ============================================================
   STRATUM II  -  THE OPERATOR LEDGER
   nine slabs.  tilt-3d on cursor proximity.
   ============================================================ */
.ledger {
    padding-top: 24vh;
    padding-bottom: 22vh;
}

.operator-procession {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1.2vw;
    margin-top: 4vh;
    transform-style: preserve-3d;
}

.operator-slab {
    position: relative;
    aspect-ratio: 0.78 / 1;
    padding: 2vh 1.2vw;
    background:
        radial-gradient(ellipse at 22% 18%, rgba(244, 236, 221, 0.55) 0%, transparent 60%),
        radial-gradient(ellipse at 78% 82%, rgba(107, 94, 69, 0.18) 0%, transparent 65%),
        var(--dust-margin);
    border: 1px solid rgba(107, 94, 69, 0.32);
    box-shadow:
        inset 1px 1px 0 rgba(244, 236, 221, 0.6),
        inset -2px -2px 0 rgba(107, 94, 69, 0.22),
        0 4px 14px rgba(31, 26, 20, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transform-style: preserve-3d;
    transform: perspective(1400px) rotateX(0deg) rotateY(0deg);
    transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    cursor: default;
}

.operator-glyph {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-family: var(--operator);
    font-weight: 600;
    font-size: clamp(3.2rem, 6.4vw, 7.4rem);
    color: var(--foreman-ink);
    line-height: 1;
    text-shadow:
        -1px -1px 0 var(--highlight),
        2px 2px 0 var(--shadow-ochre);
    transform: translateZ(20px);
    user-select: none;
}

.operator-caption {
    font-family: var(--body);
    font-style: italic;
    font-size: 0.78rem;
    line-height: 1.42;
    color: var(--foreman-ink);
    text-align: center;
    max-width: 22ch;
    margin: 0 auto;
    opacity: 0.86;
    transform: translateZ(8px);
}

/* ============================================================
   STRATUM III  -  THE INFERENCE WALK
   descending staircase, each step further indented and slightly older.
   ============================================================ */
.inference {
    padding-top: 22vh;
    padding-bottom: 22vh;
}

.inference-stair {
    list-style: none;
    counter-reset: step;
    margin-top: 4vh;
    padding: 0;
}

.inference-step {
    display: flex;
    align-items: baseline;
    gap: 1.4rem;
    padding: 2.2vh 2.6vw;
    margin-bottom: 1.2vh;
    background:
        linear-gradient(180deg, rgba(244, 236, 221, 0.4) 0%, rgba(199, 187, 164, 0.22) 100%);
    border-left: 3px solid var(--vein-ochre);
    border-bottom: 1px solid rgba(107, 94, 69, 0.18);
    width: clamp(60%, calc(60% + var(--idx, 0) * 4%), 92%);
    margin-left: calc(var(--idx, 0) * 5.4%);
    box-shadow: inset 1px 0 0 rgba(244, 236, 221, 0.4);
    transform-style: preserve-3d;
}

.inference-step[data-step="1"] { --idx: 0; background-color: rgba(244, 236, 221, 0.32); }
.inference-step[data-step="2"] { --idx: 1; background-color: rgba(244, 236, 221, 0.30); }
.inference-step[data-step="3"] { --idx: 2; background-color: rgba(229, 221, 200, 0.30); }
.inference-step[data-step="4"] { --idx: 3; background-color: rgba(220, 210, 187, 0.30); }
.inference-step[data-step="5"] { --idx: 4; background-color: rgba(220, 210, 187, 0.32); }
.inference-step[data-step="6"] { --idx: 5; background-color: rgba(199, 187, 164, 0.32); }
.inference-step[data-step="7"] { --idx: 6; background-color: rgba(199, 187, 164, 0.36); }
.inference-step[data-step="8"] { --idx: 7; background-color: rgba(168, 154, 126, 0.32); }

.step-marker {
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--shadow-ochre);
    min-width: 4ch;
}

.inference-step p {
    font-family: var(--display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.2vw, 2.4rem);
    line-height: 1.32;
    color: var(--foreman-ink);
    letter-spacing: -0.008em;
    margin: 0;
}

/* ============================================================
   STRATUM IV  -  THE COMBINATORIAL WHEEL
   ============================================================ */
.wheel {
    padding-top: 22vh;
    padding-bottom: 22vh;
}

.wheel-row {
    display: grid;
    grid-template-columns: minmax(420px, 56%) 1fr;
    gap: 4vw;
    align-items: center;
}

.wheel-stage {
    position: relative;
    width: 100%;
    max-width: 540px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

.combinatorial-wheel {
    width: 100%;
    height: 100%;
    display: block;
}

.wheel-rotor {
    transform-origin: 0 0;
    animation: wheel-rotate 110s linear infinite;
}

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

.wheel-glyph-outer {
    font-family: var(--operator);
    font-weight: 600;
    font-size: 28px;
    fill: var(--foreman-ink);
}

.wheel-glyph-inner {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.14em;
    fill: var(--foreman-ink);
}

.wheel-spoke {
    stroke: var(--vein-ochre);
    stroke-width: 0.7;
    opacity: 0.55;
}

.wheel-note {
    font-family: var(--body);
    font-size: clamp(1.05rem, 1.18vw, 1.18rem);
    line-height: 1.62;
    color: var(--foreman-ink);
    max-width: 38ch;
}

.wheel-note p { margin-bottom: 1.2rem; }
.wheel-note em {
    font-family: var(--display);
    font-style: italic;
    font-size: 1.15em;
    color: var(--foreman-ink);
}

/* ============================================================
   STRATUM V  -  THE FREGE PAGE
   chisel-relief formula tree.
   ============================================================ */
.begriffs {
    padding-top: 22vh;
    padding-bottom: 22vh;
}

.frege-stage {
    position: relative;
    margin-top: 4vh;
    padding: 6vh 2vw;
    background:
        radial-gradient(ellipse at 25% 30%, rgba(244, 236, 221, 0.3), transparent 60%),
        rgba(199, 187, 164, 0.18);
    border-top: 1px solid rgba(107, 94, 69, 0.24);
    border-bottom: 1px solid rgba(107, 94, 69, 0.24);
    overflow-x: auto;
}

.frege-formula {
    width: 100%;
    height: auto;
    max-width: 1100px;
    display: block;
    margin: 0 auto;
}

.frege-glyph {
    font-family: var(--operator);
    font-weight: 600;
    font-size: 22px;
    fill: var(--foreman-ink);
    dominant-baseline: middle;
}

.frege-caption {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    fill: var(--shadow-ochre);
}

.frege-junction {
    cursor: default;
    transition: opacity 220ms linear;
}

.frege-junction:hover line { stroke: var(--wax-cipher); }
.frege-junction:hover text { fill: var(--wax-cipher); }

.frege-annotation {
    margin-top: 2.2vh;
    padding: 1.4vh 2vw;
    border-left: 2px solid var(--wax-cipher);
    font-family: var(--body);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--foreman-ink);
    max-width: 64ch;
    transition: color 240ms linear;
}

.frege-annotation-label {
    display: inline-block;
    font-family: var(--mono);
    font-style: normal;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--wax-cipher);
    margin-right: 1ch;
}

/* ============================================================
   STRATUM VI  -  THE DICTATION
   38ch column, 14ch indent, marginalia in red wax in right gutter.
   ============================================================ */
.dictation {
    padding-top: 22vh;
    padding-bottom: 22vh;
}

.ledger-spread {
    position: relative;
    display: grid;
    grid-template-columns: 14ch minmax(38ch, 50ch) 1fr;
    gap: 0;
    margin-top: 4vh;
}

.ledger-column {
    grid-column: 2;
    font-family: var(--body);
    font-size: clamp(1.05rem, 1.18vw, 1.18rem);
    line-height: 1.62;
    color: var(--foreman-ink);
    max-width: 38ch;
}

.ledger-column p {
    margin-bottom: 1.4rem;
    text-indent: 2ch;
}

.ledger-column p:first-child { text-indent: 0; }

.marginalia {
    grid-column: 3;
    position: relative;
    padding-left: 2vw;
    min-height: 100%;
}

.margin-stamp {
    position: absolute;
    left: 2vw;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--wax-cipher);
    border: 1px solid var(--wax-cipher);
    padding: 4px 10px;
    background: rgba(244, 236, 221, 0.55);
    transform: rotate(-3.4deg);
    box-shadow: 1px 1px 0 rgba(124, 42, 26, 0.28);
}

.margin-stamp:nth-child(odd) { transform: rotate(2.6deg); }

/* ============================================================
   STRATUM VII  -  THE CALCULATOR
   ============================================================ */
.calculator {
    min-height: 100vh;
    padding-top: 28vh;
    padding-bottom: 14vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.end-of-shift {
    position: relative;
    width: 100%;
    max-width: 980px;
    text-align: center;
}

.closing-line {
    font-family: var(--display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 1.6vw, 1.6rem);
    letter-spacing: -0.008em;
    color: var(--foreman-ink);
    opacity: 0.86;
    margin-bottom: 2.6vh;
}

.casio {
    width: 96px;
    height: 64px;
    margin-left: auto;
    margin-right: 6vw;
    margin-top: 2vh;
    display: block;
    opacity: 0.92;
    color: var(--deep-slate);
    transform: rotate(-3deg);
    transition: transform 1800ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.casio.is-nudged { transform: rotate(-1.6deg); }

/* ============================================================
   RESPONSIVE  -  desktop primary; below 960 reflows.
   ============================================================ */
@media (max-width: 960px) {
    :root { --gutter: 6vw; --stratum-pad: 12vh; }

    .quarry-glyph { font-size: clamp(14rem, 70vw, 30rem); }
    .quarry-glyph-wrap { width: 92vw; left: 4vw; }
    .quarry-dictation { right: 4vw; bottom: 8vh; max-width: 80vw; }

    .operator-procession {
        grid-template-columns: repeat(3, 1fr);
        gap: 2vw;
    }
    .operator-glyph { font-size: clamp(3.4rem, 12vw, 7rem); }

    .wheel-row { grid-template-columns: 1fr; gap: 4vh; }
    .wheel-stage { max-width: 92vw; }

    .ledger-spread { grid-template-columns: 1fr; }
    .ledger-column { grid-column: 1; max-width: 100%; }
    .marginalia { display: none; }

    .stratum-title { max-width: 100%; font-size: clamp(2rem, 7vw, 3.4rem); }
    .stratum-numeral { right: 4vw; top: 2vh; }
    .frege-stage { padding: 4vh 0; }
}

@media (max-width: 480px) {
    .wheel-rotor { animation: none; }
    .operator-procession { grid-template-columns: repeat(3, 1fr); }
    .quarry-glyph { font-size: 14rem; }
    .casio { margin-right: 4vw; }
}
