:root {
    --paper: #f7f6f2;
    --ink: #242421;
    --muted: #73716a;
    --line: #ddd9d0;
    --accent: #b44c32;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--paper);
    color: var(--ink);
}

body,
button,
input {
    font-family: "Source Serif 4", Georgia, serif;
}

.notes-app {
    width: min(760px, calc(100% - 40px));
    margin: 0 auto;
    padding-bottom: 80px;
}

.app-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.site-brand,
.site-nav a {
    color: inherit;
    text-decoration: none;
}

.app-title {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.site-nav {
    display: flex;
    gap: 22px;
}

.site-nav a {
    color: var(--muted);
    font-size: 14px;
}

.site-nav a:hover {
    color: var(--ink);
}

.discovery {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 28px;
    align-items: start;
    padding: 34px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.search-bar {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-input {
    width: 100%;
    height: 36px;
    padding: 0 30px 0 27px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
}

.search-input:focus {
    border-color: var(--ink);
}

.search-input::placeholder {
    color: var(--muted);
}

.clear-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.tags-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.tags-label,
.clear-tags-btn,
.filters-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}

.tags-label,
.filters-label {
    color: var(--muted);
}

.clear-tags-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
}

.tags-container,
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.tag-btn:hover,
.tag-btn.active {
    border-color: #aaa69d;
    background: #ebe8e1;
    color: var(--ink);
}

.tag-btn.filtered-out {
    display: none;
}

.tag-name {
    font-size: 13px;
}

.tag-count {
    font-size: 10px;
    opacity: .65;
}

.active-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 5px;
    background: #eeece6;
}

.filter-chip {
    color: var(--accent);
    font-size: 11px;
}

.filter-chip-remove {
    margin-left: 4px;
    cursor: pointer;
}

.notes-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 52px 0 16px;
    border-bottom: 1px solid var(--ink);
}

.notes-list-title {
    margin: 0;
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.app-count {
    color: var(--muted);
    font-size: 11px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 52px;
}

.note-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfaf7;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.note-card:hover {
    border-color: #c7c2b7;
    box-shadow: 0 5px 18px rgba(36, 36, 33, .06);
    transform: translateY(-1px);
}

.note-card[hidden] {
    display: none;
}

.note-hero-image {
    width: 100%;
    height: clamp(190px, 36vw, 290px);
    margin: 16px 0;
    overflow: hidden;
    border-radius: 5px;
    background: #e8e5de;
}

.note-hero-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .25s ease;
}

.note-card:hover .note-hero-image img {
    transform: scale(1.02);
}

.note-content {
    min-width: 0;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    color: var(--muted);
    font-size: 11px;
}

.note-tag::before {
    content: "#";
    color: #aaa69d;
}

.note-title {
    margin: 0;
    font-size: 23px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.015em;
    transition: color .15s ease;
}

.note-card:hover .note-title {
    color: var(--accent);
}

.note-snippet {
    display: -webkit-box;
    margin: 10px 0 0;
    overflow: hidden;
    color: #646159;
    font-size: 15px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.empty-state {
    padding: 64px 20px;
    text-align: center;
    color: var(--muted);
}

.reset-btn {
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

@media (max-width: 620px) {
    .notes-app {
        width: min(100% - 32px, 540px);
        padding-bottom: 56px;
    }

    .discovery {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .notes-list-header {
        padding-top: 42px;
    }

    .note-card {
        padding: 16px;
    }

    .note-hero-image {
        height: 210px;
    }

    .note-title {
        font-size: 21px;
    }

    .note-snippet {
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 420px) {
    .note-hero-image {
        height: 180px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .note-card,
    .note-hero-image img {
        transition: none;
    }
}
