@import url('https://fonts.googleapis.com/css2?family=Delius+Swash+Caps&family=Erica+One&family=Indie+Flower&display=swap');

:root {
    --page-grid: rgba(41, 72, 102, 0.07);
    --page-ink: #1d2430;
    --note-paper: #fffaf0;
    --note-paper-deep: #fff2bf;
    --note-border: rgba(59, 48, 28, 0.22);
    --note-rule: rgba(52, 82, 117, 0.16);
    --note-height: clamp(240px, 28vw, 315px);
    --note-line: 24px;
    --note-pad-x: clamp(18px, 3vw, 26px);
    --note-pad-top: 42px;
    --note-pad-bottom: 22px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--page-ink);
    font-family: "Segoe UI", Arial, sans-serif;
    background:
        linear-gradient(90deg, var(--page-grid) 1px, transparent 1px),
        linear-gradient(var(--page-grid) 1px, transparent 1px),
        linear-gradient(135deg, #f7fafc 0%, #edf7f0 46%, #fbf0f4 100%);
    background-attachment: fixed;
    background-size: 46px 46px, 46px 46px, auto;
}

.main {
    position: relative;
    width: min(100% - 48px, 1040px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 96px 0 76px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 48px;
}

.card {
    --pin: #3a86ff;
    --pin-glow: rgba(58, 134, 255, 0.3);
    position: relative;
    width: min(100%, 520px);
    height: var(--note-height);
    align-self: flex-start;
    isolation: isolate;
}

.card:nth-child(2n) {
    align-self: flex-end;
}

.card:nth-child(3n-1) {
    --pin: #ffbe0b;
    --pin-glow: rgba(255, 190, 11, 0.34);
}

.card:nth-child(3n) {
    --pin: #ef476f;
    --pin-glow: rgba(239, 71, 111, 0.3);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border: 1px solid var(--note-border);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--note-paper), var(--note-paper-deep));
    box-shadow:
        0 18px 34px rgba(40, 44, 52, 0.18),
        0 4px 12px rgba(40, 44, 52, 0.12);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:focus-within::before {
    border-color: rgba(58, 134, 255, 0.42);
    box-shadow:
        0 18px 34px rgba(40, 44, 52, 0.18),
        0 4px 12px rgba(40, 44, 52, 0.12),
        0 0 0 2px rgba(58, 134, 255, 0.16);
}

.card textarea {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    padding: var(--note-pad-top) var(--note-pad-x) var(--note-pad-bottom);
    resize: none;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 8px;
    outline: 0;
    background: transparent;
    color: #243042;
    caret-color: #ef476f;
    font-family: "Delius Swash Caps", cursive;
    font-size: clamp(16px, 1.7vw, 19px);
    line-height: var(--note-line);
    letter-spacing: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(36, 48, 66, 0.35) transparent;
}

.card textarea:focus {
    outline: 0;
}

.card textarea::-webkit-scrollbar {
    width: 8px;
}

.card textarea::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(36, 48, 66, 0.28);
}

.lines {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    border-radius: 8px;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--note-line) - 1px),
        var(--note-rule) calc(var(--note-line) - 1px),
        var(--note-rule) var(--note-line)
    );
    background-position: 0 calc(var(--note-pad-top) + 3px);
}

.lines div {
    display: none;
}

.circle {
    position: absolute;
    z-index: 3;
    top: -20px;
    left: calc(50% - 20px);
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.85) 0 12%, transparent 13%),
        var(--pin);
    box-shadow:
        0 10px 18px var(--pin-glow),
        0 2px 8px rgba(24, 31, 42, 0.28);
}

.nav {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
}

.nav_menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.button,
.burger {
    border: 1px solid rgba(255, 255, 255, 0.42);
    background-color: rgba(255, 255, 255, 0.5);
    color: #253044;
    box-shadow: 0 10px 24px rgba(32, 39, 52, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.button {
    width: 96px;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: #253044;
    text-decoration: none;
    text-align: center;
    font: 700 17px/1 "Segoe UI", Arial, sans-serif;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
    background-color: rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 28px rgba(32, 39, 52, 0.16);
}

.button:active {
    transform: translateY(0) scale(0.98);
}

.burger {
    display: none;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 768px) {
    :root {
        --note-height: clamp(218px, 54vw, 270px);
        --note-line: 22px;
        --note-pad-x: 16px;
        --note-pad-top: 36px;
        --note-pad-bottom: 18px;
    }

    body {
        background-size: 34px 34px, 34px 34px, auto;
    }

    .main {
        width: min(100% - 24px, 520px);
        padding: 88px 0 42px;
        gap: 36px;
    }

    .nav {
        top: 12px;
        left: 12px;
    }

    .burger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav_menu {
        position: absolute;
        top: 60px;
        left: 0;
        padding: 8px;
        border: 1px solid rgba(255, 255, 255, 0.35);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.58);
        box-shadow: 0 16px 32px rgba(32, 39, 52, 0.16);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .nav_menu.open {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .button {
        width: 62px;
        min-height: 40px;
        padding: 7px 8px;
        font-size: 15px;
    }

    #new_card {
        min-height: 44px;
        font-size: 24px;
    }

    .card,
    .card:nth-child(2n) {
        width: 100%;
        align-self: center;
    }

    .card textarea {
        font-size: 16px;
    }

    .circle {
        top: -17px;
        left: calc(50% - 17px);
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    :root {
        --note-height: clamp(202px, 64vw, 242px);
        --note-line: 21px;
        --note-pad-x: 14px;
        --note-pad-top: 34px;
        --note-pad-bottom: 16px;
    }

    .main {
        width: min(100% - 18px, 420px);
        padding-top: 82px;
        gap: 32px;
    }

    .burger {
        width: 48px;
        height: 48px;
        font-size: 25px;
    }

    .nav_menu {
        top: 56px;
    }

    .button {
        width: 58px;
        min-height: 38px;
        font-size: 14px;
    }

    #new_card {
        min-height: 42px;
        font-size: 23px;
    }

    .card textarea {
        font-size: 15px;
    }
}
