/* Living Magic — Base element defaults & voice utilities */
body {
  font-family: var(--font-sans);
  font-weight: var(--fw-light);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .lm-display {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  color: var(--text-strong);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
p { text-wrap: pretty; }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--text-link-hover); }

/* Focus is visible, gold, and never removed */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-shadow);
  border-radius: var(--radius-xs);
}
::selection { background: var(--gold-a32); color: var(--text-strong); }

button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* Warm thin scrollbars (portal & CRM surfaces) */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- Voice utilities ---------------------------------------------- */
.lm-eyebrow {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--accent);
}
.lm-script {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--script);
  line-height: 1;
  text-transform: none; /* script is NEVER all caps */
}
.lm-spaced { letter-spacing: var(--ls-widest); text-transform: uppercase; }
.lm-rule { height: 1px; border: 0; background: var(--grad-gold); }

/* Gilded glass panel */
.lm-glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

/* Engraved almanac plate — hairline border + faint inner rule */
.lm-engraved { position: relative; border: 1px solid var(--line); }
.lm-engraved::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

/* ---- Verdigris instrumentation — gold as instrument over living water ----
   Use on Nocturne app/OS surfaces sitting on --ground-abyss/--ground-waterline. */
.lm-grain {  /* film grain overlay; parent needs position:relative */
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.05; mix-blend-mode: soft-light;
  background-image: var(--texture-grain);
}
.lm-horizon {  /* the waterline — gold rule with rising mist */
  position: relative; height: 1px; background: var(--grad-gold); opacity: 0.85;
}
.lm-horizon::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: 1px; height: 26px;
  background: linear-gradient(180deg, var(--mist-a10), transparent); pointer-events: none;
}
.lm-ticks {  /* instrument tick rail */
  height: 5px;
  background: repeating-linear-gradient(90deg, var(--gold-a32) 0 1px, transparent 1px 8px);
}
.lm-dial {  /* conic instrument ring; set --val 0-100 (+ --dial-size/color/track) */
  --val: 60; --dial-size: 18px; --dial-color: var(--gold-500); --dial-track: var(--verd-700);
  width: var(--dial-size); height: var(--dial-size); border-radius: 50%; flex: none;
  background: conic-gradient(var(--dial-color) calc(var(--val) * 1%), var(--dial-track) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 62%, #000 64%);
  mask: radial-gradient(closest-side, transparent 62%, #000 64%);
}
.lm-reg { position: absolute; width: 14px; height: 14px; pointer-events: none; opacity: 0.75; }
.lm-reg-tl { top: 9px; left: 9px; border-top: 1px solid var(--gold-500); border-left: 1px solid var(--gold-500); }
.lm-reg-br { bottom: 9px; right: 9px; border-bottom: 1px solid var(--gold-500); border-right: 1px solid var(--gold-500); }
.lm-pulse {  /* live/flowing state dot */
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--live); box-shadow: 0 0 10px var(--live);
  animation: lm-shimmer 3s ease-in-out infinite;
}
/* Working voice — task/card titles (T3). Coral Blush is for what is NAMED
   (screens, columns, ceremonies); this is for what you DO. */
.lm-working-title {
  font-family: var(--font-sans); font-weight: var(--fw-light);
  font-size: 15.5px; letter-spacing: 0.02em; line-height: 1.4;
  text-transform: none; color: var(--text-strong);
}

/* Choreographed reveal — add .lm-reveal, set --i for stagger */
.lm-reveal {
  opacity: 0;
  animation: lm-fade-up var(--dur-slow) var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

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