/* ===== Foundation ===== */
:root {
  --ink: #15171C;
  --midnight: #18263E;
  --paper: #FCFAF5;
  --white: #FFFFFF;
  --gold: #E2A028;
  --gold-text: #B8800F;
  --meta: #5E6A7D;
  --sub: #2E3A4F;
  --line: rgba(21, 23, 28, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--white); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.lnk { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgba(122, 135, 155, 0.5); }
.lnk:hover, .lnk:focus-visible { text-decoration-color: var(--gold); }

/* ===== Shell and sidebar ===== */
.page { display: flex; min-height: 100vh; }
.nav-wrap { flex: 0 0 auto; position: sticky; top: 0; height: 100vh; width: 232px; overflow: hidden; transition: width .28s ease, visibility .28s; }
.page.nav-collapsed .nav-wrap { width: 0; visibility: hidden; }
.nav { width: 232px; height: 100%; padding: 28px 24px 40px 32px; display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--line); overflow-y: auto; }

.nav-top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-right: -14px; }
.avatar-link { position: relative; display: block; border-radius: 50%; line-height: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 1px var(--gold); transition: box-shadow .2s ease; }
.avatar-link::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--gold); mix-blend-mode: color; opacity: 0; transition: opacity .2s ease; }
.avatar-link:hover::after { opacity: 1; }
.avatar-link:hover .avatar { box-shadow: 0 0 0 1.5px var(--gold); }
.nav-collapse { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; cursor: pointer; color: var(--ink); transition: color .15s ease; }
.nav-collapse:hover, .nav-collapse:focus-visible { color: var(--gold); }

.nav-list { margin: 52px -8px 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.nav-row { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 8px; border-radius: 7px; transition: background-color .15s ease; }
.nav-row svg { flex: none; }
.nav-row:hover { background-color: rgba(21, 23, 28, 0.05); }
.nav-row.is-current { background-color: rgba(226, 160, 40, 0.22); }
.nav-label { font-size: 12px; color: #7A8394; padding: 14px 8px 4px; }
.nav-foot { margin-top: auto; padding-top: 48px; font-size: 14px; color: var(--meta); }

.main { position: relative; flex: 1 1 auto; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; padding: 96px 64px 40px 84px; }
.content { max-width: 680px; }
.site-foot { margin-top: auto; padding-top: 88px; height: 118px; display: flex; align-items: center; font-size: 13px; color: var(--meta); }

/* Desktop "› Menu" reopen button (added by the script) */
.nav-open { position: absolute; top: 28px; left: 20px; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; background: none; border: 0; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; opacity: 0; visibility: hidden; transition: opacity .2s ease .12s, visibility .2s, color .15s ease; }
.page.nav-collapsed .nav-open { opacity: 1; visibility: visible; }
.nav-open:hover { color: var(--gold); }
.no-anim, .no-anim * { transition: none !important; }

.gold-l { color: var(--gold); }

/* ===== Home ===== */
.home-title { font-size: 56px; line-height: 1.02; font-weight: 700; letter-spacing: -0.025em; color: var(--midnight); }
.home-tagline { margin-top: 20px; font-size: 19px; line-height: 1.5; font-weight: 450; color: var(--sub); }
.section-label { margin: 0 0 8px; font-size: 14px; font-weight: 400; line-height: 1.4; color: #7A8394; }
.note-list + .section-label { margin-top: 36px; }

/* ===== Note cards (home and folders) ===== */
.notes { margin-top: 68px; }
.note-list { display: flex; flex-direction: column; }
.card { display: flex; flex-direction: column; gap: 5px; padding: 18px 0; border-top: 1px solid var(--line); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 650; letter-spacing: -0.01em; color: var(--midnight); transition: color .15s ease; }
.card:hover .card-title { color: var(--gold); }
.card-meta { font-size: 16px; line-height: 1.45; color: var(--meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-date { color: var(--ink); }
.card-sep { margin: 0 0.3em; }
.card-folder { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--meta); }

/* ===== Folder pages ===== */
.folder-title { font-size: 48px; line-height: 1.05; font-weight: 700; letter-spacing: -0.025em; color: var(--midnight); }
.folder-sub { margin-top: 14px; font-size: 19px; line-height: 1.5; font-weight: 450; color: var(--sub); }
.folder-title ~ .notes { margin-top: 48px; }

/* ===== Note pages ===== */
.note-back { display: none; }
.note-back svg { display: block; }
.note-back span { line-height: 1; }
.note-title, .note-byline, .note-body { max-width: 680px; }
.note-title { font-size: 32px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.note-byline { margin-top: 6px; margin-bottom: 44px; font-size: 17px; line-height: 1.45; color: var(--ink); }
.note-body { font-size: 17px; line-height: 1.45; color: var(--ink); }
.note-body p { margin: 0 0 26px; }
.note-body > *:last-child { margin-bottom: 0; }
.note-body a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgba(122, 135, 155, 0.5); transition: text-decoration-color .15s ease; }
.note-body a:hover, .note-body a:focus-visible { text-decoration-color: var(--gold); }

/* ===== Mobile ===== */
.m-bar, .m-scrim { display: none; }

@media (max-width: 767px) {
  /* Top bar */
  .m-bar { display: flex; position: sticky; top: 0; z-index: 5; height: 60px; padding: 0 20px; align-items: center; justify-content: space-between; background: var(--white); border-bottom: 1px solid var(--line); }
  .m-bar .avatar { width: 36px; height: 36px; }
  .m-menu { background: none; border: 0; padding: 0; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--gold); }

  /* Slide-out panel */
  .page { display: block; }
  .nav-wrap, .page.nav-collapsed .nav-wrap { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh; width: 280px; z-index: 11; visibility: visible; transform: translateX(-101%); transition: transform .25s ease; }
  .m-open .nav-wrap, .m-open .page.nav-collapsed .nav-wrap { transform: translateX(0); }
  .nav { width: 280px; background: var(--white); padding: 8px 24px calc(40px + env(safe-area-inset-bottom)) 28px; }
  .nav .avatar { width: 36px; height: 36px; }
  .nav-list { margin-top: 36px; font-size: 17px; }
  .nav-row { min-height: 42px; gap: 10px; }
  .nav-label { font-size: 13px; }
  .nav-foot { font-size: 15px; }
  .nav-foot .lnk { text-decoration-color: var(--gold); }
  .m-scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(21, 23, 28, 0.25); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s; }
  .m-open .m-scrim { opacity: 1; visibility: visible; }
  .nav-open { display: none; }

  /* Home */
  .main { min-height: calc(100vh - 60px); padding: 48px 20px 32px; }
  .home-title { font-size: 38px; line-height: 1.05; }
  .home-tagline { margin-top: 16px; font-size: 17px; }
  .section-label { font-size: 13px; }
  .note-list + .section-label { margin-top: 30px; }

  /* Note cards */
  .notes { margin-top: 42px; }
  .card { padding: 15px 0; gap: 4px; }
  .card-title { font-size: 19px; }
  .card-meta { font-size: 15px; }
  .card-folder { font-size: 13px; }

  /* Folder pages */
  .folder-title { font-size: 34px; line-height: 1.08; }
  .folder-sub { margin-top: 12px; font-size: 17px; }
  .folder-title ~ .notes { margin-top: 32px; }

  /* Note pages */
  .note-back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 22px -6px; font-size: 17px; color: var(--gold-text); }
  .note-title { font-size: 26px; }
  .note-byline { margin-top: 5px; margin-bottom: 40px; font-size: 16px; }
  .note-body { font-size: 16px; }
  .note-body p { margin-bottom: 23px; }
  .note-body a { text-decoration-color: var(--gold); }

  .site-foot { padding-top: 48px; height: auto; }
}
