/* ========================
   NOTES SECTION STYLES
   Shared by notes.html (list) and notes/<slug>.html (detail)
======================== */

:root {
    --divider-light: #E0E2EA;
    --divider-dark:  #4B5563;
}

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

body {
    font-family: 'Satoshi Variable', 'Satoshi', sans-serif;
    background: #ffffff;
    color: #0a1833;
    -webkit-font-smoothing: antialiased;
    padding-top: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Pushes the footer to the bottom of the screen on short pages */
#main-content {
    flex: 1 0 auto;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 9999;
    background: #0a1833;
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    border-radius: 4px;
}
.skip-link:focus { left: 8px; }

/* ========================
   NOTES LIST PAGE
======================== */
.notes-page {
    padding: 160px max(131px, calc((100% - 1178px) / 2)) 140px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.notes-page__header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notes-page__title {
    font-family: 'Satoshi Variable', 'Satoshi', sans-serif;
    font-weight: 700;
    font-size: 40px;
    color: #0a1833;
    line-height: normal;
}

.notes-page__subtitle {
    font-family: 'Satoshi Variable', 'Satoshi', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(10, 24, 51, 0.68);
    max-width: 640px;
}

.notes-list__tag {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a1833;
    background: #F3F4F6;
    border: none;
    border-radius: 0;
}

.notes-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.notes-list__item {
    border-bottom: 1px solid var(--divider-light);
}
.notes-list__item:first-child {
    border-top: 1px solid var(--divider-light);
}

.notes-list__link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px 0;
    text-decoration: none;
    color: inherit;
}

.notes-list__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.notes-list__title {
    font-family: 'Satoshi', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: #0a1833;
    line-height: normal;
}

.notes-list__tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.notes-list__date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: rgba(10, 24, 51, 0.68);
    white-space: nowrap;
}

/* ========================
   NOTE DETAIL PAGE
======================== */
.note {
    /* 720px content + 24px horizontal padding on each side (border-box) */
    max-width: 768px;
    margin: 0 auto;
    padding: 160px 24px 140px;
}

.note__back {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(10, 24, 51, 0.68);
    text-decoration: none;
    margin-bottom: 24px;
}
.note__back:hover { color: #0a1833; }

.note__title {
    font-family: 'Satoshi Variable', 'Satoshi', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #0a1833;
    margin-bottom: 20px;
}

.note__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--divider-light);
}

.note__date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: rgba(10, 24, 51, 0.68);
}

.note__tags {
    display: flex;
    gap: 8px;
    list-style: none;
    flex-wrap: wrap;
}

.note__tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0a1833;
    background: #F3F4F6;
    border: none;
    padding: 4px 10px;
}

/* ── Body prose ── */
.note__body {
    font-size: 18px;
    font-weight: 400;
    color: #0a1833;
    line-height: 1.75;
    padding: 40px 0;
}

.note__body h2 {
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 40px 0 16px;
}
.note__body h2:first-child { margin-top: 0; }

.note__body h3 {
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 700;
    line-height: 1.3;
    margin: 32px 0 12px;
}

.note__body p { margin: 0 0 20px; }
.note__body p:last-child { margin-bottom: 0; }

.note__body a { color: #3B82F6; font-weight: 500; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.note__body a:hover { text-decoration-thickness: 2px; }

.note__body ul, .note__body ol {
    margin: 0 0 20px;
    padding-left: 24px;
}
.note__body li { margin-bottom: 8px; }
.note__body li:last-child { margin-bottom: 0; }

.note__body img {
    width: 100%;
    height: auto;
    display: block;
    margin: 48px 0;
}

/* Breaks out of the (narrower) prose column, up to 1080px, while
   staying centered on the column's own center line — position:relative's
   left:50% resolves against the parent width, and translateX(-50%)
   resolves against the table's own (wider) width, so the two cancel
   out regardless of viewport size. */
.note__body table {
    display: block;
    overflow-x: auto;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: min(1080px, calc(100vw - 48px));
    max-width: 1080px;
    border-collapse: collapse;
    margin: 48px 0;
    font-size: 16px;
}

.note__body th, .note__body td {
    text-align: left;
    padding: 12px 16px;
    border: 1px solid var(--divider-light);
    vertical-align: top;
}

.note__body th {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    background: #F3F4F6;
}

.note__body pre {
    background: #F3F4F6;
    padding: 20px;
    overflow-x: auto;
    margin: 0 0 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.note__body code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9em;
    background: #F3F4F6;
    padding: 2px 6px;
}
.note__body pre code {
    background: none;
    padding: 0;
}

.note__body blockquote {
    border-left: 3px solid #0a1833;
    padding: 4px 0 4px 20px;
    margin: 0 0 20px;
    color: rgba(10, 24, 51, 0.68);
    font-style: italic;
}

/* ── Reactions ── */
.note-reactions {
    border-top: 1px solid var(--divider-light);
    padding-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.note-reactions__buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.note-reactions__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    background: none;
    border: 1px solid var(--divider-light);
    color: #0a1833;
    cursor: pointer;
    font-family: 'Satoshi', sans-serif;
    font-size: 14px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.note-reactions__btn:hover { background: #F3F4F6; }
.note-reactions__btn:active { transform: scale(0.96); }

.note-reactions__emoji { font-size: 18px; }

.note-reactions__count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: rgba(10, 24, 51, 0.68);
    min-width: 1.2em;
}

/* ── Focus-visible state ── */
.notes-list__link:focus-visible,
.note__back:focus-visible,
.note-reactions__btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ========================
   RESPONSIVE
======================== */
@media (max-width: 1140px) {
    .notes-page { padding: 140px 60px 100px; }
    .notes-page__title { font-size: 32px; }
    .note { padding: 140px 24px 100px; }
}

@media (max-width: 768px) {
    .notes-page { padding: 120px 24px 80px; gap: 32px; }
    .notes-page__title { font-size: 28px; }
    .notes-list__link { padding: 20px 0; }
    .note { padding: 120px 20px 80px; }
    .note-reactions__buttons { width: 100%; }
    .note-reactions__btn { flex: 1 1 auto; justify-content: center; }
}

/* ========================
   DARK MODE
======================== */
[data-theme="dark"] body { background: #0f131b; color: #ffffff; }

[data-theme="dark"] .notes-page__title,
[data-theme="dark"] .notes-list__title,
[data-theme="dark"] .note__title,
[data-theme="dark"] .note__body { color: #ffffff; }

[data-theme="dark"] .note-reactions__btn {
    color: #ffffff;
    border-color: var(--divider-dark);
}
[data-theme="dark"] .note-reactions__btn:hover { background: #1f2430; }

[data-theme="dark"] .notes-list__tag,
[data-theme="dark"] .note__tag {
    color: #ffffff;
    background: #1f2430;
}

[data-theme="dark"] .notes-list__item { border-color: var(--divider-dark); }
[data-theme="dark"] .notes-list__date,
[data-theme="dark"] .note__date,
[data-theme="dark"] .notes-page__subtitle,
[data-theme="dark"] .note-reactions__count { color: #9CA3AF; }

[data-theme="dark"] .note__back { color: #9CA3AF; }
[data-theme="dark"] .note__back:hover { color: #ffffff; }

[data-theme="dark"] .note__meta,
[data-theme="dark"] .note-reactions { border-color: var(--divider-dark); }

[data-theme="dark"] .note__body a { color: #60A5FA; }
[data-theme="dark"] .note__body pre,
[data-theme="dark"] .note__body code { background: #1f2430; }
[data-theme="dark"] .note__body blockquote { border-left-color: #ffffff; color: #9CA3AF; }
[data-theme="dark"] .note__body th,
[data-theme="dark"] .note__body td { border-color: var(--divider-dark); }
[data-theme="dark"] .note__body th { background: #1f2430; }
