/* ==========================================================================
   Omar's Bulletin Board — style.css
   Retro manga cork board. Muted, warm, a little worn at the edges.
   ========================================================================== */

/* ---------- 1. The whole room ---------- */

:root {
    /* Paper and ink */
    --paper:      #f0e6d2;
    --paper-deep: #e3d5b9;
    --ink:        #3a2f26;
    --ink-soft:   #6b5a49;
    --line:       #c9b48c;

    /* Cork and wood */
    --cork:       #c49a6c;
    --cork-dark:  #a87b50;
    --wood:       #7a5230;
    --wood-light: #9c6b3f;

    /* Sticky note colours — one per category */
    --idea:     #f2dfa0;
    --reminder: #a9c8dc;
    --food:     #b6d6a8;
    --read:     #cbb8dd;
    --recipe:   #edb785;
    --hobby:    #e8a9a9;

    --hand: "Caveat", "Comic Sans MS", cursive;
    --ui:   "Patrick Hand", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 28px 18px 60px;
    min-height: 100vh;

    /* The cream page of an old manga, with faint ruled lines */
    background-color: var(--paper);
    background-image:
        repeating-linear-gradient(
            to bottom,
            rgba(58, 47, 38, 0.035) 0 1px,
            transparent 1px 34px
        ),
        radial-gradient(circle at 20% 10%, rgba(255,255,255,0.5), transparent 55%),
        radial-gradient(circle at 85% 80%, rgba(58,47,38,0.06), transparent 50%);

    color: var(--ink);
    font-family: var(--ui);
    font-size: 17px;
    line-height: 1.5;
}


/* ---------- 2. The sign above the board ---------- */

.masthead {
    text-align: center;
    margin-bottom: 26px;
}

.avatar {
    width: 116px;
    height: 116px;
    margin: 0 auto 12px;
    border-radius: 50%;
    overflow: hidden;

    background: var(--paper-deep);
    border: 4px solid var(--ink);
    box-shadow: 0 6px 0 rgba(58,47,38,0.18), 0 12px 26px rgba(58,47,38,0.22);

    display: grid;
    place-items: center;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar__fallback {
    font-family: var(--hand);
    font-size: 58px;
    font-weight: 700;
    color: var(--ink-soft);
}

.masthead__title {
    display: inline-block;
    margin: 0;
    padding: 6px 26px;

    font-family: var(--hand);
    font-size: clamp(30px, 6vw, 46px);
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);

    /* A strip of masking tape holding down a paper label */
    background: #fbf6ea;
    border: 2.5px solid var(--ink);
    box-shadow: 3px 4px 0 rgba(58,47,38,0.16);
    transform: rotate(-1deg);
}

.masthead__tagline {
    margin: 10px 0 0;
    font-size: 19px;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
}


/* ---------- 3. The cork board ---------- */

.board { max-width: 1180px; margin: 0 auto; }

.board__frame {
    padding: 22px;
    border-radius: 8px;

    background-color: var(--cork);
    /* Speckled cork: many small circles of slightly different browns */
    background-image:
        radial-gradient(circle at 12% 18%, rgba(58,47,38,0.20) 0 3px, transparent 4px),
        radial-gradient(circle at 78% 12%, rgba(255,255,255,0.30) 0 4px, transparent 5px),
        radial-gradient(circle at 44% 72%, rgba(58,47,38,0.17) 0 3px, transparent 4px),
        radial-gradient(circle at 88% 61%, rgba(58,47,38,0.19) 0 5px, transparent 6px),
        radial-gradient(circle at 27% 88%, rgba(255,255,255,0.26) 0 4px, transparent 5px),
        radial-gradient(circle at 63% 34%, rgba(58,47,38,0.15) 0 3px, transparent 4px),
        radial-gradient(circle at 6% 55%,  rgba(58,47,38,0.14) 0 4px, transparent 5px),
        radial-gradient(circle at 55% 5%,  rgba(255,255,255,0.22) 0 3px, transparent 4px),
        radial-gradient(circle at 71% 92%, rgba(58,47,38,0.16) 0 4px, transparent 5px),
        radial-gradient(circle at 36% 45%, rgba(255,255,255,0.18) 0 3px, transparent 4px),
        linear-gradient(160deg, #cfa476, #b98a5c);

    border: 12px solid var(--wood);
    outline: 2px solid rgba(58,47,38,0.35);
    outline-offset: -14px;
    box-shadow:
        0 3px 0 var(--wood-light),
        0 16px 30px rgba(58,47,38,0.30);
}

/*
   The notes flow down the first column, then across.
   "columns" is a way of stacking boxes like newspaper columns.
*/
.board__notes {
    columns: 4 190px;
    column-gap: 16px;
}

.board__empty {
    column-span: all;
    text-align: center;
    font-family: var(--hand);
    font-size: 26px;
    color: #6b4a2e;
    margin: 20px 0;
}


/* ---------- 3a. A friendly warning ---------- */

.alert {
    max-width: 900px;
    margin: 0 auto 22px;
    padding: 14px 18px;

    font-size: 16px;
    color: #6b2b26;
    background: #fbe6e2;
    border: 2.5px solid #b5463d;
    border-radius: 6px;
    box-shadow: 3px 4px 0 rgba(58,47,38,0.14);
}

.alert strong { display: block; font-size: 19px; margin-bottom: 4px; }
.alert span   { display: block; }
.alert code   { background: rgba(255,255,255,0.6); padding: 1px 5px; }

.alert__hint { margin-top: 6px; font-size: 15px; color: #8a4a43; }


/* ---------- 4. One sticky note ---------- */

.note {
    position: relative;

    break-inside: avoid;   /* never let a note split across two columns */
    -webkit-column-break-inside: avoid;
    margin: 0 0 16px;

    padding: 30px 16px 14px;   /* room at the top for the pin */
    min-height: 108px;

    background: var(--idea);
    color: var(--ink);

    font-family: var(--hand);
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.18s ease, box-shadow 0.18s ease;

    box-shadow:
        2px 4px 0 rgba(58,47,38,0.16),
        0 10px 18px rgba(58,47,38,0.18);
}

/* A soft fold running down the middle, like real paper */
.note::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        to right,
        rgba(255,255,255,0.22) 0 6%,
        transparent 6% 94%,
        rgba(58,47,38,0.07) 94% 100%
    );
}

/* The bottom corner peeling up */
.note::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 30px 30px;
    border-color: transparent transparent rgba(58, 47, 38, 0.13) transparent;
    filter: drop-shadow(-2px -2px 2px rgba(58, 47, 38, 0.28));
}

.note:hover {
    transform: rotate(0deg) scale(1.035);
    box-shadow:
        3px 6px 0 rgba(58,47,38,0.18),
        0 18px 28px rgba(58,47,38,0.26);
    z-index: 5;
}

/* The colour of each category */
.note--idea     { background: var(--idea); }
.note--reminder { background: var(--reminder); }
.note--food     { background: var(--food); }
.note--read     { background: var(--read); }
.note--recipe   { background: var(--recipe); }
.note--hobby    { background: var(--hobby); }

/* The little tack holding it up */
.note__pin {
    position: absolute;
    top: 10px;
    left: 50%;
    margin-left: -7px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #fff 0 12%, #d94f4f 14% 55%, #8e2323 100%);
    box-shadow: 0 2px 3px rgba(58,47,38,0.45);
    z-index: 2;
}

.note__body {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.28;
    overflow-wrap: break-word;
}

.note__foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding-right: 34px;   /* keeps the time clear of the corner doodle */
    font-size: 15px;
    color: rgba(58,47,38,0.72);
}

.note__name { font-weight: 700; }
.note__time { white-space: nowrap; }

.note__icon {
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 21px;
    opacity: 0.75;
}

/* The small x, only visible when you point at the note */
.note__remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    line-height: 1;
    font-size: 20px;
    color: var(--ink);
    background: rgba(255,255,255,0.55);
    border: 1.5px solid rgba(58,47,38,0.4);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    z-index: 3;
}

.note:hover .note__remove,
.note__remove:focus-visible { opacity: 1; }
.note__remove:hover { background: #fff; }


/* ---------- 4b. The folded replies ---------- */

/* A note that has replies needs room underneath for the stacked papers. */
.note--threaded { margin-bottom: 30px; }

.thread { margin: 0; }

/* The strip you click. Sits inside the note, at the bottom. */
.thread__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 7px 4px 7px 0;

    font-family: var(--hand);
    font-size: 17px;
    font-weight: 600;
    color: rgba(58, 47, 38, 0.85);

    background: transparent;
    border: 0;
    border-top: 1.5px dashed rgba(58, 47, 38, 0.35);
    cursor: pointer;
    text-align: left;
}

.thread__toggle:hover { color: var(--ink); }
.thread__toggle:hover .thread__chev { transform: rotate(180deg); }

.thread__label { flex: 1; }

.thread__chev {
    font-size: 14px;
    transition: transform 0.18s ease;
}

/*
   The stacked-paper edge.
   The <i> boxes are thin strips of paper that slide out from UNDER the
   note, so they read as "there is more hidden in here".

   These live OUTSIDE the button on purpose. A button creates its own
   little positioning world, so if these were inside it, "bottom: 0"
   would mean the bottom of the button rather than the bottom of the note.
   As a direct child of .thread they are anchored to .note instead.
   bottom: -18px hangs them just past the note's bottom edge.
*/
.thread__sheets {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -18px;
    height: 18px;
    pointer-events: none;
}

.thread__sheets i {
    position: absolute;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 0 0 3px 3px;
    background: #fdf6e3;
    box-shadow: 0 2px 3px rgba(58, 47, 38, 0.22);
}

/* Each sheet sits a little lower and a little narrower, like real paper. */
.thread__sheets i:nth-child(1) { top: 0;    right: 16%; background: #f7ecd2; }
.thread__sheets i:nth-child(2) { top: 5px;  right: 8%;  background: #fdf6e3; }
.thread__sheets i:nth-child(3) { top: 10px; right: 0;   background: #fffdf4; }

/*
   How many sheets show depends on how many replies there are.
   Nothing shows when there are no replies, so a note with no replies
   looks exactly like a note always did.
   1 reply -> 1 sheet, 2 replies -> 2 sheets, 3 or more -> 3 sheets.
*/
.thread__sheets i { display: none; }
.thread--one  .thread__sheets i:nth-child(-n + 1),
.thread--two  .thread__sheets i:nth-child(-n + 2),
.thread--many .thread__sheets i:nth-child(-n + 3) { display: block; }

/* The open panel */
.thread__panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1.5px dashed rgba(58, 47, 38, 0.3);
}

.thread__panel[hidden] { display: none; }

.thread__list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 9px;
}

/* One reply: a smaller slip of paper, tilted the other way. */
.reply {
    padding: 9px 11px;
    background: rgba(255, 253, 244, 0.72);
    border: 1.5px solid rgba(58, 47, 38, 0.3);
    border-radius: 3px;
    box-shadow: 2px 2px 0 rgba(58, 47, 38, 0.1);
    transform: rotate(-0.5deg);
}

.reply:nth-child(even) { transform: rotate(0.6deg); background: rgba(255, 250, 232, 0.8); }

.reply__body {
    margin: 0 0 4px;
    font-family: var(--hand);
    font-size: 17px;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.reply__who {
    margin: 0;
    font-size: 13px;
    color: rgba(58, 47, 38, 0.7);
    display: flex;
    gap: 7px;
}

.reply__who b { font-weight: 700; color: rgba(58, 47, 38, 0.9); }

.thread__blank {
    margin: 0 0 12px;
    font-family: var(--hand);
    font-size: 17px;
    color: rgba(58, 47, 38, 0.65);
}

/* The small reply form */
.thread__form { display: grid; gap: 7px; }

.thread__input {
    width: 100%;
    padding: 7px 9px;
    font-family: var(--ui);
    font-size: 15px;
    color: var(--ink);
    background: #fffdf7;
    border: 2px solid rgba(58, 47, 38, 0.55);
    border-radius: 3px;
    resize: vertical;
}

.thread__input:focus {
    outline: 3px solid rgba(217, 79, 79, 0.3);
    outline-offset: 1px;
}

.thread__input--body { min-height: 54px; }

.thread__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.thread__status {
    margin: 0;
    font-size: 13px;
    color: rgba(58, 47, 38, 0.7);
    min-height: 1em;
}

.thread__status.is-error { color: #a3312c; font-weight: 700; }
.thread__status.is-ok    { color: #3d6b3f; font-weight: 700; }

.thread__send {
    padding: 6px 18px;
    font-family: var(--hand);
    font-size: 18px;
    font-weight: 700;
    color: #fbf6ea;
    background: var(--ink);
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(58, 47, 38, 0.3);
}

.thread__send:hover { background: #4c3d31; }
.thread__send[disabled] { opacity: 0.55; cursor: wait; }


/* ---------- 5. A note that just arrived ---------- */

.note--fresh { animation: pin-drop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) both; }

@keyframes pin-drop {
    0%   { transform: translateY(-28px) scale(0.9) rotate(0deg); opacity: 0; }
    60%  { opacity: 1; }
    100% { transform: translateY(0) scale(1) rotate(var(--tilt, 0deg)); opacity: 1; }
}

.note--leaving {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: rotate(var(--tilt, 0deg)) scale(0.85) !important;
}


/* ---------- 6. The form ---------- */

.composer { max-width: 780px; margin: 0 auto 34px; }

.composer__howto {
    margin: -10px 0 18px;
    text-align: center;
    font-size: 16px;
    line-height: 1.45;
    color: var(--ink-soft);
}

.composer__howto b { color: var(--ink); }

.composer__card {
    background: #fbf6ea;
    border: 2.5px solid var(--ink);
    border-radius: 6px;
    box-shadow: 4px 5px 0 rgba(58,47,38,0.16);
    padding: 20px 22px 22px;
}

.composer__heading {
    margin: 0 0 16px;
    font-family: var(--hand);
    font-size: 30px;
    font-weight: 700;
    text-align: center;
}

.composer__row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 16px;
}

.composer__row > .field { flex: 1 1 190px; }
.composer__row > .picker { flex: 2 1 340px; margin: 0; }

.field { display: block; position: relative; }

.field__label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--hand);
    font-size: 19px;
    font-weight: 600;
}

.field__input {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--ui);
    font-size: 17px;
    color: var(--ink);
    background: #fffdf7;
    border: 2px solid var(--ink);
    border-radius: 4px;
    resize: vertical;
}

.field__input--message { min-height: 96px; }

.field__input:focus {
    outline: 3px solid rgba(217,79,79,0.35);
    outline-offset: 1px;
}

.field__count {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-size: 14px;
    color: var(--ink-soft);
    pointer-events: none;
}


/* Colour swatches */
.picker { border: 0; padding: 0; }

.picker__row { display: flex; flex-wrap: wrap; gap: 7px; }

.picker__chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.picker__chip span {
    display: inline-block;
    padding: 5px 12px;
    font-size: 15px;
    border: 2px solid rgba(58,47,38,0.55);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.picker__chip input:checked + span {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(58,47,38,0.18);
    transform: translateY(-1px);
}

.picker__chip input:focus-visible + span { outline: 3px solid rgba(217,79,79,0.5); }

.picker__chip--idea     span { background: var(--idea); }
.picker__chip--reminder span { background: var(--reminder); }
.picker__chip--food     span { background: var(--food); }
.picker__chip--read     span { background: var(--read); }
.picker__chip--recipe   span { background: var(--recipe); }
.picker__chip--hobby    span { background: var(--hobby); }

.picker__chip span:hover { transform: translateY(-2px) rotate(-1.5deg); }


/* Submit row */
.composer__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.composer__status {
    margin: 0;
    font-size: 16px;
    color: var(--ink-soft);
    min-height: 1.4em;
}

.composer__status.is-error { color: #a3312c; font-weight: 700; }
.composer__status.is-ok    { color: #3d6b3f; font-weight: 700; }

.btn {
    padding: 11px 30px;
    font-family: var(--hand);
    font-size: 22px;
    font-weight: 700;
    color: #fbf6ea;
    background: var(--ink);
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 3px 4px 0 rgba(58,47,38,0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.btn:hover  { transform: translate(-1px, -1px); box-shadow: 5px 6px 0 rgba(58,47,38,0.35); }
.btn:active { transform: translate(2px, 3px);  box-shadow: 1px 1px 0 rgba(58,47,38,0.35); }

.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }

/* The main action, made hard to miss */
.btn--big {
    padding: 14px 38px;
    font-size: 25px;
    background: #d94f4f;
    box-shadow: 4px 5px 0 rgba(58,47,38,0.4);
}

.btn--big:hover { background: #e35f5f; }


/* ---------- 7. The small print ---------- */

.pagefoot {
    margin-top: 34px;
    text-align: center;
    font-size: 15px;
    color: var(--ink-soft);
}

.pagefoot p { margin: 0; }


/* ---------- 8. Phones ---------- */

@media (max-width: 620px) {
    body { padding: 20px 12px 44px; }
    .board__frame { padding: 14px; border-width: 8px; }
    .board__notes { columns: 2 130px; column-gap: 12px; }
    .note { padding: 26px 12px 12px; }
    .note__body { font-size: 19px; }
    .composer__card { padding: 16px; }
    .composer__actions { justify-content: center; }
    .btn { width: 100%; }
}

/* People who do not like motion get a still board instead */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
