/* ═══════════════════════════════════════════════════════════
   LOOMERLAB — DESIGN SYSTEM v2
   Font: Archivo Black (display) + BeVietnamPro (UI)
   Colors: OKLCH — perceptually uniform, tinted toward brand
   ═══════════════════════════════════════════════════════════ */

/* ─── GOOGLE FONTS ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Black&display=swap');

/* ─── LOCAL FONTS ───────────────────────────────────────── */
@font-face {
  font-family: 'BeVietnamPro-bold';
  src: url('/fonts/BeVietnamPro-Bold.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'BeVietnamPro-regular';
  src: url('/fonts/BeVietnamPro-Regular.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'BeVietnamPro-semi-bold';
  src: url('/fonts/BeVietnamPro-SemiBold.ttf') format('truetype');
  font-display: swap;
}

/* ─── BASE RESET ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

/* ─── DESIGN TOKENS (theme-agnostic) ───────────────────── */
:root {
  /* Font families */
  --font-display:  'Archivo Black', sans-serif;
  --font-body:     'BeVietnamPro-regular', sans-serif;
  --font-bold:     'BeVietnamPro-bold', sans-serif;
  --font-semibold: 'BeVietnamPro-semi-bold', sans-serif;

  /* Type scale — fixed for app UI */
  --text-xs:   0.75rem;    /* 12px — captions */
  --text-sm:   0.875rem;   /* 14px — secondary UI */
  --text-base: 1rem;       /* 16px — body */
  --text-lg:   1.125rem;   /* 18px — subheadings */
  --text-xl:   1.375rem;   /* 22px — section headings */
  --text-2xl:  1.75rem;    /* 28px — page titles */
  --text-3xl:  2.5rem;     /* 40px — display */

  /* Spacing — 4pt scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Border radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-pill: 999px;
  --radius-full: 50%;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.2, 0.64, 1);
  --dur-fast:    150ms;
  --dur-base:    220ms;
  --dur-slow:    360ms;

  /* Z-index scale */
  --z-sticky:   100;
  --z-dropdown: 200;
  --z-overlay:  500;
  --z-modal:    600;
  --z-toast:    900;
}

/* ═══════════════════════════════════════════════════════════
   TEMA: CHIARO — bianco caldo, accento arancione brand
   ═══════════════════════════════════════════════════════════ */
:root,
[data-theme="chiaro"] {
  --bg:               oklch(98.5% 0.005 40);
  --bgsecondario:     oklch(94% 0.008 40);
  --bg-elevated:      oklch(100% 0.002 40);
  --bg-sunken:        oklch(91% 0.011 40);

  --text:             oklch(15% 0.014 40);
  --secondarytext:    oklch(43% 0.012 40);
  --textsecondario:   oklch(99% 0.003 40);
  --text-muted:       oklch(61% 0.008 40);

  --border:           oklch(88% 0.013 40);
  --shadow:           oklch(15% 0.014 40 / 0.09);
  --shadow-md:        oklch(15% 0.014 40 / 0.15);
  --shadow-lg:        oklch(15% 0.014 40 / 0.22);

  /* Accento: arancione brand */
  --accent:           oklch(70% 0.19 40);
  --accent-hover:     oklch(64% 0.19 40);
  --accent-subtle:    oklch(70% 0.19 40 / 0.10);
  --accent-muted:     oklch(82% 0.10 40);

  --color-success:    oklch(48% 0.15 145);
  --color-success-bg: oklch(93% 0.04 145);
  --color-success-border: oklch(78% 0.10 145);
  --color-error:      oklch(50% 0.20 25);
  --color-error-bg:   oklch(95% 0.03 25);
  --color-error-border: oklch(78% 0.12 25);
  --color-warning:    oklch(62% 0.18 60);
  --color-warning-bg: oklch(94% 0.04 60);

  --button:                             oklch(70% 0.19 40);
  --buttontext:                         oklch(99% 0.003 40);
  --buttonshadow:                       oklch(70% 0.19 40 / 0.18);
  --colorecontrastante:                 oklch(15% 0.014 40);
  --colorecontrastantesecondario:       oklch(70% 0.19 40);
  --colorecontrastantesecondarioshadow: oklch(70% 0.19 40 / 0.14);
  --colorecontrastantesecondariosimile: oklch(82% 0.11 40);
}

/* ═══════════════════════════════════════════════════════════
   TEMA: SCURO — carbone caldo, accento blu elettrico
   ═══════════════════════════════════════════════════════════ */
[data-theme="scuro"] {
  --bg:               oklch(21% 0.008 25);
  --bgsecondario:     oklch(27% 0.010 25);
  --bg-elevated:      oklch(32% 0.012 25);
  --bg-sunken:        oklch(17% 0.006 25);

  --text:             oklch(96% 0.004 225);
  --secondarytext:    oklch(68% 0.009 225);
  --textsecondario:   oklch(96% 0.004 225);
  --text-muted:       oklch(50% 0.007 225);

  --border:           oklch(29% 0.016 25);
  --shadow:           oklch(5% 0.004 25 / 0.55);
  --shadow-md:        oklch(5% 0.004 25 / 0.65);
  --shadow-lg:        oklch(5% 0.004 25 / 0.75);

  /* Accento: blu elettrico */
  --accent:           oklch(78% 0.18 225);
  --accent-hover:     oklch(72% 0.18 225);
  --accent-subtle:    oklch(78% 0.18 225 / 0.14);
  --accent-muted:     oklch(58% 0.10 225);

  --color-success:    oklch(64% 0.16 145);
  --color-success-bg: oklch(20% 0.06 145);
  --color-success-border: oklch(38% 0.10 145);
  --color-error:      oklch(66% 0.20 25);
  --color-error-bg:   oklch(20% 0.07 25);
  --color-error-border: oklch(40% 0.14 25);
  --color-warning:    oklch(74% 0.18 60);
  --color-warning-bg: oklch(20% 0.06 60);

  --button:                             oklch(78% 0.18 225);
  --buttontext:                         oklch(14% 0.008 225);
  --buttonshadow:                       oklch(78% 0.18 225 / 0.22);
  --colorecontrastante:                 oklch(96% 0.004 225);
  --colorecontrastantesecondario:       oklch(78% 0.18 225);
  --colorecontrastantesecondarioshadow: oklch(78% 0.18 225 / 0.16);
  --colorecontrastantesecondariosimile: oklch(88% 0.10 225);
}

/* ═══════════════════════════════════════════════════════════
   TEMA: FENICE — inchiostro scuro, accento viola elettrico
   ═══════════════════════════════════════════════════════════ */
[data-theme="fenice"] {
  --bg:               oklch(13% 0.012 285);
  --bgsecondario:     oklch(19% 0.015 285);
  --bg-elevated:      oklch(24% 0.018 285);
  --bg-sunken:        oklch(10% 0.009 285);

  --text:             oklch(96% 0.005 285);
  --secondarytext:    oklch(68% 0.010 285);
  --textsecondario:   oklch(96% 0.005 285);
  --text-muted:       oklch(50% 0.009 285);

  --border:           oklch(27% 0.020 285);
  --shadow:           oklch(5% 0.005 285 / 0.55);
  --shadow-md:        oklch(5% 0.005 285 / 0.65);
  --shadow-lg:        oklch(5% 0.005 285 / 0.75);

  /* Accento: viola elettrico */
  --accent:           oklch(64% 0.28 292);
  --accent-hover:     oklch(58% 0.28 292);
  --accent-subtle:    oklch(64% 0.28 292 / 0.14);
  --accent-muted:     oklch(46% 0.16 292);

  --color-success:    oklch(64% 0.17 145);
  --color-success-bg: oklch(19% 0.06 145);
  --color-success-border: oklch(37% 0.10 145);
  --color-error:      oklch(66% 0.20 25);
  --color-error-bg:   oklch(19% 0.07 25);
  --color-error-border: oklch(39% 0.14 25);
  --color-warning:    oklch(75% 0.18 60);
  --color-warning-bg: oklch(19% 0.06 60);

  --button:                             oklch(64% 0.28 292);
  --buttontext:                         oklch(99% 0.003 285);
  --buttonshadow:                       oklch(64% 0.28 292 / 0.22);
  --colorecontrastante:                 oklch(96% 0.005 285);
  --colorecontrastantesecondario:       oklch(64% 0.28 292);
  --colorecontrastantesecondarioshadow: oklch(64% 0.28 292 / 0.14);
  --colorecontrastantesecondariosimile: oklch(78% 0.17 292);
}
