/* ===========================================================================
   Notes — a clean, light reading space. No animations.
   Loaded alongside the base style.css. Scoped to /notes pages.
   =========================================================================== */

:root {
    --ink: #0a0a0a;
    --ink-soft: #3a3a3c;
    --ink-faint: #8e8e93;
    --hairline: #ececec;
    --hairline-soft: #f2f2f2;
    /* Editorial serif for note prose. System-first: Iowan/Palatino on Mac,
       Georgia elsewhere. No webfont request. */
    --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia,
        'Times New Roman', serif;
}

/* Override the base body — a comfortable column for the directory */
body {
    max-width: 820px;
    padding: 2.5rem;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---- Top bar -------------------------------------------------------------- */
.notes-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
    padding-bottom: 0;
    border-bottom: none;
}

.notes-top a {
    font-size: 0.95rem;
    color: var(--ink-soft);
    text-decoration: none;
}

.notes-top a:hover {
    opacity: 0.55;
}

.notes-top .brand {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---- Hero ----------------------------------------------------------------- */
.notes-hero {
    margin-bottom: 2.5rem;
}

.notes-hero h1 {
    font-size: clamp(2.6rem, 8vw, 3.6rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1;
    margin-bottom: 0.85rem;
}

.notes-hero p {
    font-size: 1.1rem;
    color: var(--ink-faint);
    max-width: 46ch;
    line-height: 1.55;
    font-weight: 400;
}

/* ---- Top-bar search trigger ---------------------------------------------- */
.notes-top-right {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
}

/* ---- Inline search -------------------------------------------------------- */
.notes-search {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 0.95rem;
    margin-bottom: 1rem;
    background: #fafafa;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.notes-search:focus-within {
    background: #fff;
    border-color: #d4d4d6;
}

.notes-search-icon {
    color: var(--ink-faint);
    flex-shrink: 0;
}

.notes-search-input {
    flex: 1;
    min-width: 0;
    font: inherit;
    font-size: 1rem;
    color: var(--ink);
    border: none;
    outline: none;
    background: transparent;
}

.notes-search-input::placeholder {
    color: var(--ink-faint);
}

.notes-search-key {
    flex-shrink: 0;
}

kbd {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.72em;
    color: var(--ink-faint);
    background: #fff;
    border: 1px solid #e6e6e8;
    border-radius: 5px;
    padding: 0.1em 0.4em;
    line-height: 1.4;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

/* ---- Controls row: topic chips (left) + count (right) --------------------- */
.notes-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--hairline);
}

.notes-count {
    flex-shrink: 0;
    font-size: 0.82rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-left: -0.6rem;
}

.tag-pill {
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink-faint);
    background: transparent;
    border: 0;
    border-radius: 8px;
    padding: 0.32rem 0.6rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.tag-pill:hover {
    background: #f5f5f6;
    color: var(--ink-soft);
}

.tag-pill.is-active {
    background: #f0f0f1;
    color: var(--ink);
    font-weight: 500;
}

/* ---- Numbered index ------------------------------------------------------- */
.note-index {
    list-style: none;
    counter-reset: note;
    margin-bottom: 4rem;
}

.note-entry {
    position: relative;
    counter-increment: note;
    display: grid;
    grid-template-columns: 2.75rem 1fr;
    align-items: baseline;
    gap: 1.1rem;
    padding: 1.5rem 0;
    cursor: pointer;
}

/* hover highlight — a rounded wash with breathing room beyond the text frame,
   sitting behind the content so the hairline dividers stay aligned */
.note-entry::before {
    content: '';
    position: absolute;
    inset: 0.5rem -1rem;
    z-index: -1;
    border-radius: 12px;
    background: transparent;
    transition: background 0.16s ease;
}

.note-entry:hover::before {
    background: #fafafa;
}

.note-entry + .note-entry {
    border-top: 1px solid var(--hairline-soft);
}

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

/* Auto-numbered 01, 02, … in list order — no manual numbers to maintain */
.note-entry .num::before {
    content: counter(note, decimal-leading-zero);
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
    color: var(--ink-faint);
    letter-spacing: 0.02em;
}

.note-entry .entry-main {
    min-width: 0;
}

.note-entry .entry-title {
    display: inline-block;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.2;
    color: var(--ink);
    text-decoration: none;
}

.note-entry:hover .entry-title {
    color: var(--ink-faint);
}

.note-entry:hover .num::before {
    color: var(--ink);
}

.note-entry .entry-title:focus-visible {
    outline: 2px solid #b8b8bc;
    outline-offset: 2px;
}

.note-entry .entry-summary {
    margin-top: 0.45rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

/* ---- Per-note meta row ---------------------------------------------------- */
.entry-meta {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.7rem;
    font-size: 0.82rem;
    color: var(--ink-faint);
}

.entry-meta .m-sep {
    color: #d4d4d6;
}

.entry-meta time {
    color: var(--ink-faint);
}

.m-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: capitalize;
}

/* Maturity encoded as a grayscale dot: seed (light) → evergreen (dark) */
.m-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c8c8cc;
    border: 1px solid #b9b9be;
}
.status--growing .dot {
    background: #9a9aa0;
    border-color: #88888e;
}
.status--evergreen .dot {
    background: var(--ink);
    border-color: var(--ink);
}

.m-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font: inherit;
    font-size: 0.8rem;
    color: var(--ink-faint);
    background: transparent;
    border: 0;
    border-radius: 6px;
    padding: 0.1rem 0.3rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tag::before {
    content: '#';
    opacity: 0.45;
    margin-right: 0.05em;
}

.tag:hover {
    background: #f3f3f4;
    color: var(--ink);
}

/* ---- Empty state ---------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9rem;
    padding: 4.5rem 1rem;
    color: var(--ink-faint);
}

.empty-icon {
    color: #c8c8cc;
}

.empty-msg {
    font-size: 1.05rem;
    color: var(--ink-soft);
    max-width: 40ch;
}

.empty-clear {
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.empty-clear:hover {
    border-color: #d4d4d6;
    color: var(--ink);
}

/* ---- Footer --------------------------------------------------------------- */
.notes-foot {
    margin-top: 0;
    padding-top: 2.5rem;
    border-top: 1px solid var(--hairline);
    text-align: center;
    color: var(--ink-faint);
    font-size: 0.9rem;
}

.notes-foot a {
    color: var(--ink-soft);
    text-decoration: none;
}

.notes-foot a:hover {
    opacity: 0.6;
}

/* ===========================================================================
   Individual note (article) pages
   =========================================================================== */
.note {
    max-width: 680px;
    margin: 0 auto 5rem;
}

.note-title {
    font-size: clamp(2.2rem, 6vw, 3.2rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-bottom: 1rem;
}

.note-meta {
    color: var(--ink-faint);
    font-size: 0.95rem;
    margin-bottom: 3.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--hairline);
}

.note h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.note h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.note p {
    font-family: var(--serif);
    color: var(--ink-soft);
    line-height: 1.75;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.note a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: #cfcfd3;
    text-underline-offset: 3px;
}

.note a:hover {
    text-decoration-color: var(--ink);
}

.note ul,
.note ol {
    font-family: var(--serif);
    margin: 0 0 1.5rem 1.5rem;
    color: var(--ink-soft);
    line-height: 1.75;
    font-size: 1.2rem;
}

.note li {
    margin-bottom: 0.5rem;
}

.note code {
    font-family: ui-monospace, 'SF Mono', 'Menlo', monospace;
    font-size: 0.88em;
    background-color: rgba(0, 0, 0, 0.045);
    padding: 0.15em 0.42em;
    border-radius: 6px;
}

.note pre {
    background: #fafafa;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.note pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--ink);
}

.note blockquote {
    border-left: 2px solid #d8d8dd;
    padding-left: 1.5rem;
    margin: 0 0 1.5rem 0;
    color: var(--ink-faint);
    font-style: italic;
}

.note blockquote p {
    color: var(--ink-faint);
}

@media (max-width: 600px) {
    body {
        padding: 1.5rem;
    }
    .notes-top {
        margin-bottom: 3rem;
    }
    .notes-hero {
        margin-bottom: 3rem;
    }
    .notes-search-key {
        display: none;
    }
    .note-entry {
        grid-template-columns: 2rem 1fr;
        gap: 1rem;
    }
}
