/* Annotations (assets/annotate.js): section tools beside headings, highlights, note cards, the selection menu and the
   notebook page. Everything else comes from the course palette. The highlight tint is the one token here: a course sets
   --annot-hl in its own palette block (Learn Color Design maps it to its --mark); otherwise the default below applies. */
:root{--annot-hl-default:#fbefb0}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--annot-hl-default:#5e4f1c}}
:root[data-theme="dark"]{--annot-hl-default:#5e4f1c}

[hidden].annot-ui,.annot-ui[hidden]{display:none!important}

/* Highlights: text and links keep their own color; a noted highlight carries a dotted underline as well */
mark.annot-hl{background:var(--annot-hl,var(--annot-hl-default));color:inherit;padding:.06em 0;border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
mark.annot-hl.noted{text-decoration:underline dotted;text-decoration-thickness:1px;text-underline-offset:3px}
.annot-pin{font:inherit;font-size:.72rem;line-height:1;color:var(--brass);background:var(--card);border:1px solid var(--line);border-radius:999px;width:1.5rem;height:1.5rem;padding:0;margin:0 .15rem;vertical-align:middle;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.annot-pin:hover{border-color:var(--brass)}
.annot-flash{outline:3px solid var(--brass);outline-offset:3px;animation:annot-flash 2s ease-out 1 forwards}
@keyframes annot-flash{0%{outline-color:var(--brass)}70%{outline-color:var(--brass)}100%{outline-color:transparent}}
@media (prefers-reduced-motion: reduce){.annot-flash{animation:none}}
h2,h3,mark.annot-hl,.annot-card{scroll-margin-top:1rem}

/* Section tools: a flag (bookmark), Note, and a § link, at the right end of the heading */
.annot-h{display:flex;align-items:baseline;gap:.6rem;flex-wrap:wrap}
.annot-h .annot-ht{flex:1 1 auto;min-width:0}
.annot-ctl{display:inline-flex;gap:.1rem;align-items:center;flex:none;margin-left:auto;font-family:"Inter",system-ui,sans-serif;font-size:.72rem;font-weight:500;letter-spacing:.02em;text-transform:none}
.annot-ctl button,.annot-ctl a{font:inherit;color:var(--muted);background:none;border:0;border-radius:6px;padding:.3rem .4rem;min-height:32px;min-width:32px;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;cursor:pointer;text-decoration:none;line-height:1}
.annot-ctl button:hover,.annot-ctl a:hover{color:var(--ink);background:var(--tip-bg)}
.annot-ctl svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linejoin:round}
.annot-ctl .annot-bm[aria-pressed="true"]{color:var(--brass)}
.annot-ctl .annot-bm[aria-pressed="true"] svg{fill:currentColor}
.annot-ctl .annot-link{font-family:"Cormorant Garamond",Georgia,serif;font-size:1rem}

/* Selection menu */
.annot-menu{position:absolute;z-index:60;display:flex;gap:.1rem;background:var(--card);border:1px solid var(--line);border-radius:999px;padding:.2rem;box-shadow:var(--shadow)}
.annot-menu button{font:inherit;font-size:.85rem;padding:.45rem .8rem;border:0;border-radius:999px;background:none;color:var(--ink);cursor:pointer;min-height:36px}
.annot-menu button:hover{background:var(--tip-bg)}
.annot-menu .annot-reattach{color:var(--brass);font-weight:600}

/* Note cards on the page, and the notebook entries */
.annot-card{border:1px solid var(--line);border-left:3px solid var(--brass);border-radius:0 8px 8px 0;background:var(--card);padding:.6rem .9rem .5rem;margin:.6rem 0 .9rem;font-size:.92rem}
li>.annot-card,td>.annot-card{margin:.5rem 0 .3rem}
.annot-card-head,.annot-entry-head{display:flex;gap:.6rem;align-items:baseline;flex-wrap:wrap;margin-bottom:.2rem}
.annot-tag{font-family:"Inter",system-ui,sans-serif;font-size:.68rem;letter-spacing:.12em;text-transform:uppercase;font-weight:700;color:var(--brass)}
.annot-when{font-size:.78rem;color:var(--muted);margin-left:auto}
.annot-quote{margin:.3rem 0 .5rem;padding:.1rem 0 .1rem .8rem;border-left:3px solid var(--annot-hl,var(--annot-hl-default));font-family:"Cormorant Garamond",Georgia,serif;font-size:1.06rem;line-height:1.45;color:var(--ink2)}
.annot-text{white-space:pre-wrap;margin:.2rem 0 .4rem;color:var(--ink)}
.annot-label{display:block;font-size:.8rem;color:var(--ink2);margin:.3rem 0 .25rem}
.annot-ta{width:100%;min-height:4.2rem;padding:.5rem .6rem;border:1px solid var(--line);border-radius:8px;background:var(--bg2);color:var(--ink);font:inherit;font-size:.95rem;resize:vertical}
.annot-actions{display:flex;gap:.4rem;flex-wrap:wrap;align-items:center;margin-top:.4rem}
.annot-btn{font:inherit;font-size:.8rem;padding:.35rem .7rem;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--ink2);cursor:pointer;text-decoration:none;min-height:32px;display:inline-flex;align-items:center}
.annot-btn:hover{border-color:var(--accent);color:var(--ink)}
.annot-btn.primary{border-color:var(--accent);background:var(--accent);color:#fff}
.annot-status{font-size:.8rem;color:var(--muted);margin-left:.2rem}
.annot-lost{font-size:.88rem;color:var(--ink2);background:var(--warn-bg);border:1px solid var(--warn-line);border-radius:8px;padding:.5rem .7rem;margin:.4rem 0}
.annot-banner{position:sticky;top:.5rem;z-index:30;background:var(--warn-bg);border:1px solid var(--warn-line);border-radius:10px;padding:.7rem .9rem;margin:0 0 1rem;font-size:.92rem;display:flex;gap:.6rem;flex-wrap:wrap;align-items:center}
.annot-banner q{font-family:"Cormorant Garamond",Georgia,serif;font-size:1.02rem;color:var(--ink2)}

/* Toast with Undo */
.annot-toast{position:fixed;left:50%;bottom:64px;transform:translateX(-50%);z-index:70;max-width:min(92vw,46ch);display:flex;gap:.6rem;align-items:center;background:var(--ink);color:var(--bg);padding:.6rem .9rem;border-radius:10px;font-size:.88rem;box-shadow:var(--shadow)}
.annot-toast button{font:inherit;font-size:.85rem;font-weight:600;color:inherit;background:none;border:1px solid currentColor;border-radius:999px;padding:.25rem .7rem;cursor:pointer;min-height:32px}
.annot-toast .annot-toast-x{border:0;font-size:1.1rem;padding:.1rem .4rem}

/* Import dialog */
.annot-dialog{border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--ink);padding:1.2rem 1.4rem;max-width:min(92vw,52ch);box-shadow:var(--shadow)}
.annot-dialog::backdrop{background:rgba(0,0,0,.4)}
.annot-dialog h2{margin-top:0;border:0;padding:0;font-size:1.5rem}
.annot-dialog .annot-actions{margin-top:1rem}

/* Notebook page */
.annot-toolbar{align-items:center}
.annot-filters{display:inline-flex;gap:.25rem;flex-wrap:wrap}
.annot-filter{font:inherit;font-size:.82rem;padding:.4rem .8rem;border:1px solid var(--line);border-radius:999px;background:var(--card);color:var(--ink2);cursor:pointer;min-height:36px}
.annot-filter[aria-pressed="true"]{background:var(--accent);color:#fff;border-color:var(--accent);font-weight:600}
.annot-search{flex:1;min-width:200px;padding:.5rem .8rem;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink);font:inherit;font-size:.95rem}
.annot-nb h2{font-size:1.6rem}
.annot-nb h2 a,.annot-nb h3 a{text-decoration:none;color:inherit}
.annot-nb h2 a:hover,.annot-nb h3 a:hover{text-decoration:underline}
.annot-nb h3{font-size:1.2rem;margin-top:1.2rem}
.annot-entry{border-top:1px dashed var(--line);padding:.7rem 0 .6rem;font-size:.95rem}
.annot-entry[data-type="bookmark"] .annot-bm-line{margin:.1rem 0 .3rem;color:var(--ink2)}
.annot-entry .annot-open{font-size:.85rem}
.annot-empty{border:1px dashed var(--line);border-radius:10px;padding:1rem 1.2rem;margin:1rem 0;background:var(--card)}
.annot-empty ul{margin-bottom:.6rem}
.annot-print h3{margin-top:1.4rem}
.annot-print h4{margin-top:.9rem}
.annot-print .annot-entry{padding:.4rem 0}

@media (max-width: 900px){
  h2,h3,mark.annot-hl,.annot-card{scroll-margin-top:4.4rem}   /* the sticky topbar */
  .annot-banner{top:3.6rem}
  .annot-ctl .annot-ctl-t{display:none}
}
@media print{
  .annot-ctl,.annot-pin,.annot-menu,.annot-actions,.annot-toolbar,.annot-toast,.annot-banner,.annot-ta,.annot-label,.annot-status,.annot-open,.annot-dialog{display:none!important}
  mark.annot-hl{background:#e8e8e8;color:#000;-webkit-print-color-adjust:exact;print-color-adjust:exact;text-decoration:none}
  .annot-card,.annot-entry{break-inside:avoid;border-color:#999}
  .annot-card{border-left:3px solid #000}
  .annot-quote{border-left-color:#999;color:#000}
  .annot-tag{color:#000}
  .annot-h{display:block}
}
