/* Colourful study layout for concept notes (config site.styled_notes) — paired with public/js/note-style.js. */

.note-x {
  --nx-indigo: #5B5BEF; --nx-indigo-ink: #4338CA; --nx-indigo-soft: #EEF0FF;
  --nx-teal:   #0FB5A6; --nx-teal-ink:   #0F766E; --nx-teal-soft:   #E3F8F5;
  --nx-amber:  #F5A30B; --nx-amber-ink:  #A55A06; --nx-amber-soft:  #FFF4DD;
  --nx-rose:   #F0436A; --nx-rose-ink:   #BE123C; --nx-rose-soft:   #FFEBEF;
  --nx-sky:    #1BA3EA; --nx-sky-ink:    #0369A1; --nx-sky-soft:    #E4F4FD;
  --nx-violet: #9257F5; --nx-violet-ink: #6D28D9; --nx-violet-soft: #F3ECFF;
  --nx-lime:   #6DB80F; --nx-lime-ink:   #3F6B0B; --nx-lime-soft:   #EEF8DF;
  --nx-card: var(--surface);
  --nx-shadow: 0 1px 2px rgba(20, 20, 40, .05), 0 6px 20px -8px rgba(20, 20, 60, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .note-x {
    --nx-indigo-ink: #A5B4FC; --nx-indigo-soft: rgba(99, 102, 241, .14);
    --nx-teal-ink:   #5EEAD4; --nx-teal-soft:   rgba(20, 184, 166, .13);
    --nx-amber-ink:  #FCD34D; --nx-amber-soft:  rgba(245, 158, 11, .13);
    --nx-rose-ink:   #FDA4AF; --nx-rose-soft:   rgba(244, 63, 94, .13);
    --nx-sky-ink:    #7DD3FC; --nx-sky-soft:    rgba(14, 165, 233, .13);
    --nx-violet-ink: #C4B5FD; --nx-violet-soft: rgba(139, 92, 246, .14);
    --nx-lime-ink:   #BEF264; --nx-lime-soft:   rgba(132, 204, 22, .12);
    --nx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] .note-x {
  --nx-indigo-ink: #A5B4FC; --nx-indigo-soft: rgba(99, 102, 241, .14);
  --nx-teal-ink:   #5EEAD4; --nx-teal-soft:   rgba(20, 184, 166, .13);
  --nx-amber-ink:  #FCD34D; --nx-amber-soft:  rgba(245, 158, 11, .13);
  --nx-rose-ink:   #FDA4AF; --nx-rose-soft:   rgba(244, 63, 94, .13);
  --nx-sky-ink:    #7DD3FC; --nx-sky-soft:    rgba(14, 165, 233, .13);
  --nx-violet-ink: #C4B5FD; --nx-violet-soft: rgba(139, 92, 246, .14);
  --nx-lime-ink:   #BEF264; --nx-lime-soft:   rgba(132, 204, 22, .12);
  --nx-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
}

/* One colour set per section: --c (bright), --c-ink (text), --c-soft (tint). */
.note-x [data-hue="indigo"], .note-x { --c: var(--nx-indigo); --c-ink: var(--nx-indigo-ink); --c-soft: var(--nx-indigo-soft); }
.note-x [data-hue="teal"]   { --c: var(--nx-teal);   --c-ink: var(--nx-teal-ink);   --c-soft: var(--nx-teal-soft); }
.note-x [data-hue="amber"]  { --c: var(--nx-amber);  --c-ink: var(--nx-amber-ink);  --c-soft: var(--nx-amber-soft); }
.note-x [data-hue="rose"]   { --c: var(--nx-rose);   --c-ink: var(--nx-rose-ink);   --c-soft: var(--nx-rose-soft); }
.note-x [data-hue="sky"]    { --c: var(--nx-sky);    --c-ink: var(--nx-sky-ink);    --c-soft: var(--nx-sky-soft); }
.note-x [data-hue="violet"] { --c: var(--nx-violet); --c-ink: var(--nx-violet-ink); --c-soft: var(--nx-violet-soft); }
.note-x [data-hue="lime"]   { --c: var(--nx-lime);   --c-ink: var(--nx-lime-ink);   --c-soft: var(--nx-lime-soft); }

/* Reading rhythm */
.note-x { max-width: 740px !important; }
.note-x .contents > * + *, .note-x > * + * { margin-top: 1.05em; }
.note-x strong { color: var(--ink); }

/* ---------- On this page ---------- */
.note-x .nx-toc {
  border-radius: 16px; padding: 18px 20px 14px; margin-bottom: 8px;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--nx-indigo-soft), transparent 60%),
    radial-gradient(120% 140% at 100% 100%, var(--nx-teal-soft), transparent 60%),
    var(--nx-card);
  border: 1px solid var(--line);
}
.nx-toc-title, .nx-rail-toc .index-head h2 { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.nx-toc-title { margin-bottom: 8px; }
.note-x .nx-toc ul, .nx-rail-toc ul { list-style: none; margin: 0; padding: 0; }
.note-x .nx-toc ul ul, .nx-rail-toc ul ul { padding-left: 18px; }
.note-x .nx-toc > ul { columns: 2 220px; column-gap: 24px; }
.note-x .nx-toc li, .nx-rail-toc li { break-inside: avoid; }
.note-x .nx-toc a, .nx-rail-toc a {
  display: flex; align-items: center; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 15px; line-height: 1.35;
}
.note-x .nx-toc a::before, .nx-rail-toc a::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--line-strong));
}
.note-x .nx-toc ul ul a::before, .nx-rail-toc ul ul a::before { width: 6px; height: 6px; opacity: .6; }
.note-x .nx-toc a:hover, .nx-rail-toc a:hover { background: var(--c-soft); }
.nx-rail-toc a.is-here, .note-x .nx-toc a.is-here { background: var(--c-soft); color: var(--c-ink); font-weight: 600; }
.nx-rail-toc [data-hue="indigo"] { --c: #5B5BEF; } .nx-rail-toc [data-hue="teal"] { --c: #0FB5A6; } .nx-rail-toc [data-hue="amber"] { --c: #F5A30B; }
.nx-rail-toc [data-hue="rose"] { --c: #F0436A; } .nx-rail-toc [data-hue="sky"] { --c: #1BA3EA; } .nx-rail-toc [data-hue="violet"] { --c: #9257F5; } .nx-rail-toc [data-hue="lime"] { --c: #6DB80F; }
.nx-rail-toc a { --c-soft: var(--sunk); font-size: 14px; }
.nx-rail-toc a.is-here { color: var(--ink); }
.nx-rail-toc .index-head { margin-bottom: 8px; }
@media (max-width: 1000px) { .nx-rail-toc { display: none; } }
@media (min-width: 1001px) { .note-x .nx-toc { display: none; } }

/* ---------- Section headings ---------- */
.note-x .nx-h1 {
  display: flex; align-items: center; gap: 14px; margin-top: 2.6em !important; padding-bottom: 12px;
  font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; color: var(--ink);
  border-bottom: 2px solid var(--c-soft); scroll-margin-top: 80px;
}
.note-x .nx-h1 .nx-num {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font-family: var(--mono); font-size: 16px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 72%, #000));
  box-shadow: 0 6px 16px -6px var(--c);
}
.note-x .nx-h2 {
  display: flex; align-items: baseline; gap: 10px; margin-top: 2em !important;
  font-size: 20px; font-weight: 600; color: var(--c-ink); scroll-margin-top: 80px;
}
.note-x .nx-h2 .nx-num { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--c-ink); background: var(--c-soft); border-radius: 6px; padding: 2px 7px; }
.note-x .fvp span[id] { scroll-margin-top: 80px; }
.note-x .nx-h1 + * { margin-top: 1.1em; }

/* ---------- Example cards ---------- */
.note-x .nx-ex {
  position: relative; margin: 1.6em 0 !important; border-radius: 16px; overflow: hidden;
  background: var(--nx-card); border: 1px solid var(--line); box-shadow: var(--nx-shadow);
}
.note-x .nx-ex::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c); }
.nx-ex-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 0 24px; }
.nx-ex-tag { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink); background: var(--c-soft); border-radius: 999px; padding: 4px 11px; }
.nx-ex-hint { font-size: 13px; color: var(--ink-3); }
.note-x .nx-ex.is-open .nx-ex-hint { visibility: hidden; }
.nx-ex-q { padding: 10px 20px 4px 24px; font-size: 17.5px; font-weight: 500; }
.nx-ex-q > * + * { margin-top: .6em; }
.nx-ex-foot { padding: 10px 20px 16px 24px; }
.nx-reveal {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 var(--sans); color: var(--c-ink); background: var(--c-soft); border: 1px solid transparent;
  transition: background .15s, transform .15s;
}
.nx-reveal::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.is-open .nx-reveal::after { transform: translateY(2px) rotate(-135deg); }
.nx-reveal:hover { border-color: var(--c); }
.nx-reveal:active { transform: scale(.97); }
.nx-reveal:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.nx-ex-sol { margin: 0 14px 14px; padding: 14px 16px 16px; border-radius: 12px; background: var(--c-soft); animation: nx-in .25s ease-out; }
.nx-ex-sol > * + * { margin-top: .7em; }
.nx-sol-label { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink); }
@keyframes nx-in { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Callouts ---------- */
.note-x .nx-call {
  margin: 1.6em 0 !important; padding: 16px 20px 16px 20px; border-radius: 16px;
  background: var(--c-soft); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.note-x .nx-call-tag {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink);
}
.note-x .nx-call-tag::before { content: ""; width: 18px; height: 18px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--c) 60%, #fff); }
.note-x .nx-call ul { margin: 0; padding-left: 0; list-style: none; }
.note-x .nx-call li { position: relative; padding-left: 22px; }
.note-x .nx-call li + li { margin-top: .55em; }
.note-x .nx-call li::before { content: ""; position: absolute; left: 4px; top: .7em; width: 7px; height: 7px; border-radius: 2px; background: var(--c); transform: rotate(45deg); }
.note-x .nx-call li p { margin: 0; }
.note-x .nx-call [style*="margin-left"] { margin-left: 22px !important; }
/* "IMPORTANT RESULTS" style boxes: rules read like a formula list */
.note-x .nx-call-key { background: var(--nx-card); border: 1px solid var(--line); box-shadow: var(--nx-shadow); border-top: 4px solid var(--c); }
.note-x .nx-call-key li { padding: 9px 0 9px 22px; }
.note-x .nx-call-key li + li { margin-top: 0; border-top: 1px dashed var(--line); }
.note-x .nx-call-key li::before { top: 1.2em; }

/* ---------- Maths + body ---------- */
.note-x .nx-math { display: inline-block; max-width: 100%; overflow-x: auto; vertical-align: middle; padding: 2px 0; }
.note-x math { font-size: 1.08em; }
.note-x > ul li + li, .note-x .contents > ul li + li { margin-top: .4em; }
.note-x > ul li::marker, .note-x .contents > ul li::marker { color: var(--c); }

@media (max-width: 640px) {
  .note-x .nx-h1 { font-size: 23px; gap: 12px; }
  .note-x .nx-h1 .nx-num { width: 38px; height: 38px; font-size: 14px; border-radius: 10px; }
  .nx-ex-head { padding: 12px 14px 0 18px; }
  .nx-ex-q { padding: 8px 14px 2px 18px; font-size: 16.5px; }
  .nx-ex-foot { padding: 8px 14px 14px 18px; }
  .nx-ex-sol { margin: 0 8px 8px; padding: 12px; }
  .nx-ex-hint { display: none; }
  .note-x .nx-call { padding: 14px 14px; }
}
@media (prefers-reduced-motion: reduce) { .nx-ex-sol { animation: none; } .nx-reveal, .nx-reveal::after { transition: none; } }

/* Print: show everything, no colour blocks. */
@media print {
  .note-x .nx-ex-sol[hidden] { display: block !important; }
  .nx-ex-foot, .nx-ex-hint, .nx-toc { display: none !important; }
  .note-x .nx-ex, .note-x .nx-call { box-shadow: none; break-inside: avoid; }
}

/* Anchors inside headings take no space; the first section needs no extra gap under the title. */
.note-x .fvp > span[id] { position: absolute; }
.note-x .nx-h1, .note-x .nx-h2 { position: relative; }
.note-x .contents > .nx-h1:first-child, .note-x .nx-toc + .contents > .nx-h1:first-child { margin-top: .4em !important; }
.note-x .nx-h2 + * { margin-top: .7em; }

/* Deeper sub-headings (theory_h3/h4) */
.note-x .nx-h3 { margin-top: 1.6em !important; font-size: 17px; font-weight: 600; color: var(--c-ink); scroll-margin-top: 80px; }

/* Past-year questions on this chapter (after the note) */
.note-pyqs { margin-top: 28px; max-width: 740px; }
.note-pyqs h2 { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.note-pyqs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.note-pyqs a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.note-pyqs a:hover { border-color: var(--ink); }
.note-pyqs li span { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-left: 4px; }
