/* the board */
.bulletins {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 34px 28px;
    padding: 18px 8px;
}

/* a note */
.postit {
    --paper: #fefabc;
    --paper-dark: #efec88;
    --pin: #d6403a;
    --tilt: 0deg;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 440px;
    overflow: visible;
    padding: 26px 18px 14px 18px;
    color: #3a3a2c;
    background: var(--paper) linear-gradient(150deg, var(--paper-dark) 0%, var(--paper) 100%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .15), 0 6px 14px -4px rgba(0, 0, 0, .35);
    transform: rotate(var(--tilt));
    transition: transform .18s ease, box-shadow .18s ease;
}
.postit:hover {
    transform: rotate(0deg) scale(1.03);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .15), 0 14px 24px -6px rgba(0, 0, 0, .4);
    z-index: 2;
}
/* the pin */
.postit::before {
    content: '';
    position: absolute;
    top: -9px;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .75) 0 12%, var(--pin) 40%, rgba(0, 0, 0, .45) 100%);
    box-shadow: 0 4px 5px rgba(0, 0, 0, .35);
    z-index: 3;
}

.postit.color-yellow,
.swatch.color-yellow { --paper: #fefabc; --paper-dark: #efec88; --pin: #d6403a; }
.postit.color-pink,
.swatch.color-pink { --paper: #ffd9e4; --paper-dark: #f6aec5; --pin: #2f7fd0; }
.postit.color-blue,
.swatch.color-blue { --paper: #d3ecff; --paper-dark: #a5d2f2; --pin: #d6403a; }
.postit.color-green,
.swatch.color-green { --paper: #daf5d0; --paper-dark: #aedf9f; --pin: #e0a020; }
.postit.color-orange,
.swatch.color-orange { --paper: #ffe2b8; --paper-dark: #f9c283; --pin: #3a8f4f; }

.postit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 22px;
    font-size: .8em;
    opacity: .8;
}
.postit-head form {
    margin: 0;
}
.postit .remove {
    display: block;
    padding: 0 2px;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    opacity: .5;
}
.postit .remove:hover {
    opacity: 1;
    color: #c0392b;
}

.postit h3, .postit p {
    font-family: 'DPDorkDiary', 'Comic Sans', cursive;
    text-align: center;
    color: inherit;
}
.postit h3 {
    margin: .5em 0 0;
    font-size: 1.5em;
    line-height: 1.2em;
    font-weight: var(--font-weight-strong);
    overflow-wrap: anywhere;
}
.postit p {
    flex-grow: 1;
    margin: .6em 0 .8em;
    font-size: 1.1em;
    line-height: 1.3em;
    overflow-wrap: anywhere;
    overflow-y: auto;
}
.postit .user {
    text-align: right;
    font-size: .8em;
    opacity: .8;
}

/* a freshly pinned note drops onto the board */
@keyframes postit-drop {
    0% { transform: translateY(-60px) rotate(calc(var(--tilt) * 3)) scale(1.25); opacity: 0; }
    55% { opacity: 1; }
    75% { transform: translateY(4px) rotate(var(--tilt)) scale(.98); }
    100% { transform: rotate(var(--tilt)) scale(1); opacity: 1; }
}
.postit.just-added {
    animation: postit-drop .7s cubic-bezier(.3, .7, .4, 1) both;
}

/* the blank note */
.postit-new {
    --tilt: -1.5deg;
    justify-content: center;
    background: transparent;
    border: 2px dashed var(--color-border-medium);
    box-shadow: none;
}
.postit-new::before {
    display: none;
}
.postit-new:hover {
    transform: rotate(0deg) scale(1.02);
    box-shadow: none;
    border-color: var(--color-highlight);
}
.postit-new-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-grow: 1;
    justify-content: center;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-size: 1.05em;
    cursor: pointer;
}
.postit-new-open .la {
    font-size: 44px;
    transition: transform .25s ease;
}
.postit-new:hover .postit-new-open {
    color: var(--color-highlight);
}
.postit-new:hover .postit-new-open .la {
    transform: rotate(90deg);
}
.postit-new-form {
    display: none;
}

/* opened: the blank note becomes a real one you write on */
.postit-new.open {
    min-height: 280px;
    max-height: none;
    border: 0;
    background: var(--paper) linear-gradient(150deg, var(--paper-dark) 0%, var(--paper) 100%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .15), 0 14px 24px -6px rgba(0, 0, 0, .4);
    transform: rotate(0deg);
    z-index: 4;
    justify-content: flex-start;
}
.postit-new.open::before {
    display: block;
}
.postit-new.open .postit-new-open {
    display: none;
}
.postit-new.open .postit-new-form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
    animation: postit-open .25s ease both;
}
@keyframes postit-open {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
.postit-new-form textarea {
    width: 100%;
    padding: 4px 2px;
    border: 0;
    border-bottom: 1px dashed rgba(0, 0, 0, .3);
    background: transparent;
    color: inherit;
    font-family: 'DPDorkDiary', 'Comic Sans', cursive;
    text-align: center;
    outline: none;
}
.postit-new-form textarea.postit-title-input {
    flex-grow: 0;
    min-height: 0;
    font-size: 1.5em;
    font-weight: var(--font-weight-strong);
    line-height: 1.2em;
    overflow: hidden;
}
.postit-new-form textarea {
    flex-grow: 1;
    min-height: 110px;
    font-size: 1.15em;
    line-height: 1.3em;
    resize: none;
}
.postit-new-form input::placeholder,
.postit-new-form textarea::placeholder {
    color: rgba(0, 0, 0, .35);
}
.postit-new-form input:focus,
.postit-new-form textarea:focus {
    border-bottom-color: rgba(0, 0, 0, .65);
}

.postit-swatches {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.swatch {
    position: relative;
    margin: 0;
    cursor: pointer;
}
.swatch input {
    position: absolute;
    opacity: 0;
}
.swatch span {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--paper-dark);
    border: 2px solid rgba(255, 255, 255, .9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
    transition: transform .15s ease;
}
.swatch:hover span {
    transform: scale(1.15);
}
.swatch input:checked + span {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .65);
    transform: scale(1.15);
}
.swatch input:focus-visible + span {
    outline: 2px solid var(--color-highlight);
    outline-offset: 2px;
}

.postit-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.postit-actions button {
    border: 0;
    background: none;
    color: inherit;
    font-size: .95em;
    cursor: pointer;
}
.postit-cancel {
    opacity: .6;
}
.postit-cancel:hover {
    opacity: 1;
    text-decoration: underline;
}
.postit-pin {
    padding: 5px 14px !important;
    border-radius: 3px;
    background: rgba(0, 0, 0, .75) !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
    transition: transform .12s ease;
}
.postit-pin:hover {
    transform: translateY(-1px) rotate(-2deg);
}
.postit-pin:active {
    transform: scale(.96);
}

@media (prefers-reduced-motion: reduce) {
    .postit, .postit-new-open .la, .swatch span, .postit-pin {
        transition: none;
    }
    .postit.just-added, .postit-new.open .postit-new-form {
        animation: none;
    }
}

@media (max-width: 575.98px) {
    .bulletins {
        grid-template-columns: 1fr;
    }
}
