/* ==========================================================================
   Elevate — Base: reset, typography, primitives, motion
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  font-variant-ligatures: common-ligatures contextual;
  min-height: 100vh;
  overscroll-behavior-y: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

h1, h2, h3, h4, h5 {
  font-weight: 600;
  letter-spacing: -0.021em;
  line-height: 1.25;
  color: var(--text);
  text-wrap: balance;
}
/* Headings carry the display face; h3 and below stay in the UI face because
   they are used for small component labels where a serif costs legibility. */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: 1.14;
}
h3, h4, h5 { font-family: var(--font); }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { text-wrap: pretty; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img, svg, canvas { display: block; max-width: 100%; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); }
small { font-size: var(--fs-xs); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent-soft-2); color: var(--text); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Scrollbars: quiet and unobtrusive ---- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ---- Utility primitives ---- */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { align-items: center; justify-content: center; }
.gap-1 { gap: var(--s-1); } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); } .gap-5 { gap: var(--s-5); } .gap-6 { gap: var(--s-6); }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.fs-xs { font-size: var(--fs-xs); } .fs-sm { font-size: var(--fs-sm); }
.fs-lg { font-size: var(--fs-lg); } .fs-xl { font-size: var(--fs-xl); }
.strong { font-weight: 600; }
.line { height: 1px; background: var(--border); flex: 0 0 auto; }
.vline { width: 1px; background: var(--border); align-self: stretch; }

/* ---- Motion ---- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.965) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-left { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes check-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bloom { from { transform: scale(.6); opacity: .75; } to { transform: scale(2.4); opacity: 0; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-3px); } 40%, 60% { transform: translateX(3px); } }

.anim-rise { animation: rise-in var(--t-slow) var(--ease-out) both; }
.anim-pop { animation: pop-in var(--t-slow) var(--ease-out) both; }
.anim-fade { animation: fade-in var(--t) var(--ease) both; }
.shake { animation: shake 420ms var(--ease); }
.stagger > * { animation: rise-in var(--t-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 10ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 70ms; }
.stagger > *:nth-child(4) { animation-delay: 100ms; }
.stagger > *:nth-child(5) { animation-delay: 130ms; }
.stagger > *:nth-child(6) { animation-delay: 160ms; }
.stagger > *:nth-child(7) { animation-delay: 190ms; }
.stagger > *:nth-child(8) { animation-delay: 220ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Boot splash ---- */
.boot {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-content: center; justify-items: center; gap: var(--s-4);
  background: var(--bg);
}
.boot__mark { color: var(--accent); animation: pulse-soft 1.6s var(--ease) infinite; }
.boot__label { font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: var(--fs-xs); color: var(--text-3); }
.boot__bar { width: 148px; height: 3px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.boot__bar span { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--accent); animation: boot-slide 1.15s var(--ease) infinite; }
@keyframes boot-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.boot__hint { font-size: var(--fs-xs); color: var(--text-3); }

/* ==========================================================================
   Display type map
   Fraunces is applied only where a line is read as a *statement* — the
   greeting, page/section titles, headline numbers, card and modal titles.
   Everything scrubbable (task rows, inputs, nav, chips) stays Plus Jakarta.
   ========================================================================== */
.display { font-family: var(--font-display); letter-spacing: var(--tracking-display); }

.hero__greet,
.hero__streak-value,
.topbar__title,
.boot__label,
.card__head h2,
.card__head h3,
.card-title,
.settings-block__title,
.section-head__title,
.empty__title,
.modal__head h2,
.drawer__head h2,
.goal-card__title,
.note-card__title,
.editor__title,
.detail__title,
.stat-chip__value {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-display);
}

/* Numbers in the serif are lovely but drift out of alignment; keep them
   tabular so columns of figures still line up. */
.stat-chip__value,
.hero__streak-value { font-variant-numeric: tabular-nums; }

/* Settings → Appearance → "Display serif" off, or a narrow viewport, falls
   back to the UI face everywhere. */
html[data-fonts="sans"] .display,
html[data-fonts="sans"] h1,
html[data-fonts="sans"] h2,
html[data-fonts="sans"] .hero__greet,
html[data-fonts="sans"] .hero__streak-value,
html[data-fonts="sans"] .topbar__title,
html[data-fonts="sans"] .boot__label,
html[data-fonts="sans"] .card__head h2,
html[data-fonts="sans"] .card__head h3,
html[data-fonts="sans"] .card-title,
html[data-fonts="sans"] .settings-block__title,
html[data-fonts="sans"] .section-head__title,
html[data-fonts="sans"] .empty__title,
html[data-fonts="sans"] .modal__head h2,
html[data-fonts="sans"] .drawer__head h2,
html[data-fonts="sans"] .goal-card__title,
html[data-fonts="sans"] .note-card__title,
html[data-fonts="sans"] .editor__title,
html[data-fonts="sans"] .detail__title,
html[data-fonts="sans"] .stat-chip__value {
  font-family: var(--font);
  letter-spacing: -0.02em;
}

/* ---- Cursor glow (js/cursor.js) ---- */
.cursor-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-cursor);
  pointer-events: none;          /* never intercepts a click */
  opacity: 0;
  transition: opacity var(--t) var(--ease);
}
.cursor-trail.is-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cursor-trail { display: none; } }


