/* ==========================================================================
   logical.day  --  mid-century modern x scholarly
   Palette
     #1e3a2a  chalkboard (forest green)
     #f0ece0  chalk (warm white)
     #faf5eb  paper (warm cream)
     #2a2420  text (warm brown-black)
     #c45c3c  accent (terracotta)
     #8b6b4a  wood (warm wood)
     #4a8c5e  check (sage green)
     #d4a04a  hint (warm gold)
   Type
     Display: Fraunces  (Google Fonts)
     Body:    Source Sans 3  (Google Fonts)
     Logic:   Fira Code  (Google Fonts)
   ========================================================================== */

:root {
    --chalkboard: #1e3a2a;
    --chalk: #f0ece0;
    --paper: #faf5eb;
    --text: #2a2420;
    --accent: #c45c3c;
    --wood: #8b6b4a;
    --check: #4a8c5e;
    --hint: #d4a04a;

    --font-display: "Fraunces", "Times New Roman", Georgia, serif;
    --font-body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
    --font-logic: "Fira Code", "Menlo", "Consolas", monospace;

    --content-w: 640px;
    --hero-min: 60vh;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
}

p { margin: 0 0 1.1em; }

em {
    font-style: italic;
    color: var(--accent);
}

/* ==========================================================================
   THE BLACKBOARD (HERO)
   ========================================================================== */

.blackboard {
    position: relative;
    background: var(--chalkboard);
    color: var(--chalk);
    min-height: var(--hero-min);
    padding: 3rem 1.75rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
}

/* radial vignette to suggest a slate-with-light surface */
.blackboard::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(240, 236, 224, 0.08), transparent 55%),
        radial-gradient(ellipse at 70% 90%, rgba(0, 0, 0, 0.35), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* chalk-dust noise overlay using SVG turbulence */
.blackboard__noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.10;
    mix-blend-mode: screen;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.94 0 0 0 0 0.93 0 0 0 0 0.88 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 320px 320px;
}

/* a hint of a chalk-tray frame */
.blackboard__frame {
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(139, 107, 74, 0.55);
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
    box-shadow:
        inset 0 0 0 6px rgba(139, 107, 74, 0.10),
        inset 0 0 60px rgba(0, 0, 0, 0.18);
}

/* tiny corner brackets, like school slate hardware */
.blackboard__corner {
    position: absolute;
    width: 22px;
    height: 22px;
    z-index: 3;
    border: 2px solid var(--wood);
    opacity: 0.55;
}
.blackboard__corner--bl {
    left: 22px; bottom: 22px;
    border-right: none; border-top: none;
}
.blackboard__corner--br {
    right: 22px; bottom: 22px;
    border-left: none; border-top: none;
}

.blackboard__header {
    position: absolute;
    top: 1.5rem;
    left: 0; right: 0;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    z-index: 4;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--chalk);
    opacity: 0.62;
    letter-spacing: 0.04em;
}

.domain-mark {
    font-style: italic;
    text-shadow: 0 0 2px rgba(240, 236, 224, 0.3);
}
.date-mark {
    font-feature-settings: "ss01";
    text-shadow: 0 0 2px rgba(240, 236, 224, 0.3);
}

.blackboard__inner {
    position: relative;
    z-index: 5;
    max-width: 720px;
    text-align: center;
    padding: 2.25rem 0 1rem;
}

.eyebrow {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--chalk);
    opacity: 0.7;
    margin: 0 0 1.4rem;
    text-shadow: 0 0 2px rgba(240, 236, 224, 0.3);
}
.eyebrow__num {
    color: var(--hint);
    margin-left: 0.4em;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.puzzle-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-variation-settings: "opsz" 96, "SOFT" 80, "WONK" 1;
    font-size: clamp(1.65rem, 4vw, 3rem);
    line-height: 1.18;
    letter-spacing: -0.005em;
    color: var(--chalk);
    margin: 0 auto 1.5rem;
    max-width: 600px;
    text-shadow:
        0 0 2px rgba(240, 236, 224, 0.3),
        0 0 18px rgba(240, 236, 224, 0.05);
}

.puzzle-title .emphasis {
    position: relative;
    color: var(--hint);
    font-style: italic;
    white-space: nowrap;
}
.puzzle-title .emphasis::after {
    content: "";
    position: absolute;
    left: -2%; right: -2%;
    bottom: -0.18em;
    height: 6px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 6' preserveAspectRatio='none'><path d='M2 4 Q 12 0 22 4 T 42 4 T 62 4 T 82 4 T 102 4 T 122 4 T 142 4 T 162 4 T 182 4 T 198 4' fill='none' stroke='%23d4a04a' stroke-width='1.6' stroke-linecap='round'/></svg>");
    background-repeat: repeat-x;
    background-size: 100% 6px;
    opacity: 0.85;
}

.puzzle-prompt {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--chalk);
    opacity: 0.85;
    max-width: 540px;
    margin: 0 auto 1.6rem;
    text-shadow: 0 0 1px rgba(240, 236, 224, 0.25);
}
.puzzle-prompt em { color: var(--accent); font-style: italic; }

.chalk-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.2rem;
    justify-content: center;
    margin: 0 auto 1.8rem;
    max-width: 520px;
}

.logic-sym {
    font-family: var(--font-logic);
    font-size: 1.05rem;
    color: var(--chalk);
    opacity: 0.78;
    padding: 0.15em 0.55em;
    border: 1px dashed rgba(240, 236, 224, 0.22);
    border-radius: 3px;
    text-shadow: 0 0 2px rgba(240, 236, 224, 0.3);
    letter-spacing: 0.02em;
}

.chalk-button {
    display: inline-block;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1rem;
    color: var(--chalk);
    background: transparent;
    border: 1px solid rgba(240, 236, 224, 0.55);
    padding: 0.7em 1.4em;
    border-radius: 2px;
    cursor: pointer;
    letter-spacing: 0.02em;
    text-shadow: 0 0 2px rgba(240, 236, 224, 0.35);
    transition: background-color 220ms ease, color 220ms ease, transform 220ms ease, border-color 220ms ease;
}
.chalk-button:hover {
    background: var(--hint);
    color: var(--chalkboard);
    border-color: var(--hint);
    transform: translateY(-1px);
    text-shadow: none;
}
.chalk-button:active { transform: translateY(0); }

/* ==========================================================================
   PENCIL DIVIDER
   ========================================================================== */

.pencil-divider {
    background: var(--paper);
    padding: 1.6rem 2rem 0.4rem;
    display: flex;
    justify-content: center;
}
.pencil-divider--bottom { padding-top: 1rem; padding-bottom: 1.2rem; }

.pencil-divider__svg {
    width: min(560px, 90%);
    height: 16px;
    display: block;
}

/* ==========================================================================
   CALENDAR STRIP
   ========================================================================== */

.calendar {
    background: var(--paper);
    padding: 1.5rem 1rem 1.6rem;
    text-align: center;
}

.calendar__caption {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--wood);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 0.85rem;
}

.calendar__strip {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.day {
    width: 40px;
    height: 40px;
    border: 2px solid var(--wood);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: transparent;
    color: var(--wood);
    font-family: var(--font-body);
    font-size: 0.6rem;
    line-height: 1;
    transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
    cursor: default;
}

.day__label {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
    opacity: 0.85;
}
.day__icon {
    font-size: 0.95rem;
    line-height: 1;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.day__icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.day--done {
    background: var(--check);
    border-color: var(--check);
    color: var(--paper);
}
.day--done .day__label { opacity: 0.95; color: var(--paper); }

.day--current {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(196, 92, 60, 0.30);
    color: var(--accent);
    background: var(--paper);
}
.day--current .day__label { color: var(--accent); }
.day--current .day__icon {
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    color: transparent;
    margin-top: 4px;
}

.day--future .day__icon { color: var(--wood); font-style: italic; }

.day:hover {
    transform: translateY(-2px);
}
.day--done:hover { box-shadow: 0 4px 0 -2px rgba(74, 140, 94, 0.4); }
.day--future:hover { box-shadow: 0 4px 0 -2px rgba(139, 107, 74, 0.3); }

.calendar__streak {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--wood);
    margin: 1rem 0 0;
    letter-spacing: 0.04em;
}
.streak-num {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent);
    margin-right: 0.15em;
}

/* ==========================================================================
   PAPER (MAIN CONTENT)
   ========================================================================== */

.paper {
    background: var(--paper);
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 2.5rem 1.75rem 2rem;
    color: var(--text);
}

.paper__section { margin-bottom: 2.4rem; }
.paper__section:last-child { margin-bottom: 0.6rem; }

.section-tag {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 0.82rem;
    color: var(--wood);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin: 0 0 0.4rem;
}

.paper__heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-variation-settings: "opsz" 48, "SOFT" 60, "WONK" 1;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 1.2rem;
    position: relative;
    display: inline-block;
}

.heading-underline {
    display: block;
    width: 100%;
    height: 6px;
    margin-top: 4px;
    opacity: 0.85;
}

.paper__lede {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
    margin: 0 0 1.4rem;
}

.paper__body {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text);
}

.paper__rule {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(139, 107, 74, 0.45), transparent);
    margin: 2rem auto;
    max-width: 80%;
}

/* clue list */
.clue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid rgba(139, 107, 74, 0.25);
}

.clue {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding: 0.85rem 0.2rem;
    border-bottom: 1px solid rgba(139, 107, 74, 0.18);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    transition: background-color 220ms ease, padding 220ms ease;
}
.clue:hover {
    background: rgba(212, 160, 74, 0.10);
    padding-left: 0.6rem;
}
.clue--marked {
    background: rgba(212, 160, 74, 0.18);
    padding-left: 0.6rem;
}
.clue__num {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    color: var(--accent);
    min-width: 1.4em;
    text-align: right;
    font-size: 1rem;
}
.clue__text { flex: 1; }
.clue__text em {
    font-style: italic;
    color: var(--accent);
    background: linear-gradient(to top, rgba(212, 160, 74, 0.25) 0 0.4em, transparent 0.4em 100%);
    padding: 0 0.1em;
}

/* hints */
.hint {
    background: var(--paper);
    border-left: 3px solid var(--hint);
    padding: 0.65rem 1rem 0.65rem 1.05rem;
    margin: 0 0 0.7rem;
    border-radius: 0 4px 4px 0;
    transition: background-color 220ms ease, border-color 220ms ease;
}
.hint[open] {
    background: rgba(212, 160, 74, 0.10);
    border-left-color: var(--accent);
}
.hint summary {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    color: var(--hint);
    cursor: pointer;
    list-style: none;
    font-size: 1.02rem;
    letter-spacing: 0.01em;
}
.hint[open] summary { color: var(--accent); }
.hint summary::-webkit-details-marker { display: none; }
.hint summary::marker { content: ""; }
.hint__bullet {
    display: inline-block;
    margin-right: 0.5em;
    font-size: 0.85em;
    transform: translateY(-1px);
}
.hint p {
    margin: 0.6rem 0 0;
    font-size: 0.98rem;
    color: var(--text);
}
.hint p em { color: var(--accent); }

/* steps */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: stepnum;
}
.step {
    display: flex;
    gap: 1.1rem;
    padding: 0.8rem 0;
    border-bottom: 1px dashed rgba(139, 107, 74, 0.30);
}
.step:last-child { border-bottom: none; }
.step__num {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    color: var(--wood);
    min-width: 1.6em;
    font-size: 1.05rem;
    line-height: 1.7;
}
.step p {
    margin: 0;
    font-size: 0.99rem;
    line-height: 1.7;
    color: var(--text);
    flex: 1;
}
.step--answer p {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    color: var(--text);
    font-size: 1.05rem;
}
.step--answer .step__num { color: var(--accent); }
.qed {
    display: inline-block;
    margin-left: 0.3em;
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}
.logic-inline {
    font-family: var(--font-logic);
    color: var(--accent);
    padding: 0 0.15em;
}

/* meta section */
.paper__section--meta { padding-top: 0.4rem; }
.signoff {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--wood);
    margin-top: 1.4rem;
    font-size: 1rem;
}
.signoff em { color: var(--accent); font-style: italic; }

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

.schoolfoot {
    background: var(--paper);
    padding: 0.6rem 1rem 2.4rem;
    text-align: center;
    color: var(--wood);
    font-family: var(--font-body);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}
.schoolfoot__line { margin: 0.2rem 0; }
.schoolfoot__line--small { font-size: 0.75rem; opacity: 0.75; font-style: italic; font-family: var(--font-display); }
.schoolfoot__brand {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    color: var(--accent);
}

/* ==========================================================================
   ENTRY ANIMATIONS  --  subtle "chalk fade in"
   ========================================================================== */

@keyframes chalkFadeIn {
    from { opacity: 0; transform: translateY(8px); filter: blur(2px); }
    to   { opacity: 1; transform: translateY(0);   filter: blur(0);   }
}
@keyframes paperRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.eyebrow,
.puzzle-title,
.puzzle-prompt,
.chalk-row,
.chalk-button {
    opacity: 0;
    animation: chalkFadeIn 900ms ease-out forwards;
}
.eyebrow      { animation-delay: 100ms; }
.puzzle-title { animation-delay: 260ms; }
.puzzle-prompt{ animation-delay: 520ms; }
.chalk-row    { animation-delay: 720ms; }
.chalk-button { animation-delay: 900ms; }

.calendar,
.paper__section,
.schoolfoot {
    opacity: 0;
    animation: paperRise 700ms ease-out forwards;
    animation-delay: 200ms;
}
.paper__section:nth-of-type(2) { animation-delay: 300ms; }
.paper__section:nth-of-type(3) { animation-delay: 400ms; }
.paper__section:nth-of-type(4) { animation-delay: 500ms; }

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

@media (max-width: 640px) {
    .blackboard { padding: 4.2rem 1.25rem 3.5rem; }
    .blackboard__header {
        position: static;
        padding: 0 0 1rem;
        flex-direction: row;
        justify-content: space-between;
    }
    .blackboard__corner { display: none; }
    .blackboard__frame { inset: 8px; }

    .puzzle-title { font-size: clamp(1.4rem, 6vw, 2.1rem); }

    .paper { padding: 1.8rem 1.2rem 1.4rem; }

    .calendar__strip { gap: 0.4rem; }
    .day { width: 38px; height: 38px; }

    .clue { gap: 0.6rem; padding: 0.7rem 0.1rem; }
    .step { gap: 0.7rem; }
}

@media (max-width: 380px) {
    .calendar__strip { gap: 0.3rem; }
    .day { width: 34px; height: 34px; }
    .day__label { font-size: 0.5rem; }
    .day__icon svg { width: 14px; height: 14px; }
}
