/* ============================================================
   lulla.fi — Design System Tokens
   Import this file at the top of any new HTML/JSX surface.
   ============================================================ */


:root {
  /* ---------- Colour: raw palette ---------- */

  /* Parchment — surfaces */
  --parchment-50:  oklch(0.985 0.008 80);   /* lightest highlights */
  --parchment-100: oklch(0.972 0.012 80);   /* DEFAULT page surface */
  --parchment-200: oklch(0.953 0.014 78);   /* hover on ghost / subtle fill */
  --parchment-300: oklch(0.928 0.014 76);   /* section break "sand" */
  --parchment-400: oklch(0.890 0.014 74);   /* borders, dividers */
  --parchment-500: oklch(0.820 0.014 72);   /* low-emphasis lines */

  /* Ink — type & dark surfaces */
  --ink-900: oklch(0.18 0.020 250);   /* highest contrast, used rarely */
  --ink-800: oklch(0.24 0.018 250);   /* DEFAULT body text */
  --ink-700: oklch(0.34 0.018 245);   /* secondary text */
  --ink-500: oklch(0.50 0.014 240);   /* tertiary / captions */
  --ink-400: oklch(0.62 0.012 235);   /* placeholder text */
  --ink-300: oklch(0.74 0.010 230);   /* icons on dark fields */

  /* Sage — primary brand accent */
  --sage-50:  oklch(0.965 0.018 155);
  --sage-100: oklch(0.930 0.030 155);
  --sage-200: oklch(0.870 0.040 155);
  --sage-300: oklch(0.780 0.044 155);
  --sage-400: oklch(0.660 0.046 155);
  --sage-500: oklch(0.550 0.045 155);   /* PRIMARY */
  --sage-600: oklch(0.470 0.044 155);
  --sage-700: oklch(0.390 0.040 156);   /* hover/press for primary */
  --sage-800: oklch(0.310 0.034 158);
  --sage-900: oklch(0.230 0.026 160);

  /* Clay — warm secondary (highlights, callouts, WhatsApp accent) */
  --clay-50:  oklch(0.970 0.020 50);
  --clay-100: oklch(0.935 0.040 50);
  --clay-200: oklch(0.880 0.070 50);
  --clay-300: oklch(0.790 0.090 50);
  --clay-400: oklch(0.720 0.094 50);
  --clay-500: oklch(0.660 0.090 50);   /* DEFAULT clay */
  --clay-600: oklch(0.560 0.082 48);
  --clay-700: oklch(0.460 0.070 46);

  /* Functional — kept low-chroma to live inside the parchment world */
  --success-500: oklch(0.560 0.080 155);
  --warning-500: oklch(0.760 0.090 75);
  --warning-700: oklch(0.560 0.090 60);
  --danger-500:  oklch(0.560 0.110 28);
  --danger-700:  oklch(0.440 0.110 28);

  /* ---------- Semantic colour aliases ---------- */
  --bg:           var(--parchment-100);
  --bg-elevated:  var(--parchment-50);
  --bg-sunk:      var(--parchment-300);
  --bg-hover:     var(--parchment-200);

  --fg-1:         var(--ink-800);   /* body */
  --fg-2:         var(--ink-700);   /* secondary */
  --fg-3:         var(--ink-500);   /* tertiary / captions */
  --fg-muted:     var(--ink-400);
  --fg-on-sage:   var(--parchment-50);
  --fg-on-clay:   var(--parchment-50);

  --line:         var(--parchment-400);
  --line-soft:    var(--parchment-300);
  --line-strong:  var(--parchment-500);

  --accent:       var(--sage-500);
  --accent-hover: var(--sage-700);
  --accent-soft:  var(--sage-50);

  /* ---------- Type ---------- */
  /* Privacy boundary: previews use dependable local stacks and make no remote font requests. */
  --font-display: Georgia, "Times New Roman", serif;
  --font-sans:    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale (px values for clarity) */
  --type-display-xl: 64px;   /* hero headline */
  --type-display-l:  48px;
  --type-display-m:  36px;
  --type-display-s:  28px;
  --type-body-l:     19px;
  --type-body-m:     16px;   /* default body */
  --type-body-s:     14px;
  --type-label:      13px;
  --type-caption:    12px;

  /* Tracking */
  --tracking-display: -0.025em;
  --tracking-tight:   -0.01em;
  --tracking-normal:  0;
  --tracking-label:   0.01em;

  /* Line-height */
  --leading-display: 1.08;
  --leading-tight:   1.2;
  --leading-body:    1.5;
  --leading-ui:      1.4;

  /* ---------- Spacing (4px base) ---------- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-14: 56px;
  --space-20: 80px;
  --space-30: 120px;

  /* ---------- Radii ---------- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* ---------- Shadows ---------- */
  --shadow-soft:
    0 1px 1px oklch(0.24 0.018 250 / 0.04),
    0 2px 6px oklch(0.24 0.018 250 / 0.04);
  --shadow-lift:
    0 1px 2px oklch(0.24 0.018 250 / 0.06),
    0 8px 24px oklch(0.24 0.018 250 / 0.08);
  --shadow-overlay:
    0 4px 16px oklch(0.24 0.018 250 / 0.08),
    0 24px 60px oklch(0.24 0.018 250 / 0.16);
  --shadow-inset: inset 0 0 0 1px var(--line);

  /* ---------- Motion ---------- */
  --ease-out:    cubic-bezier(0.32, 0.72, 0.24, 1);  /* @kind other */
  --ease-in-out: cubic-bezier(0.5, 0, 0.2, 1);        /* @kind other */
  --dur-fast:    120ms;  /* @kind other */
  --dur-base:    220ms;  /* @kind other */
  --dur-slow:    320ms;  /* @kind other */
  --dur-stately: 500ms;  /* @kind other */
}

/* ============================================================
   Element defaults
   ============================================================ */

html, body {
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--type-body-m);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
  color: var(--fg-1);
  font-optical-sizing: auto;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: var(--type-display-l); }
h2 { font-size: var(--type-display-m); }
h3 { font-size: var(--type-display-s); }
h4 { font-size: 22px; line-height: var(--leading-tight); }

.display-xl { font-family: var(--font-display); font-weight: 500; font-size: var(--type-display-xl); line-height: var(--leading-display); letter-spacing: var(--tracking-display); }

p, li {
  font-family: var(--font-sans);
  font-size: var(--type-body-m);
  color: var(--fg-1);
  text-wrap: pretty;
}

small, .caption {
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  color: var(--fg-3);
  letter-spacing: var(--tracking-label);
}

.label {
  font-family: var(--font-sans);
  font-size: var(--type-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  color: var(--fg-2);
}

.mono, code, kbd {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-feature-settings: "tnum" 1;
}

a {
  color: var(--fg-1);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--dur-base) var(--ease-out);
}
a:hover { text-decoration-color: var(--accent); }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: var(--space-8) 0;
}

::selection { background: var(--sage-100); color: var(--ink-900); }

/* ============================================================
   Interaction primitives — hover, focus, press
   ============================================================ */

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Buttons + links transition by default */
button, a, [role="button"], .btn, .row-interactive {
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

/* Distinctive detail 01 — the physical press. Hard offset shadow that collapses on :active (one frame, no easing). */
.btn-primary, .btn-secondary, .btn-accent {
  box-shadow: 2px 2px 0 color-mix(in oklab, var(--ink-900) 30%, transparent);
}
.btn-primary:active, .btn-secondary:active, .btn-accent:active {
  transform: translate(2px, 2px) !important;
  box-shadow: none !important;
}

/* Primary (ink) button hover/press */
.btn-primary,
a.btn-primary,
button.btn-primary {
  background: var(--ink-900);
  color: var(--parchment-50);
  border: 1px solid var(--ink-900);
  cursor: pointer;
}
.btn-primary:hover { background: var(--ink-800); border-color: var(--ink-800); }


/* Secondary (parchment + line) */
.btn-secondary,
a.btn-secondary,
button.btn-secondary {
  background: var(--bg-elevated);
  color: var(--ink-900);
  border: 1px solid var(--line);
  cursor: pointer;
}
.btn-secondary:hover { background: var(--parchment-200); border-color: var(--line-strong); }


/* Ghost (just text) */
.btn-ghost { background: transparent; color: var(--ink-800); border: 1px solid transparent; cursor: pointer; }
.btn-ghost:hover { background: var(--parchment-200); }

/* Sage / accent */
.btn-accent { background: var(--sage-500); color: var(--fg-on-sage); border: 1px solid var(--sage-500); cursor: pointer; }
.btn-accent:hover { background: var(--sage-700); border-color: var(--sage-700); }


/* Interactive rows (DocumentRow, sidebar nav) */
.row-interactive { cursor: pointer; }
.row-interactive:hover { background: var(--parchment-200); }

/* Nav items */
.nav-item {
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item:hover { background: var(--parchment-200); color: var(--ink-900); }
.nav-item[aria-current="page"], .nav-item.is-active { background: var(--parchment-300); color: var(--ink-900); }

/* Input focus */
input, textarea, select {
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--sage-500);
  box-shadow: 0 0 0 3px var(--sage-50);
}

/* ============================================================
   Motion polish — drawer slide, row lift, fade-in, count ticker
   ============================================================ */

@keyframes drawer-slide-in {
  from { transform: translateX(32px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes panel-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes count-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.drawer-enter   { animation: drawer-slide-in 280ms var(--ease-out); }
.panel-enter    { animation: panel-fade-in 260ms var(--ease-out) both; }
.count-up       { animation: count-up 380ms var(--ease-out) both; }
.pulse-soft     { animation: pulse-soft 1.8s ease-in-out infinite; }

/* Distinctive detail 03 — barber-pole progress (indeterminate + determinate). */
.barber { height: 12px; border: 1.5px solid var(--ink-900); border-radius: 4px; overflow: hidden; background: var(--parchment-50); }
.barber > i { display: block; height: 100%; background: repeating-linear-gradient(-55deg, var(--sage-500) 0 10px, var(--sage-300) 10px 20px); background-size: 28px 28px; animation: barber-pole 1.1s linear infinite; transition: width var(--dur-base) var(--ease-out); }
.barber.done > i { animation: none; background: var(--sage-500); }
@keyframes barber-pole { to { background-position: 28px 0; } }

/* Distinctive detail 07 — the filed stamp. Slightly rotated double-ring seal. */
.stamp-filed { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 2px solid var(--sage-600); border-radius: 8px; color: var(--sage-600); font-family: var(--font-display); font-style: italic; font-size: 18px; transform: rotate(-7deg); opacity: .9; box-shadow: inset 0 0 0 1.5px var(--parchment-50), inset 0 0 0 3px var(--sage-600); animation: stamp-in 260ms var(--ease-out); flex-shrink: 0; }
.stamp-filed.estimate { border-color: var(--clay-500); color: var(--clay-500); box-shadow: inset 0 0 0 1.5px var(--parchment-50), inset 0 0 0 3px var(--clay-500); }
@keyframes stamp-in { 0% { transform: rotate(-7deg) scale(1.6); opacity: 0; } 100% { transform: rotate(-7deg) scale(1); opacity: .9; } }

/* Distinctive detail 06 — perforated receipt tear (bottom zigzag). Apply to a preview card. */
.receipt-tear { position: relative; border-bottom: none !important; }
.receipt-tear::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -7px; height: 7px; background: inherit; clip-path: polygon(0 0,100% 0,100% 15%,97.5% 100%,95% 15%,92.5% 100%,90% 15%,87.5% 100%,85% 15%,82.5% 100%,80% 15%,77.5% 100%,75% 15%,72.5% 100%,70% 15%,67.5% 100%,65% 15%,62.5% 100%,60% 15%,57.5% 100%,55% 15%,52.5% 100%,50% 15%,47.5% 100%,45% 15%,42.5% 100%,40% 15%,37.5% 100%,35% 15%,32.5% 100%,30% 15%,27.5% 100%,25% 15%,22.5% 100%,20% 15%,17.5% 100%,15% 15%,12.5% 100%,10% 15%,7.5% 100%,5% 15%,2.5% 100%,0 15%); filter: drop-shadow(0 2px 1px color-mix(in oklab, var(--ink-900) 15%, transparent)); }

/* Row hover lift — applies to any `.lift-row` on hover */
.lift-row {
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.lift-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: var(--line-strong);
}

/* Stagger helper — pair with class="stagger" on a parent, each child gets a delay */
.stagger > * { animation: panel-fade-in 320ms var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

@media (prefers-reduced-motion: reduce) {
  .barber > i, .stamp-filed { animation: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
