/* ==========================================================================
   The Blackboard – public page
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --wall: #2b2420;
    --wood-1: #8a5a32;
    --wood-2: #5e3a1c;
    --board: #24382f;
    --board-2: #1c2d25;
    --chalk: #f2f0e6;
    --chalk-dim: rgba(242, 240, 230, .72);
    --ink: #2a2622;
    --ink-soft: #5d554c;
    --accent: #c8432f;
    --font-chalk: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Chalkduster", "Marker Felt", "Comic Neue", cursive;
    --font-hand: "Segoe Print", "Bradley Hand", "Noteworthy", "Marker Felt", cursive;
    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { height: 100%; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-ui);
    color: var(--ink);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 220, 170, .10), transparent 60%),
        repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 120px),
        var(--wall);
    padding: clamp(10px, 3vw, 40px);
}

/* ---- Frame & board ----------------------------------------------------- */
.frame {
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(12px, 2vw, 22px);
    border-radius: 10px;
    background:
        repeating-linear-gradient(100deg, rgba(255,255,255,.05) 0 3px, transparent 3px 11px),
        repeating-linear-gradient(80deg, rgba(0,0,0,.08) 0 1px, transparent 1px 17px),
        linear-gradient(180deg, var(--wood-1), var(--wood-2));
    box-shadow:
        0 30px 60px rgba(0,0,0,.55),
        inset 0 2px 0 rgba(255,255,255,.18),
        inset 0 -3px 0 rgba(0,0,0,.35);
}

.board {
    position: relative;
    min-height: 70vh;
    padding: clamp(20px, 4vw, 56px) clamp(14px, 4vw, 56px) 70px;
    border-radius: 4px;
    background:
        radial-gradient(ellipse at 20% 15%, rgba(255,255,255,.06), transparent 45%),
        radial-gradient(ellipse at 80% 70%, rgba(255,255,255,.045), transparent 50%),
        radial-gradient(ellipse at 55% 40%, rgba(255,255,255,.03), transparent 35%),
        linear-gradient(160deg, var(--board), var(--board-2));
    box-shadow: inset 0 0 80px rgba(0,0,0,.55), inset 0 0 0 2px rgba(0,0,0,.35);
    overflow: hidden;
}
/* faint eraser smudges */
.board::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 260px 60px at 15% 85%, rgba(255,255,255,.05), transparent 70%),
        radial-gradient(ellipse 320px 70px at 70% 20%, rgba(255,255,255,.04), transparent 70%),
        radial-gradient(ellipse 200px 50px at 85% 90%, rgba(255,255,255,.035), transparent 70%);
}

.board-header { position: relative; text-align: center; margin-bottom: clamp(24px, 4vw, 48px); }
.chalk-title {
    margin: 0;
    font-family: var(--font-chalk);
    font-weight: 400;
    font-size: clamp(2.2rem, 6vw, 4.2rem);
    letter-spacing: .02em;
    color: var(--chalk);
    text-shadow: 0 0 1px rgba(255,255,255,.9), 0 0 6px rgba(255,255,255,.18), 1px 1px 0 rgba(255,255,255,.12);
    opacity: .94;
}
.chalk-sub {
    margin: .4em 0 0;
    font-family: var(--font-chalk);
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    color: var(--chalk-dim);
}
.chalk-title::after {
    content: "";
    display: block;
    width: min(340px, 60%);
    height: 3px;
    margin: .25em auto 0;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, rgba(242,240,230,.55) 15%, rgba(242,240,230,.35) 60%, transparent);
    transform: rotate(-1deg);
}

.chalk-empty {
    position: relative;
    text-align: center;
    font-family: var(--font-chalk);
    font-size: 1.4rem;
    color: var(--chalk-dim);
    margin: 10vh 0;
}
.chalk-flash {
    position: relative;
    max-width: 640px;
    margin: 0 auto 24px;
    padding: 10px 16px;
    border: 2px dashed rgba(242,240,230,.5);
    border-radius: 8px;
    color: var(--chalk);
    font-family: var(--font-chalk);
    text-align: center;
}
.chalk-flash-error { border-color: rgba(255,140,120,.7); color: #ffd1c7; }

/* ---- Notes ---------------------------------------------------------------- */
.notes {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: clamp(26px, 3.5vw, 48px) clamp(20px, 3vw, 40px);
    align-items: start;
}
.note-wrap { transform: rotate(var(--tilt, 0deg)); }

.note {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    min-height: 200px;
    padding: 30px 20px 18px;
    border: 0;
    border-radius: 2px;
    text-align: left;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
    background: var(--paper, #fbf6e9);
    background-image:
        linear-gradient(180deg, rgba(255,255,255,.35), transparent 30%),
        radial-gradient(ellipse at 100% 100%, rgba(0,0,0,.07), transparent 40%);
    box-shadow:
        0 1px 1px rgba(0,0,0,.15),
        0 10px 18px -6px rgba(0,0,0,.55),
        0 22px 30px -18px rgba(0,0,0,.5);
    transition: transform .25s cubic-bezier(.2,.8,.3,1.2), box-shadow .25s;
    transform-origin: 50% 8px;
}
/* curled corner */
.note::after {
    content: "";
    position: absolute;
    right: 0; bottom: 0;
    width: 26px; height: 26px;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,.12) 50%, rgba(255,255,255,.4) 75%);
    border-top-left-radius: 4px;
}
.note:hover, .note:focus-visible {
    transform: rotate(calc(var(--tilt, 0deg) * -1)) translateY(-4px) scale(1.03);
    box-shadow: 0 2px 2px rgba(0,0,0,.15), 0 22px 30px -8px rgba(0,0,0,.6);
    outline: none;
}
.note:focus-visible { box-shadow: 0 0 0 3px #ffd75e, 0 22px 30px -8px rgba(0,0,0,.6); }

.paper-cream  { --paper: #fbf6e9; }
.paper-yellow { --paper: #fff1a8; }
.paper-pink   { --paper: #ffd6dc; }
.paper-blue   { --paper: #d5e9ff; }
.paper-green  { --paper: #d7f2cf; }
.paper-orange { --paper: #ffdcb8; }

.pin {
    position: absolute;
    top: -9px; left: 50%;
    width: 22px; height: 22px;
    margin-left: -11px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--pin) 25%, color-mix(in srgb, var(--pin), #000 45%) 100%);
    box-shadow: 2px 5px 6px rgba(0,0,0,.45);
    z-index: 2;
}
.pin::after {
    content: "";
    position: absolute;
    left: 50%; top: 18px;
    width: 2px; height: 6px;
    background: rgba(0,0,0,.25);
    transform: translateX(-50%);
    filter: blur(1px);
}
.pin-red    { --pin: #d9412f; }
.pin-blue   { --pin: #2f6fd9; }
.pin-yellow { --pin: #e6b422; }
.pin-green  { --pin: #2e9d55; }

.note-img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 6px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    background: #eee;
}
.note-title {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.note-teaser { color: var(--ink-soft); line-height: 1.45; font-size: .95rem; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.tag {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 7px;
    border-radius: 3px;
    background: rgba(0,0,0,.07);
    color: var(--ink-soft);
}
.deadline { font-size: .78rem; color: var(--ink-soft); }
.stamp {
    display: inline-block;
    padding: 3px 10px;
    border: 3px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    transform: rotate(-6deg);
    opacity: .85;
}
.note.is-closed .note-title, .note.is-closed .note-teaser, .note.is-closed .note-img { opacity: .55; }

/* chalk tray */
.chalk-tray {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 22px;
    background: linear-gradient(180deg, #6b4425, #4a2d16);
    box-shadow: 0 -3px 8px rgba(0,0,0,.4);
}
.chalk { position: absolute; bottom: 12px; left: 12%; width: 58px; height: 10px; border-radius: 4px; background: #f6f3ea; box-shadow: 0 2px 2px rgba(0,0,0,.3); }
.chalk-2 { left: calc(12% + 74px); width: 38px; background: #f6d7df; transform: rotate(4deg); }
.eraser {
    position: absolute;
    bottom: 12px; right: 14%;
    width: 110px; height: 26px;
    border-radius: 4px;
    background: linear-gradient(180deg, #c9a36b 0 55%, #3d3a38 55%);
    box-shadow: 0 3px 4px rgba(0,0,0,.4);
}

/* footer */
.site-footer { display: flex; justify-content: center; gap: 22px; padding: 22px 0 6px; font-size: .85rem; }
.site-footer a { color: rgba(255,255,255,.55); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ---- Dialog -------------------------------------------------------------- */
.sheet {
    width: min(620px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 3px;
    color: var(--ink);
    background: #fdfaf2;
    background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(80,120,200,.12) 31px 32px);
    box-shadow: 0 30px 80px rgba(0,0,0,.6);
    overflow: auto;
}
.sheet::backdrop { background: rgba(10, 16, 13, .72); backdrop-filter: blur(3px); }
.sheet[open] { animation: sheet-in .28s cubic-bezier(.2,.8,.3,1.15); }
@keyframes sheet-in { from { transform: translateY(18px) rotate(-1.5deg) scale(.97); opacity: 0; } }

.sheet-body { padding: 34px clamp(20px, 5vw, 44px) 32px; }
.sheet-close {
    position: sticky;
    top: 8px;
    float: right;
    margin: 8px 8px 0 0;
    width: 38px; height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.06);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink);
    z-index: 3;
}
.sheet-close:hover { background: rgba(0,0,0,.12); }
.sheet-img { display: block; width: 100%; max-height: 300px; object-fit: cover; border: 8px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); margin-bottom: 18px; }
.sheet h2 { margin: 0 0 10px; font-family: var(--font-hand); font-size: 1.8rem; text-transform: uppercase; line-height: 1.15; }
.sheet-desc { white-space: pre-line; line-height: 1.6; margin: 0 0 12px; color: #3d3730; }
.sheet-deadline { font-weight: 600; color: var(--accent); margin: 0 0 16px; }
.sheet-closed { padding: 14px; border: 2px dashed var(--accent); color: var(--accent); border-radius: 6px; font-weight: 600; text-align: center; }

.sub-form { display: grid; gap: 16px; margin-top: 22px; padding-top: 20px; border-top: 2px dashed rgba(0,0,0,.15); }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.field-label { font-weight: 600; font-size: .92rem; }
.field small, .field span[id$="-req"] { font-weight: 400; color: var(--ink-soft); }
.field input, .field textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1.5px solid #cfc6b4;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-weight: 400;
    color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: none; border-color: #2f6fd9; box-shadow: 0 0 0 3px rgba(47,111,217,.18); }
.field textarea { resize: vertical; min-height: 96px; }

.drop {
    position: relative;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 22px 16px;
    border: 2px dashed #b9ad95;
    border-radius: 8px;
    background: rgba(255,255,255,.7);
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.drop:hover, .drop.is-over { background: #fff; border-color: #2f6fd9; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-text { font-weight: 400; }
.drop-text strong { color: #2f6fd9; }
.drop-hint { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; background: #fff; border: 1px solid #e3dccd; border-radius: 6px; font-size: .88rem; font-weight: 400; }
.file-list li.bad { border-color: #e7a497; background: #fff3f0; color: #a3301d; }
.file-list .fsize { color: var(--ink-soft); white-space: nowrap; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; line-height: 1.45; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-error { padding: 10px 12px; border-radius: 6px; background: #fdecea; color: #a3301d; font-weight: 600; font-size: .92rem; }

.progress { position: relative; height: 26px; border-radius: 13px; background: #ece6d8; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #2e9d55, #46c173); transition: width .15s; }
.progress-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }

.btn-submit {
    justify-self: start;
    padding: 13px 26px;
    border: 0;
    border-radius: 6px;
    background: var(--board);
    color: var(--chalk);
    font: inherit;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    box-shadow: 0 4px 0 #0f1a15;
    transition: transform .1s, box-shadow .1s, background .15s;
}
.btn-submit:hover { background: #2e4a3d; }
.btn-submit:active { transform: translateY(3px); box-shadow: 0 1px 0 #0f1a15; }
.btn-submit:disabled { opacity: .6; cursor: progress; }

.sheet-success { text-align: center; padding: 20px 0 6px; }
.sheet-success .btn-submit { justify-self: center; }
.big-check {
    width: 76px; height: 76px;
    margin: 0 auto 10px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: #2e9d55;
    color: #fff;
    font-size: 2.4rem;
    animation: pop .4s cubic-bezier(.2,.8,.3,1.4);
}
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

@media (max-width: 560px) {
    .notes { grid-template-columns: 1fr 1fr; gap: 26px 14px; }
    .note { min-height: 0; padding: 24px 12px 14px; }
    .note-title { font-size: 1.05rem; }
    .note-teaser { display: none; }
    .eraser { display: none; }
}
@media (max-width: 380px) { .notes { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
    .note, .sheet[open], .big-check { transition: none; animation: none; }
}
