/* ==========================================================================
   Field Notes: list page and article pages (loaded after style.css)
   ========================================================================== */

.notes-page .nav { background: rgba(10, 10, 10, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); }
.notes, .fnote { padding: calc(var(--nav-h) + clamp(40px, 7vw, 80px)) 0 clamp(60px, 9vw, 110px); }

/* --- List page ------------------------------------------------------------ */
.notes__head { max-width: 820px; margin-bottom: clamp(36px, 6vw, 60px); }
.notes__head h1 { font-size: clamp(2.6rem, 7vw, 4.4rem); font-weight: 600; margin-bottom: 18px; }
.notes__list { display: grid; gap: 18px; }
@media (min-width: 860px) { .notes__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.note-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color 0.25s, transform 0.35s var(--ease); }
.note-card:hover { border-color: rgba(255, 107, 0, 0.5); transform: translateY(-4px); }
.note-card__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--dim); font-size: 0.74rem; margin: 0; }
.note-card__title { font-size: clamp(1.35rem, 3vw, 1.7rem); line-height: 1.2; }
.note-card:hover .note-card__title { color: var(--orange); }
.note-card__summary { color: #cfcfcf; margin: 0; line-height: 1.65; }
.note-card__go { color: var(--orange); font-size: 0.8rem; margin-top: auto; padding-top: 6px; }

/* --- Shared --------------------------------------------------------------- */
.note__tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.note__tags li { font-size: 0.7rem; letter-spacing: 0.04em; color: var(--orange); background: var(--orange-soft); border: 1px solid rgba(255, 107, 0, 0.25); border-radius: 999px; padding: 3px 10px; }

/* --- Article header --------------------------------------------------------- */
.note__head { max-width: 860px; margin-bottom: clamp(32px, 5vw, 56px); }
.note__back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.8rem; margin-bottom: 22px; }
.note__back:hover { color: var(--orange); }
.note__title { font-size: clamp(2.1rem, 5.6vw, 3.6rem); font-weight: 600; line-height: 1.08; margin-bottom: 18px; }
.note__meta { display: flex; flex-wrap: wrap; gap: 6px 0; color: var(--dim); font-size: 0.78rem; margin: 0 0 16px; }
.note__meta span + span::before { content: "·"; margin: 0 10px; color: var(--line-strong); }
.note__meta span:first-child { color: var(--muted); }
.note__lede { font-size: clamp(1.08rem, 2.2vw, 1.25rem); line-height: 1.7; color: #d8d8d8; margin: 26px 0 0; padding-left: 18px; border-left: 2px solid var(--orange); }

/* --- Layout with contents ---------------------------------------------------- */
.note__layout { display: grid; gap: 40px; }
.note__toc { display: none; }
@media (min-width: 1100px) {
  .note__layout { grid-template-columns: 230px minmax(0, 1fr); gap: 56px; align-items: start; }
  .note__toc { display: block; position: sticky; top: calc(var(--nav-h) + 28px); max-height: calc(100vh - var(--nav-h) - 56px); overflow: auto; }
}
.note__toc > p { color: var(--orange); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 12px; }
.note__toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.note__toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--dim); text-decoration: none; font-size: 0.84rem; line-height: 1.4; transition: color 0.2s, border-color 0.2s; }
.note__toc a:hover { color: var(--text); }
.note__toc a.is-active { color: var(--text); border-left-color: var(--orange); }

/* --- Article body -------------------------------------------------------------- */
.note__body { max-width: 820px; min-width: 0; font-size: 1.04rem; line-height: 1.8; color: #d6d6d6; }
.note__body h2 { font-size: clamp(1.55rem, 3.6vw, 2.1rem); line-height: 1.2; color: var(--text); margin: 3.2rem 0 1.1rem; scroll-margin-top: calc(var(--nav-h) + 20px); }
.note__body h2::before { content: "## "; font-family: var(--font-mono); font-size: 0.6em; color: var(--orange); vertical-align: 0.2em; }
.note__body h2:first-child { margin-top: 0; }
.note__body h3 { font-size: 1.25rem; color: var(--text); margin: 2.2rem 0 0.8rem; }
.note__body p { margin: 0 0 1.15rem; }
.note__body strong { color: #fff; font-weight: 600; }
.note__body a { color: var(--orange); text-decoration: underline; text-decoration-color: rgba(255, 107, 0, 0.4); text-underline-offset: 3px; }
.note__body a:hover { text-decoration-color: var(--orange); }
.note__body ul, .note__body ol { margin: 0 0 1.3rem; padding-left: 1.6rem; }
.note__body ul { list-style: disc; }
.note__body ol { list-style: decimal; }
.note__body li { margin-bottom: 0.55rem; padding-left: 0.3rem; }
.note__body li::marker { color: var(--orange); }
.note__body ol li::marker { font-family: var(--font-mono); font-size: 0.9em; }
.note__body :not(pre) > code { font-family: var(--font-mono); font-size: 0.86em; color: #ffb36b; background: rgba(255, 107, 0, 0.08); border: 1px solid rgba(255, 107, 0, 0.16); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.note__body .note-disclaimer { margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }

/* tables */
.note-table { overflow-x: auto; margin: 1.6rem 0 2rem; border: 1px solid var(--line); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
.note-table table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 0.9rem; line-height: 1.55; }
.note-table th { text-align: center; vertical-align: bottom; background: var(--surface-2); color: var(--orange); font: 500 0.74rem var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--line-strong); }
.note-table th strong { color: inherit; font-weight: 500; }
.note-table td { vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.note-table tr:last-child td { border-bottom: 0; }
.note-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
.note-table td:first-child { color: var(--text); font-weight: 500; }
.note-table code { white-space: normal !important; }

/* code blocks */
.note-code { margin: 0.6rem 0 1.6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #0e0e0e; overflow: hidden; }
.note-code__bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.note-code__bar i { width: 9px; height: 9px; border-radius: 50%; background: #333; }
.note-code__bar i:first-child { background: var(--orange); }
.note-code__bar span { margin-left: 8px; font: 500 0.78rem var(--font-mono); color: var(--muted); }
.note-code__copy { margin-left: auto; background: none; border: 1px solid var(--line-strong); color: var(--muted); border-radius: 6px; padding: 3px 10px; font: 0.72rem var(--font-mono); cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.note-code__copy:hover, .note-code__copy.is-done { color: var(--orange); border-color: var(--orange); }
.note-code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 0.84rem/1.7 var(--font-mono); color: #e6e6e6; }
.note-code pre code { font: inherit; background: none; border: 0; padding: 0; }

/* figures: the diagrams are drawn on white, shown as bright panels */
.note-fig { margin: 1.8rem 0 2rem; }
.note-fig__zoom { display: block; width: 100%; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; overflow: hidden; cursor: zoom-in; transition: box-shadow 0.3s, border-color 0.3s; }
.note-fig__zoom:hover { border-color: rgba(255, 107, 0, 0.6); box-shadow: 0 20px 60px -30px var(--orange-glow); }
.note-fig img { display: block; width: 100%; height: auto; }
.note-fig figcaption { margin-top: 10px; color: var(--muted); font: 0.78rem/1.5 var(--font-mono); text-align: center; }

/* enlarged diagram */
.note-lightbox { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(5, 5, 5, 0.92); cursor: zoom-out; }
.note-lightbox[hidden] { display: none; }
.note-lightbox img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 8px; }
.note-lightbox__close { position: absolute; top: 14px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 1.4rem; cursor: pointer; }
@media (max-width: 719px) { .note-lightbox { overflow: auto; place-items: start; } .note-lightbox img { max-width: none; width: 200vw; max-height: none; } }

/* end of article */
.note__end { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
@media (min-width: 1100px) { .note__end { margin-left: 286px; } }

/* body text justified (tables, code boxes and captions keep their own alignment) */
.note__body > p, .note__body li { text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto; }

/* share + print */
.note-share { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.note-share > p { color: var(--orange); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; margin: 0 0 14px; }
.note-share__row { display: flex; flex-wrap: wrap; gap: 10px; }
.note-share__btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.02); color: var(--text); font: 500 0.86rem var(--font-body); text-decoration: none; cursor: pointer; transition: border-color 0.2s, color 0.2s; }
.note-share__btn:hover, .note-share__btn.is-done { border-color: var(--orange); color: var(--orange); }
.note-share__btn[hidden] { display: none; }
.note-share__btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.note-share__btn svg.f, .note-share__btn svg .f { fill: currentColor; stroke: none; }
.note__end { margin-top: 32px; padding-top: 0; border-top: 0; }
@media (min-width: 1100px) { .note-share { margin-left: 286px; } }

/* printing / saving as PDF: clean black on white */
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff !important; color: #111 !important; }
  .nav, .scroll-progress, .skip-link, .note__toc, .note-share, .note__end, .footer, .note-lightbox, .note__back, .note-code__copy { display: none !important; }
  .fnote { padding: 0 !important; }
  .note__layout { display: block; }
  .note__title, .note__body h2, .note__body h3, .note__body strong { color: #000 !important; }
  .note__meta, .note__meta span:first-child { color: #555 !important; }
  .note__tags li { color: #b34a00 !important; background: none !important; border-color: #e0a070 !important; }
  .note__body { color: #222 !important; font-size: 10.5pt; max-width: none; }
  .note__body h2 { break-after: avoid; }
  .note__body a { color: #b34a00 !important; }
  .note__body :not(pre) > code { color: #8a3a00 !important; background: #fff4ec !important; border-color: #f0c9a8 !important; }
  .note-code { background: #f6f6f6 !important; border-color: #ccc !important; break-inside: avoid; }
  .note-code__bar { background: #eee !important; border-color: #ccc !important; }
  .note-code pre { color: #111 !important; white-space: pre-wrap; overflow: visible; }
  .note-table { overflow: visible; border-color: #ccc !important; }
  .note-table table { min-width: 0; }
  .note-table th { background: #f1f1f1 !important; color: #b34a00 !important; border-color: #ccc !important; }
  .note-table td { border-color: #ddd !important; background: none !important; }
  .note-table td:first-child { color: #000 !important; }
  .note-table tr, .note-fig { break-inside: avoid; }
  .note-fig__zoom { border-color: #ccc !important; box-shadow: none !important; }
  .note-fig figcaption, .note__body .note-disclaimer { color: #555 !important; }
}

/* subtitle under the article title */
.note__deck { font-size: clamp(1.08rem, 2.2vw, 1.25rem); line-height: 1.6; color: var(--muted); max-width: 820px; margin: -4px 0 20px; }

/* sub-sub headings */
.note__body h4 { font-size: 1.08rem; color: var(--text); margin: 1.8rem 0 0.6rem; }

/* Key idea / Note / Tip / Watch out boxes */
.note-callout { margin: 1.6rem 0 1.8rem; padding: 16px 20px; border-radius: var(--radius-sm); border: 1px solid rgba(255, 107, 0, 0.28); border-left: 3px solid var(--orange); background: rgba(255, 107, 0, 0.06); }
.note-callout p { margin: 0 0 0.6rem; text-align: left !important; }
.note-callout p:last-child { margin-bottom: 0; }
.note-callout > p:first-child > strong:first-child { color: var(--orange); }
.note-callout--watch-out, .note-callout--warning, .note-callout--caution { border-color: rgba(255, 92, 92, 0.3); border-left-color: #ff5c5c; background: rgba(255, 92, 92, 0.06); }
.note-callout--watch-out > p:first-child > strong:first-child, .note-callout--warning > p:first-child > strong:first-child, .note-callout--caution > p:first-child > strong:first-child { color: #ff7a7a; }
.note-callout--tip { border-color: rgba(61, 220, 132, 0.28); border-left-color: #3ddc84; background: rgba(61, 220, 132, 0.05); }
.note-callout--tip > p:first-child > strong:first-child { color: #3ddc84; }

/* list page: topic filter */
.notes__filter { display: flex; flex-wrap: wrap; gap: 8px; margin: -16px 0 28px; }
.notes__filter button { font: 500 0.74rem var(--font-mono); letter-spacing: 0.04em; color: var(--muted); background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 13px; cursor: pointer; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.notes__filter button:hover { color: var(--text); border-color: var(--orange); }
.notes__filter button.is-on { color: #0a0a0a; background: var(--orange); border-color: var(--orange); }
.note-card[hidden] { display: none; }

@media print {
  .note__deck { color: #444 !important; }
  .note-callout { background: #fff7f0 !important; border-color: #f0c9a8 !important; break-inside: avoid; }
  .note-callout--watch-out, .note-callout--warning, .note-callout--caution { background: #fff2f2 !important; border-color: #f2b8b8 !important; }
  .note-callout--tip { background: #f0fbf4 !important; border-color: #b6e6c8 !important; }
  .note-callout, .note-callout p { color: #222 !important; }
  .note__body h4 { color: #000 !important; }
}

/* long web addresses and commands wrap instead of widening the page */
.note__body a, .note__body p, .note__body li { overflow-wrap: anywhere; }
.note__body :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
