/* =========================================================================
   Yahka Design Tokens
   Single source of truth for color, type, spacing, radius, shadow, motion.
   Import once at the top of any HTML file:
     <link rel="stylesheet" href="/colors_and_type.css">
   ========================================================================= */

/* ---- Webfonts ----------------------------------------------------------- */
/* SUBSTITUTION FLAG: All fonts below are Google Fonts placeholders.
   See README.md "Type" section for swap-out instructions. */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Figtree:wght@400;500;600;700;800&family=Amiri:wght@400;700&family=Rubik:wght@400;500;700&display=swap");

/* Icon system — Phosphor Regular. See README.md "Iconography". */
@import url("https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css");

:root {
  /* ---- Brand palette (raw) -------------------------------------------- */
  --cream:        #EFE4C7;   /* primary background — the hub top */
  --sand:         #F6EFDD;   /* softer cream, page bg */
  --clay:         #DCC9A3;   /* mid-tone cream, surfaces, dividers, pressed states */
  --cream-deep:   #DCC9A3;   /* alias for backwards-compat */
  --ink:          #1F1A14;   /* primary type */
  --ink-soft:     #3A3127;   /* softer type */
  --date-brown:   #5C4733;   /* deep brown — supporting type, borders, footer */
  --terracotta:   #B25241;   /* the only loud color — mouth button, primary action */
  --terracotta-deep: #A04839;
  --sage:         #8B9472;   /* desaturated secondary — quiet, value-matched to terracotta */
  --sage-deep:    #6E764F;
  --paper-line:   rgba(31, 26, 20, 0.08);

  /* ---- Semantic mappings ---------------------------------------------- */
  --bg:           var(--sand);
  --bg-elevated:  var(--cream);
  --surface:      #FBF7EB;
  --fg1:          var(--ink);
  --fg2:          var(--ink-soft);
  --fg3:          var(--date-brown);
  --fg-on-accent: var(--sand);
  --border:       var(--paper-line);
  --border-strong:rgba(31, 26, 20, 0.18);
  --accent:       var(--terracotta);
  --accent-hover: var(--terracotta-deep);
  --accent-2:     var(--sage);
  --highlight:    var(--terracotta);

  --success:      var(--sage-deep);
  --warning:      var(--terracotta);
  --danger:       var(--terracotta-deep);

  /* ---- Type families -------------------------------------------------- */
  --font-display:    "Fraunces", "Iowan Old Style", "Georgia", serif;
  --font-display-ar: "Amiri", "Scheherazade New", serif;
  --font-body:       "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body-ar:    "Rubik", "Tajawal", system-ui, sans-serif;
  --font-mono:       ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Type scale (modular, 1.2x) ------------------------------------- */
  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-md:   18px;
  --fs-lg:   22px;
  --fs-xl:   28px;
  --fs-2xl:  36px;
  --fs-3xl:  48px;
  --fs-4xl:  64px;
  --fs-5xl:  88px;

  --lh-tight: 1.1;
  --lh-snug:  1.25;
  --lh-base:  1.55;
  --lh-loose: 1.75;

  --tracking-tight: -0.02em;
  --tracking-base:  -0.005em;
  --tracking-wide:  0.06em;

  /* ---- Spacing (8pt grid) -------------------------------------------- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;
  --space-10: 128px;

  /* ---- Radii --------------------------------------------------------- */
  --radius-sm:  8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  --radius-pill:9999px;

  /* ---- Shadows ------------------------------------------------------- */
  --shadow-rest:    0 1px 2px rgba(31,26,20,.04), 0 8px 24px -12px rgba(31,26,20,.12);
  --shadow-raised:  0 4px 8px rgba(31,26,20,.06), 0 24px 48px -16px rgba(31,26,20,.18);
  --shadow-deep:    0 8px 16px rgba(31,26,20,.10), 0 40px 80px -24px rgba(31,26,20,.28);
  --shadow-inset:   inset 0 4px 8px rgba(31,26,20,.28);
  --shadow-inset-soft: inset 0 2px 4px rgba(31,26,20,.14);
  --shadow-press:   inset 0 2px 6px rgba(31,26,20,.22);

  /* ---- Motion -------------------------------------------------------- */
  --ease:         cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast:     180ms;
  --dur-base:     320ms;
  --dur-slow:     600ms;
}

/* =========================================================================
   Semantic element styles — h1, p, code, etc.
   ========================================================================= */
html {
  font-size: var(--fs-base);
  color: var(--fg1);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--fg1);
  margin: 0;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg1);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
  max-width: 64ch;
}

small, .caption { font-size: var(--fs-sm); color: var(--fg2); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent-hover); }

code, pre, .mono {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

[dir="rtl"], .ar {
  font-family: var(--font-body-ar);
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5,
.ar.display {
  font-family: var(--font-display-ar);
}

/* =========================================================================
   Utility classes used across cards and UI kits
   ========================================================================= */
.surface {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-rest);
}

.well {
  border-radius: 9999px;
  background: var(--ink);
  box-shadow: var(--shadow-inset);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  background: var(--cream-deep);
  color: var(--fg1);
}

/* Buttons — see preview/components-buttons.html for full state matrix */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-pill);
  font: inherit;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              transform 90ms var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.97); box-shadow: var(--shadow-press); }
.btn:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 4px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--fg-on-accent); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--accent-2); color: var(--fg-on-accent); }
.btn-secondary:hover { background: var(--sage-deep); }

.btn-ghost { background: transparent; color: var(--fg1); }
.btn-ghost:hover { background: rgba(31,26,20,.06); }

/* Inputs */
.input {
  font: inherit;
  font-family: var(--font-body);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg1);
  transition: border-color var(--dur-fast) var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); }

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