/* Page layout: background, main area, sidebar, input section */

.dotted {
    background-color: var(--cream);
    background-image: radial-gradient(var(--dots) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
}

.main-content {
    flex: 1;
    min-width: 0;
    max-width: 1280px;           /* content does not stretch on huge screens */
    margin-inline: auto;         /* and sits in the middle of the free space */
    display: flex;
    flex-direction: column;
    gap: 40px;

    padding: 40px 56px 40px 20px;
}

/* ---------- Top bar (headline + search) ---------- */

.top-bar {
    display: flex;
    flex-wrap: wrap;             /* search moves below the headline when narrow */
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.top-bar h2 {
    min-width: 0;
    overflow-wrap: anywhere;     /* very long names break instead of overflowing */
    font-size: var(--fs-h1);
    font-weight: var(--fw-black);
    letter-spacing: var(--ls-h1);
}

.top-bar .icon {
    vertical-align: middle;
}

.name-marker {
    display: inline-block;
    max-width: 100%;
    padding: 0 12px;
    text-align: left;

    background-color: var(--sun);
    border: var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-btn);
    color: var(--title-accent);
    transform: rotate(-1.5deg);

    /* It is a button now: same font as the headline, clickable */
    font: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.search-field {
    width: 280px;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;

    background-color: var(--white);
    border: var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-btn);
}

.search-field input {
    width: 100%;
    border: none;
    outline: none;
}

.search-field:focus-within {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
}

/* ---------- Sidebar ---------- */

.sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    overflow: hidden;
    height: 100dvh;
    width: 300px;
    flex: none;
    display: flex;
    flex-direction: column;
    padding: 36px 28px;

    background-color: var(--lilac);
    border-right: var(--border-thick);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}

/* Decorative circles */
.sidebar::before,
.sidebar::after {
    content: "";
    position: absolute;
    border: var(--border-thick);
    border-radius: var(--radius-round);
}

.sidebar::before {
    width: 140px;
    height: 140px;
    left: -50px;
    bottom: -40px;
    background-color: var(--mint);
}

.sidebar::after {
    width: 240px;
    height: 240px;
    right: -110px;
    bottom: 130px;
    background-color: var(--peach);
}

.sidebar h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--fs-xl);
    font-weight: var(--fw-black);
}

.sidebar ul {
    position: relative;
    margin-top: 46px;
    padding: 0;
    list-style: none;
}

.sidebar li {
    margin-bottom: 8px;
}

/* The link fills the whole menu item, so the whole item is clickable */
.sidebar li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;

    border: 3px solid transparent;
    border-radius: var(--radius-md);
    color: var(--ink);
    font-weight: var(--fw-bold);
}

.sidebar li a:hover,
.sidebar li.active a {
    background-color: var(--sun);
    border-color: var(--ink);
    box-shadow: var(--shadow-btn);
}

/* Number of notes, sits at the right edge of the menu item */
.count {
    min-width: 28px;
    margin-left: auto;
    padding: 0 8px;

    background-color: var(--white);
    border: var(--border-pill);
    border-radius: var(--radius-pill);
    font-size: var(--fs-sm);
    font-weight: var(--fw-black);
    text-align: center;
}

.new-note-button {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 15px;

    background-color: var(--coral);
    border: var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-btn-lg);
    color: var(--ink);
    font-weight: var(--fw-black);
}

.new-note-button:active {
    box-shadow: none;
    transform: translate(5px, 5px);
}

/* ---------- Input section ---------- */

.input-section {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px 28px;

    min-height: 150px;
    background-color: var(--white);
    border: var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-compose);
}

.input-section input,
.input-section textarea {
    width: 100%;
    border: none;
}

.input-section textarea {
    resize: vertical;
    font-size: var(--fs-md);
    line-height: 1.6;
    color: var(--ink);
}

.pencil-badge {
    position: absolute;
    top: -22px;
    right: 26px;
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;

    background-color: var(--mint);
    border: var(--border);
    border-radius: var(--radius-round);
    box-shadow: var(--shadow-logo);
}

#note_title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-black);
}

.input-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.input-footer p {
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    color: var(--mute);
}

.input-footer button {
    padding: 10px 15px;
    background-color: var(--coral);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-btn);
}

.input-footer button:active {
    box-shadow: none;
    transform: translate(4px, 4px);
}
