/*
 * HLT's one scale. Katailyst, the Vault and Nursing Mastery install this file from HLT Blocks
 * (npx shadcn@latest add https://hlt-blocks.vercel.app/r/scale.json) and point their own token
 * names at it. Size, weight, space, radius, control height, motion and depth live here. Colour and
 * typeface stay with each app. Change a value here, not in an app.
 */
:root {
  /* Six sizes: 13, 16, 20, 26, 34, 48. Each step is big enough to see. */
  --hlt-text-meta: 0.8125rem; /* 13: dates, counts, chips, a small line of facts */
  --hlt-text-body: 1rem; /* 16: everything a person reads or presses, the line under a name included */
  --hlt-text-region: 1.25rem; /* 20: a group inside a section */
  --hlt-text-section: 1.625rem; /* 26: a section on the page */
  --hlt-text-title: 2.125rem; /* 34: a record's own name inside a page */
  --hlt-text-display: 3rem; /* 48: the page's one title, greeting or number */

  /* Two weights, and one for titles. */
  --hlt-weight-regular: 400;
  --hlt-weight-strong: 600;
  --hlt-weight-title: 700;

  /* Leading by role: display tightest, running prose roomiest. */
  --hlt-leading-display: 1.1;
  --hlt-leading-heading: 1.2;
  --hlt-leading-ui: 1.3;
  --hlt-leading-body: 1.5;
  --hlt-leading-meta: 1.4;

  /* Tracking by role: tighten large display type, open small eyebrows. */
  --hlt-tracking-display: -0.025em;
  --hlt-tracking-heading: -0.015em;
  --hlt-tracking-body: 0em;
  --hlt-tracking-eyebrow: 0.08em;

  /* One spacing scale. Inside a card 24, between cards 16, between sections 48. */
  --hlt-space-1: 0.25rem; /* 4 */
  --hlt-space-2: 0.5rem; /* 8 */
  --hlt-space-3: 0.75rem; /* 12 */
  --hlt-space-4: 1rem; /* 16 */
  --hlt-space-6: 1.5rem; /* 24 */
  --hlt-space-8: 2rem; /* 32 */
  --hlt-space-12: 3rem; /* 48 */
  --hlt-space-16: 4rem; /* 64 */
  --hlt-space-24: 6rem; /* 96 */

  /* A grid of cards stops at three columns; this is the narrowest a column gets. */
  --hlt-card-min: 20rem;
  --hlt-card-columns: 3;
  /* Running text and a single-column page stop here. */
  --hlt-measure: 47.5rem; /* 760 */

  /* Space by role. Each points at a step above; reach for the role before the number. */
  --hlt-gap-tight: var(--hlt-space-2); /* 8: an icon to its label */
  --hlt-gap: var(--hlt-space-4); /* 16: between cards, between rows */
  --hlt-pad-card: var(--hlt-space-6); /* 24: inside a card */
  --hlt-gap-section: var(--hlt-space-12); /* 48: between sections */
  --hlt-gap-page: var(--hlt-space-16); /* 64: under the page header */
  --hlt-page-gutter: var(--hlt-space-8); /* 32: the page's side margin, 16 on a phone */

  /* Four corners and the pill. The bigger the thing, the rounder. */
  --hlt-radius-chip: 0.375rem; /* 6: chips and small marks */
  --hlt-radius-control: 0.625rem; /* 10: buttons and fields */
  --hlt-radius-card: 0.875rem; /* 14: cards and notes that float */
  --hlt-radius-feature: 1.25rem; /* 20: the one card a page leads with */
  --hlt-radius-full: 9999px; /* pills and round marks */

  /* Three control heights, and the smallest thing a finger can press. */
  --hlt-control-sm: 2rem; /* 32 */
  --hlt-control: 2.5rem; /* 40 */
  --hlt-control-lg: 3rem; /* 48 */
  --hlt-touch-min: 2.75rem; /* 44 */

  /* Motion: three lengths, curves for entering, leaving and moving, and one lift. */
  --hlt-dur-fast: 120ms; /* a press, a hover */
  --hlt-dur: 200ms; /* a note opening, a card lifting */
  --hlt-dur-slow: 320ms; /* a panel arriving */
  --hlt-ease: cubic-bezier(0.16, 1, 0.3, 1); /* entering, settling */
  --hlt-ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* entering, settling */
  --hlt-ease-in: cubic-bezier(0.4, 0, 1, 1); /* leaving */
  --hlt-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* moving in place */
  --hlt-lift: 2px; /* how far a pressable card rises under the pointer */

  /* Depth in three roles. Neutral shadows that hold in any app; an app may point these at its own. */
  --hlt-depth-flat: none; /* sits on the page: a border does the work */
  --hlt-depth-raised: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 12px -4px
    rgb(0 0 0 / 0.1); /* a card you can press */
  --hlt-depth-floating: 0 2px 6px rgb(0 0 0 / 0.08), 0 16px 40px -12px
    rgb(0 0 0 / 0.22); /* above the page: notes, menus */

  /* Neutral inset image outlines and shadow-borders so light-on-light and dark-on-dark edges stay crisp. */
  --hlt-image-outline: 1px solid oklch(0 0 0 / 0.1);
  --hlt-image-outline-offset: -1px;
  --hlt-shadow-border: 0 0 0 1px oklch(0 0 0 / 0.08);
  --hlt-shadow-border-hover: 0 0 0 1px oklch(0 0 0 / 0.14);
}

/* Interactive surfaces and borders derived via color-mix so Tailwind v3 and v4 apps need no /opacity on var(). */
:root,
.dark,
.light,
[data-theme="dark"],
[data-theme="light"] {
  --hlt-primary-hover: color-mix(
    in srgb,
    var(--color-primary, var(--primary)) 90%,
    transparent
  );
  --hlt-surface-quiet: color-mix(
    in srgb,
    var(--color-foreground, var(--foreground, currentColor)) 7%,
    transparent
  );
  --hlt-surface-quiet-hover: color-mix(
    in srgb,
    var(--color-foreground, var(--foreground, currentColor)) 12%,
    transparent
  );
  --hlt-border-control: color-mix(
    in srgb,
    var(--color-foreground, var(--foreground, currentColor)) 20%,
    transparent
  );
  --hlt-border-hover: color-mix(
    in srgb,
    var(--color-foreground, var(--foreground, currentColor)) 28%,
    transparent
  );
  --hlt-border-strong: color-mix(
    in srgb,
    var(--color-foreground, var(--foreground, currentColor)) 40%,
    transparent
  );
  --hlt-surface-scrim: color-mix(
    in srgb,
    var(--color-background, var(--background)) 85%,
    transparent
  );
  --hlt-surface-overlay: color-mix(
    in srgb,
    var(--color-background, var(--background)) 90%,
    transparent
  );
}

/* On dark grounds soft black shadows disappear, so raised and floating layers gain a specular top rim. */
.dark,
[data-theme="dark"] {
  --hlt-depth-raised: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 2px
    rgb(0 0 0 / 0.35), 0 4px 12px -4px rgb(0 0 0 / 0.45);
  --hlt-depth-floating: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 2px 8px
    rgb(0 0 0 / 0.45), 0 16px 40px -12px rgb(0 0 0 / 0.65);
  --hlt-image-outline: 1px solid oklch(1 0 0 / 0.1);
  --hlt-shadow-border: 0 0 0 1px oklch(1 0 0 / 0.1);
  --hlt-shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.18);
}

/* On a phone the two largest come down so a title fits in two lines. The other four hold. */
@media (max-width: 640px) {
  :root {
    --hlt-text-title: 1.875rem; /* 30 */
    --hlt-text-display: 2.125rem; /* 34 */
    --hlt-page-gutter: var(--hlt-space-4); /* 16 */
  }
}

/* Drop motion lengths and lift when the person asked the system for less motion. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --hlt-dur-fast: 0ms;
    --hlt-dur: 0ms;
    --hlt-dur-slow: 0ms;
    --hlt-lift: 0px;
  }
}

/* Signature HLT circular radial theme reveal (used by @hlt/theme-switch when viewTransition is enabled). */
:root[data-hlt-theme-transition="radial"]::view-transition-old(root),
:root[data-hlt-theme-transition="radial"]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
:root[data-hlt-theme-transition="radial"]::view-transition-old(root) {
  z-index: 1;
}
:root[data-hlt-theme-transition="radial"]::view-transition-new(root) {
  z-index: 9999;
  animation: hlt-theme-radial-reveal 480ms var(--hlt-ease-out) both;
}
@keyframes hlt-theme-radial-reveal {
  from {
    clip-path: circle(0px at var(--hlt-theme-x, 94vw) var(--hlt-theme-y, 24px));
  }
  to {
    clip-path: circle(
      var(--hlt-theme-r, 150vmax) at var(--hlt-theme-x, 94vw)
        var(--hlt-theme-y, 24px)
    );
  }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-hlt-theme-transition="radial"]::view-transition-new(root) {
    animation: none;
  }
}
