/* Margin: tokens and the one component language (buttons, fields, keys, switches, menus,
   the calendar, toasts). Cool white paper, graphite ink, a blue pencil and a red pencil. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --canvas: #f4f6f9;
  --ink: #22252b;
  --ink-2: #5d636e;
  --ink-3: #6f7580;
  --rule: #e3e7ee;
  --rule-2: #cdd3dc;
  /* Blue pencil: a copy-editor's non-photo blue lead, deeper and slightly grey so it is not UI blue. */
  --blue: #2c5f9e;
  --blue-mark: #4a86c8;
  --blue-wash: color-mix(in srgb, #4a86c8 10%, var(--paper));
  --warn: #965a00;
  /* Hand-drawn pencil strokes (SVG), drawn slightly off-true like a real lead */
  --ul-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 5' preserveAspectRatio='none'%3E%3Cpath d='M0 3.2 C4 1.6 7 4.4 12 2.6 S19 3.8 24 2.4 S31 4.2 37 2.8 S46 3.6 52 3.2' fill='none' stroke='%234a86c8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  --ul-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 5' preserveAspectRatio='none'%3E%3Cpath d='M0 3.2 C4 1.6 7 4.4 12 2.6 S19 3.8 24 2.4 S31 4.2 37 2.8 S46 3.6 52 3.2' fill='none' stroke='%23e5420f' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  --ul-graphite: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2.6 C10 1.4 20 3.6 32 2.2 S50 3.2 64 2.4' fill='none' stroke='%238a909b' stroke-width='1.6' stroke-linecap='round' preserveAspectRatio='none'/%3E%3C/svg%3E");
  --ul-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2.6 C10 1.4 20 3.6 32 2.2 S50 3.2 64 2.4' fill='none' stroke='%23c07a10' stroke-width='1.6' stroke-linecap='round' preserveAspectRatio='none'/%3E%3C/svg%3E");
  --br-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 100' preserveAspectRatio='none'%3E%3Cpath d='M8 1.5 C4 2.5 1.8 3.5 2.4 9 C1.8 30 3 55 2.2 91 C2.6 96.5 4 97.5 8 98.5' fill='none' stroke='%234a86c8' stroke-width='1.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

  --red: #c8380b;
  --red-mark: #fb4712;
  --red-wash: color-mix(in srgb, #fb4712 8%, var(--paper));
  --highlight: #f4f19c;
  --selection: color-mix(in srgb, #e7e586 62%, transparent);
  --scrim: rgba(24, 28, 36, .18);
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --press: color-mix(in srgb, var(--ink) 10%, transparent);
  --material: color-mix(in srgb, var(--paper) 86%, transparent);
  --shadow-sm: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px -2px rgba(20, 30, 50, .08);
  --shadow: 0 0 0 1px rgba(20, 30, 50, .06), 0 4px 10px -2px rgba(20, 30, 50, .08), 0 18px 40px -12px rgba(20, 30, 50, .18);
  --shadow-lg: 0 0 0 1px rgba(20, 30, 50, .06), 0 8px 20px -6px rgba(20, 30, 50, .12), 0 32px 70px -20px rgba(20, 30, 50, .28);

  /* Notion's colors, for text the writer colors on purpose */
  --n-gray: #787774; --n-brown: #9f6b53; --n-orange: #d9730d; --n-yellow: #cb912f; --n-green: #448361;
  --n-blue: #337ea9; --n-purple: #9065b0; --n-pink: #c14c8a; --n-red: #d44c47;
  --nb-gray: #f1f1ef; --nb-brown: #f4eeee; --nb-orange: #fbecdd; --nb-yellow: #fbf3db; --nb-green: #edf3ec;
  --nb-blue: #e7f3f8; --nb-purple: #f6f3f9; --nb-pink: #f9f0f5; --nb-red: #fdebec;

  /* Type */
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Noto Sans TC", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif TC", "Songti TC", Georgia, "Times New Roman", serif;
  --font-type: "Courier Prime", "Courier New", "Noto Serif TC", monospace;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-write: var(--font-serif);
  --write-size: 20px;
  --write-leading: 1.6;
  --text-offset: 0px;
  --write: calc(var(--write-size) + var(--text-offset));

  /* Fibonacci spacing */
  --s1: 2px; --s2: 3px; --s3: 5px; --s4: 8px; --s5: 13px; --s6: 21px; --s7: 34px; --s8: 55px; --s9: 89px;
  /* Corners */
  --r-mark: 3px; --r-xs: 5px; --r-sm: 8px; --r: 13px; --r-lg: 21px;
  /* Chrome */
  --spine-h: 44px;
  --mw: 233px;     /* the margin */
  --mgap: 55px;    /* between the text and the margin */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Motion: one critically damped spring (response .32s) */
  --spring: cubic-bezier(.22, .8, .24, 1);
  --spring-t: 340ms;
  --pop-t: 170ms;   /* things that appear under the pointer: menus, the bar over a selection, tips */
  --fade-t: 160ms;
  --press-t: 70ms;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, .064, .198, .347, .487, .606, .703, .78, .838, .882, .915, .939, .956, .969, .978, .985, .989, .992, .995, .996, .997, .998, .999, .999, 1); }
}
:root[data-font="typewriter"] { --font-write: var(--font-type); --write-size: 18.5px; --write-leading: 1.65; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c1e22;
  --canvas: #15171a;
  --ink: #e4e6ea;
  --ink-2: #a8aeb8;
  --ink-3: #8b929e;
  --rule: #2d3036;
  --rule-2: #3d4148;
  --blue: #8db8ea;
  --blue-mark: #6a9fd8;
  --blue-wash: color-mix(in srgb, #6a9fd8 16%, var(--paper));
  --warn: #e3a553;
  --ul-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 5' preserveAspectRatio='none'%3E%3Cpath d='M0 3.2 C4 1.6 7 4.4 12 2.6 S19 3.8 24 2.4 S31 4.2 37 2.8 S46 3.6 52 3.2' fill='none' stroke='%236a9fd8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  --ul-red: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 5' preserveAspectRatio='none'%3E%3Cpath d='M0 3.2 C4 1.6 7 4.4 12 2.6 S19 3.8 24 2.4 S31 4.2 37 2.8 S46 3.6 52 3.2' fill='none' stroke='%23ff6a3d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  --ul-graphite: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2.6 C10 1.4 20 3.6 32 2.2 S50 3.2 64 2.4' fill='none' stroke='%237d8490' stroke-width='1.6' stroke-linecap='round' preserveAspectRatio='none'/%3E%3C/svg%3E");
  --ul-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2.6 C10 1.4 20 3.6 32 2.2 S50 3.2 64 2.4' fill='none' stroke='%23e3a553' stroke-width='1.6' stroke-linecap='round' preserveAspectRatio='none'/%3E%3C/svg%3E");
  --br-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 100' preserveAspectRatio='none'%3E%3Cpath d='M8 1.5 C4 2.5 1.8 3.5 2.4 9 C1.8 30 3 55 2.2 91 C2.6 96.5 4 97.5 8 98.5' fill='none' stroke='%236a9fd8' stroke-width='1.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

  --red: #ff8a63;
  --red-mark: #ff6a3d;
  --red-wash: color-mix(in srgb, #ff6a3d 13%, var(--paper));
  --highlight: #4b4a22;
  --selection: rgba(231, 229, 134, .26);
  --scrim: rgba(0, 0, 0, .45);
  --hover: color-mix(in srgb, var(--ink) 8%, transparent);
  --press: color-mix(in srgb, var(--ink) 13%, transparent);
  --material: color-mix(in srgb, var(--paper) 84%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 6px 14px -4px rgba(0, 0, 0, .5), 0 20px 44px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 24px -6px rgba(0, 0, 0, .55), 0 36px 80px -20px rgba(0, 0, 0, .7);
  --n-gray: #9b9b9b; --n-brown: #ba856f; --n-orange: #c77d48; --n-yellow: #ca9849; --n-green: #529e72;
  --n-blue: #5e87c9; --n-purple: #9d68d3; --n-pink: #d15796; --n-red: #df5452;
  --nb-gray: #2f2f2f; --nb-brown: #4a3228; --nb-orange: #5c3b23; --nb-yellow: #564328; --nb-green: #243d30;
  --nb-blue: #143a4e; --nb-purple: #3c2d49; --nb-pink: #4e2c3c; --nb-red: #522e2a;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; background: var(--paper); }
body {
  margin: 0; min-height: 100vh; overflow-x: clip;
  background: var(--paper); color: var(--ink);
  font: 400 13px/1.4 var(--font-ui); letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  transition: background-color 200ms ease, color 200ms ease;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .45; }
p, h1, h2, h3, h4 { margin: 0; }
a { color: var(--blue); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: var(--selection); }
.icon { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Type roles (SF tracking: tighter as it grows) */
.t-11 { font-size: 11px; letter-spacing: .005em; }
.t-12 { font-size: 12px; letter-spacing: 0; }
.t-15 { font-size: 15px; letter-spacing: -.015em; }
.hint { color: var(--ink-2); font-size: 12px; line-height: 1.45; letter-spacing: 0; }
.hint:empty { display: none; }

/* ---------- Buttons: graphite for the main action, quiet for the rest ---------- */
.btn, .btn-outline, .btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 var(--s5); border: 1px solid transparent; border-radius: var(--r-sm);
  font: 600 13px/1 var(--font-ui); letter-spacing: -.006em; white-space: nowrap; text-decoration: none;
  transition: background-color 80ms ease, border-color 80ms ease, transform var(--press-t) ease-out, color 80ms ease;
}
.btn:active:not(:disabled), .btn-outline:active:not(:disabled), .btn-quiet:active:not(:disabled), .btn-icon:active:not(:disabled) { transform: scale(.97); }
.btn { background: var(--ink); color: var(--paper); }
.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn-outline { background: var(--paper); border-color: var(--rule-2); color: var(--ink); }
.btn-outline:hover:not(:disabled) { background: var(--canvas); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 var(--s4); }
.btn-quiet:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-quiet.btn-sm { padding: 0 7px; }
.btn-danger, .btn.btn-danger { background: var(--red); color: #fff; }
.danger { color: var(--red) !important; }
.btn-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2);
  transition: background-color 80ms ease, transform var(--press-t) ease-out, color 80ms ease;
}
.btn-icon:hover { background: var(--hover); color: var(--ink); }
.link { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--blue) 35%, transparent); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--blue); }

/* Key caps */
.keys { display: inline-flex; gap: 2px; flex: none; }
kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: var(--r-xs); background: var(--canvas); box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--ink-2); font: 500 11px/1 var(--font-ui); letter-spacing: 0; font-variant-numeric: tabular-nums;
}

/* ---------- Fields ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="email"], input[type="tel"], input[type="search"], select, .field {
  width: 100%; height: 34px; padding: 0 11px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); font: 400 13px/1.3 var(--font-ui);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus-visible, select:focus-visible, .field:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-mark) 22%, transparent);
}
.field { height: auto; padding: 8px 11px; line-height: 1.45; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); }
.money-input {
  display: inline-flex; align-items: center; height: 34px; padding-left: 10px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm); background: var(--paper); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.money-input input { height: 100%; width: 100%; border: 0; background: transparent; padding-left: 3px; box-shadow: none !important; }
.money-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-mark) 22%, transparent); }

/* ---------- Segmented control ---------- */
.seg {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; max-width: 100%;
  padding: 2px; border-radius: 9px; background: var(--canvas); box-shadow: inset 0 0 0 1px var(--rule);
}
.seg-thumb {
  position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 7px;
  background: var(--paper); box-shadow: 0 1px 2px rgba(20, 30, 50, .12), 0 0 0 .5px rgba(20, 30, 50, .08);
}
:root[data-theme="dark"] .seg-thumb { background: #34373e; }
.seg-opt {
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ink-2); font: 500 12.5px/1 var(--font-ui); white-space: nowrap; transition: color 150ms ease;
}
.seg-opt:hover { color: var(--ink); }
.seg-opt[aria-checked="true"] { color: var(--ink); font-weight: 600; }
.seg-opt:focus-visible { outline-offset: -1px; }

/* ---------- Switch ---------- */
.switch {
  position: relative; flex: none; width: 36px; height: 22px; padding: 0; border: 0; border-radius: 11px;
  background: var(--rule-2); transition: background-color 200ms ease;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 9px;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform var(--spring-t) var(--spring), width 120ms ease;
}
.switch[aria-checked="true"] { background: var(--blue); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(14px); }
.switch:active .switch-knob { width: 22px; }
.switch[aria-checked="true"]:active .switch-knob { transform: translateX(10px); }

/* ---------- Menus: grow from the button that opened them ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 200px; max-width: min(320px, calc(100vw - 16px));
  max-height: min(420px, calc(100vh - 16px)); overflow-y: auto; padding: 5px;
  background: var(--paper); color: var(--ink); border-radius: var(--r); box-shadow: var(--shadow-lg);
  animation: grow-in var(--pop-t) var(--spring);
}
.menu.is-leaving { animation: grow-out 90ms ease-in forwards; pointer-events: none; }
@keyframes grow-in { from { opacity: 0; transform: scale(.97); } }
@keyframes grow-out { to { opacity: 0; transform: scale(.98); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 6px 10px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); text-align: left;
  font: 400 13px/1.3 var(--font-ui);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item:active { background: var(--press); }
.menu-icon { color: var(--ink-2); display: grid; }
.menu-label { flex: 1; min-width: 0; }
.menu-note { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.menu-check { display: grid; color: var(--blue); visibility: hidden; }
.menu-item[aria-checked="true"] .menu-check { visibility: visible; }
.menu-item[aria-checked="true"] .menu-label { font-weight: 600; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--rule); }
.menu-head { padding: 7px 10px 4px; color: var(--ink-2); font: 600 12px/1.3 var(--font-ui); }
.menu-form { display: grid; gap: 8px; padding: 8px; min-width: 250px; }
.menu-form-label { font-weight: 600; }
.menu-input { height: 34px; }
.row-end { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- Calendar ---------- */
.cal { width: 252px; padding: 4px 4px 2px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 0 6px 6px; }
.cal-title { font: 600 13px/1 var(--font-ui); }
.cal-nav { display: flex; }
.cal-nav .btn-icon { width: 30px; height: 30px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { padding: 4px 0; text-align: center; color: var(--ink-3); font: 500 11px/1 var(--font-ui); }
.cal-day { height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: 400 13px/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--hover); }
.cal-day.is-out { color: var(--ink-3); }
.cal-day.is-today { color: var(--red); font-weight: 700; }
.cal-day.is-chosen { background: var(--ink); color: var(--paper); font-weight: 600; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule); }

/* ---------- Toast: a confirmation, bottom center, above the keyboard ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(60px + max(var(--safe-b), var(--kb, 0px))); z-index: 90;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100vw - 32px);
  padding: 9px 14px 9px 16px; border-radius: var(--r);
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg);
  font: 500 13px/1.35 var(--font-ui);
  animation: toast-in 240ms var(--spring);
}
.toast.is-leaving { animation: toast-out 160ms ease-in forwards; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 4px); } }
.toast-btn { flex: none; padding: 4px 8px; margin: -4px -6px -4px 0; border: 0; border-radius: var(--r-xs); background: color-mix(in srgb, var(--paper) 14%, transparent); color: var(--paper); font: 600 13px/1.2 var(--font-ui); }
.toast-btn:hover { background: color-mix(in srgb, var(--paper) 22%, transparent); }

/* Three dots for "thinking" */
.dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.dots::before, .dots::after, .dots { --d: 4px; }
.dots::before, .dots::after { content: ""; width: var(--d); height: var(--d); border-radius: 50%; background: currentColor; animation: dot 1s ease-in-out infinite; }
.dots::after { animation-delay: .2s; }
@keyframes dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-property: opacity, color, background-color, border-color, text-decoration-color, box-shadow !important; transition-duration: 150ms !important; }
  .menu, .toast { animation: fade-in 150ms ease !important; }
}
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-contrast: more) {
  :root, :root[data-theme="dark"] { --rule: color-mix(in srgb, var(--ink) 40%, transparent); --rule-2: color-mix(in srgb, var(--ink) 60%, transparent); --ink-3: var(--ink-2); }
}

/* ---------- Tips: a word about a control, the moment you rest on it ---------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 95; top: calc(100% + 6px); left: 50%; transform: translate(-50%, -2px);
  width: max-content; max-width: 240px; padding: 5px 8px; border-radius: 6px; background: var(--ink); color: var(--paper);
  font: 500 11.5px/1.35 var(--font-ui); letter-spacing: 0; text-align: left; white-space: normal; text-transform: none;
  opacity: 0; pointer-events: none; transition: opacity 90ms ease, transform 120ms ease;
}
[data-tip].tip-end::after { left: auto; right: 0; transform: translate(0, -2px); }
[data-tip].tip-start::after { left: 0; transform: translate(0, -2px); }
[data-tip].tip-up::after { top: auto; bottom: calc(100% + 6px); }
@media (hover: hover) {
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 260ms; }
  [data-tip].tip-end:hover::after, [data-tip].tip-end:focus-visible::after, [data-tip].tip-start:hover::after, [data-tip].tip-start:focus-visible::after { transform: none; }
}
[data-tip][aria-expanded="true"]::after { display: none; }
body:has(.menu) [data-tip]::after { display: none; }
