/* Pahe Digital — component stylesheet, loaded after tokens.css.
   Every value tokens.json declares lives there; this sheet keeps the rest:
   element defaults and helpers (tokens/base.css), core components
   (components/core/core.css) and forms (components/forms/forms.css). */

:root {
  /* Kept here, not in tokens.json: a color-mix() focus ring, values built from
     other variables, a unitless ratio and the motion scale. (from tokens/colors.css,
     tokens/form.css, tokens/spacing.css, tokens/motion.css) */
  --focus-ring: color-mix(in srgb, var(--bronze-500) 38%, transparent);
  --shadow-focus: 0 0 0 3px var(--focus-ring);

  --phi: 1.618;
  --gap-inline: var(--space-2);
  --gap-control: var(--space-3);
  --gap-stack: var(--space-4);
  --gap-group: var(--space-6);
  --section-pad-y: var(--phi-5);
  --section-pad-x: var(--space-6);

  /* ---------- Duration ---------- */
  --duration-instant: 100ms; /* @kind other */
  --duration-fast: 160ms;    /* @kind other */
  --duration-base: 220ms;    /* @kind other */
  --duration-slow: 320ms;    /* @kind other */

  /* ---------- Easing — calm, no overshoot (general/entrances/exits/signature) ---------- */
  --ease-standard: cubic-bezier(0.4, 0.0, 0.2, 1); /* @kind other */
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1); /* @kind other */
  --ease-in: cubic-bezier(0.4, 0.0, 1, 1); /* @kind other */
  --ease-measured: cubic-bezier(0.32, 0.0, 0.18, 1); /* @kind other */

  /* ---------- Common transitions ---------- */
  --transition-color: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); /* @kind other */
  --transition-transform: transform var(--duration-base) var(--ease-measured); /* @kind other */
  --transition-base: all var(--duration-base) var(--ease-standard); /* @kind other */
}

/* ---- tokens/base.css ---- */
/* ============================================================
   Pahe Digital — Base / element defaults & a few utilities
   Sets the warm-ink-on-paper foundation. Opinionated but light.
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--surface-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  font-feature-settings: "ss01", "cv05";
}

/* ---------- Headings — Fraunces, the soul ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

/* ---------- Links — bronze, the measure ---------- */
a {
  color: var(--text-link);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: var(--transition-color);
}
a:hover {
  color: var(--accent-press);
  text-decoration: underline;
}

/* ---------- Technical type ---------- */
code, kbd, samp, pre {
  font-family: var(--font-technical);
  font-size: 0.92em;
}

/* ---------- Focus — visible, calm ---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

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

/* ============================================================
   Utility classes — sparing helpers used across cards & kits
   ============================================================ */

/* Mono micro-label — the craft signature */
.pahe-eyebrow {
  font-family: var(--font-technical);
  font-size: var(--text-label);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-accent);
}

/* Editorial display */
.pahe-display {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
  color: var(--text-strong);
}

/* Reading measure */
.pahe-prose {
  max-width: var(--measure);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-body);
}

/* Hairline rule */
.pahe-rule {
  border: none;
  border-top: var(--border-hairline) solid var(--border-default);
  margin: 0;
}

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

/* ---- components/core/core.css ---- */
/* ============================================================
   Pahe Digital — Component styles: core
   Button, IconButton, Badge, Tag, Card, Divider.
   Calm states: hover = darker accent / warm well; press = slightly
   darker, no shrink-bounce; focus = bronze ring.
   ============================================================ */

/* ---------------- Button ---------------- */
.pahe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  font-size: var(--text-body-md);
  line-height: 1;
  letter-spacing: 0.005em;
  color: var(--text-strong);
  background: transparent;
  border: var(--border-hairline) solid transparent;
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
  height: 40px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.pahe-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.pahe-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* primary — sage-ink fill (the workhorse; bronze is reserved as accent) */
.pahe-btn--primary { background: var(--sage-900); color: var(--paper-100); border-color: var(--sage-900); }
.pahe-btn--primary:not(:disabled):hover { background: var(--sage-800); border-color: var(--sage-800); }
.pahe-btn--primary:not(:disabled):active { background: var(--ink-900); border-color: var(--ink-900); }

/* accent — bronze, the measure. Use for the single most important action. */
.pahe-btn--accent { background: var(--bronze-500); color: var(--paper-100); border-color: var(--bronze-500); }
.pahe-btn--accent:not(:disabled):hover { background: var(--bronze-600); border-color: var(--bronze-600); }
.pahe-btn--accent:not(:disabled):active { background: var(--bronze-700); border-color: var(--bronze-700); }

/* secondary — hairline on paper */
.pahe-btn--secondary { background: var(--surface-card); color: var(--text-strong); border-color: var(--line-strong); }
.pahe-btn--secondary:not(:disabled):hover { background: var(--paper-300); border-color: var(--ink-400); }
.pahe-btn--secondary:not(:disabled):active { background: var(--paper-400); }

/* ghost — text only */
.pahe-btn--ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.pahe-btn--ghost:not(:disabled):hover { background: var(--paper-300); color: var(--text-strong); }
.pahe-btn--ghost:not(:disabled):active { background: var(--paper-400); }

/* sizes */
.pahe-btn--sm { height: 32px; padding: 0 var(--space-4); font-size: var(--text-body-sm); }
.pahe-btn--lg { height: 48px; padding: 0 var(--space-6); font-size: var(--text-subtitle); }
.pahe-btn--block { width: 100%; }

/* ---------------- IconButton ---------------- */
.pahe-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: var(--border-hairline) solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard),
              color var(--duration-fast) var(--ease-standard);
}
.pahe-iconbtn:hover { background: var(--paper-300); color: var(--text-strong); }
.pahe-iconbtn:active { background: var(--paper-400); }
.pahe-iconbtn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.pahe-iconbtn--bordered { border-color: var(--line-strong); background: var(--surface-card); }
.pahe-iconbtn--sm { width: 32px; height: 32px; }

/* ---------------- Badge ---------------- */
.pahe-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-label-sm);
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: var(--border-hairline) solid var(--line);
  background: var(--paper-300);
  color: var(--text-secondary);
}
.pahe-badge--accent { background: var(--bronze-100); border-color: var(--bronze-200); color: var(--bronze-700); }
.pahe-badge--positive { background: var(--positive-surface); border-color: var(--positive-border); color: var(--sage-600); }
.pahe-badge--alert { background: var(--alert-surface); border-color: var(--alert-border); color: var(--clay-600); }
.pahe-badge--info { background: var(--info-surface); border-color: var(--info-border); color: var(--slate-600); }
.pahe-badge--solid { background: var(--ink-900); border-color: var(--ink-900); color: var(--paper-100); }

/* ---------------- Tag (removable chip) ---------------- */
.pahe-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  padding: 4px 6px 4px 10px;
  border-radius: var(--radius-pill);
  border: var(--border-hairline) solid var(--line-strong);
  background: var(--surface-card);
  color: var(--text-body);
}
.pahe-tag__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: var(--radius-circle);
  border: none; background: transparent;
  color: var(--text-faint); cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.pahe-tag__x:hover { background: var(--paper-400); color: var(--clay-500); }

/* ---------------- Card ---------------- */
.pahe-card {
  background: var(--surface-card);
  border: var(--border-hairline) solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.pahe-card--raised { box-shadow: var(--shadow-md); border-color: var(--line-soft); }
.pahe-card--flush { padding: 0; overflow: hidden; }
.pahe-card--accent { border-top: var(--border-seal) solid var(--sage-500); }
.pahe-card__title {
  font-family: var(--font-serif);
  font-weight: var(--weight-semibold);
  font-size: var(--text-title);
  color: var(--text-strong);
  letter-spacing: var(--tracking-tight);
}
.pahe-card__body { color: var(--text-secondary); font-size: var(--text-body-md); line-height: var(--leading-normal); }

/* ---------------- Divider ---------------- */
.pahe-divider { border: none; border-top: var(--border-hairline) solid var(--line); margin: 0; }
.pahe-divider--vertical { border-top: none; border-left: var(--border-hairline) solid var(--line); align-self: stretch; }

/* ---- components/forms/forms.css ---- */
/* ============================================================
   Pahe Digital — Component styles: forms
   Input, Textarea, Select, Field, Checkbox, Switch.
   Hairline borders, bronze focus ring, calm transitions.
   ============================================================ */

/* ---------------- Field (label + control + hint) ---------------- */
.pahe-field { display: flex; flex-direction: column; gap: var(--space-2); }
.pahe-field__label {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-medium);
  color: var(--text-strong);
}
.pahe-field__hint { font-size: var(--text-caption); color: var(--text-muted); }
.pahe-field__hint--error { color: var(--clay-600); }
.pahe-field__req { color: var(--bronze-600); margin-left: 2px; }

/* ---------------- Input / Textarea / Select ---------------- */
.pahe-input,
.pahe-textarea,
.pahe-select {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--text-strong);
  background: var(--surface-raised);
  border: var(--border-hairline) solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 40px;
  width: 100%;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}
.pahe-textarea { height: auto; padding: var(--space-3); line-height: var(--leading-normal); resize: vertical; min-height: 92px; }
.pahe-input::placeholder, .pahe-textarea::placeholder { color: var(--text-faint); }
.pahe-input:hover, .pahe-textarea:hover, .pahe-select:hover { border-color: var(--ink-400); }
.pahe-input:focus, .pahe-textarea:focus, .pahe-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.pahe-input:disabled, .pahe-textarea:disabled, .pahe-select:disabled {
  background: var(--paper-300); color: var(--text-faint); cursor: not-allowed;
}
.pahe-input--error, .pahe-textarea--error { border-color: var(--clay-500); }
.pahe-input--mono { font-family: var(--font-mono); font-size: var(--text-body-sm); letter-spacing: 0.02em; }

/* select chevron */
.pahe-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%236B6354' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-7);
  cursor: pointer;
}

/* input with leading adornment */
.pahe-input-group { position: relative; display: flex; align-items: center; }
.pahe-input-group__icon {
  position: absolute; left: var(--space-3);
  display: inline-flex; color: var(--text-faint); pointer-events: none;
}
.pahe-input-group .pahe-input { padding-left: var(--space-7); }

/* ---------------- Checkbox ---------------- */
.pahe-check { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; user-select: none; }
.pahe-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.pahe-check__box {
  width: 18px; height: 18px; flex: none;
  border: var(--border-medium) solid var(--line-strong);
  border-radius: var(--radius-xs);
  background: var(--surface-raised);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.pahe-check__box svg { opacity: 0; transform: scale(0.7); transition: opacity var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard); }
.pahe-check input:checked + .pahe-check__box { background: var(--bronze-500); border-color: var(--bronze-500); }
.pahe-check input:checked + .pahe-check__box svg { opacity: 1; transform: scale(1); }
.pahe-check input:focus-visible + .pahe-check__box { box-shadow: var(--shadow-focus); }
.pahe-check__label { font-size: var(--text-body-md); color: var(--text-body); }

/* ---------------- Switch ---------------- */
.pahe-switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; user-select: none; }
.pahe-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.pahe-switch__track {
  width: 38px; height: 22px; flex: none;
  border-radius: var(--radius-pill);
  background: var(--ink-400);
  position: relative;
  transition: background-color var(--duration-base) var(--ease-standard);
}
.pahe-switch__thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: var(--radius-circle);
  background: var(--paper-100);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-measured);
}
.pahe-switch input:checked + .pahe-switch__track { background: var(--bronze-500); }
.pahe-switch input:checked + .pahe-switch__track .pahe-switch__thumb { transform: translateX(16px); }
.pahe-switch input:focus-visible + .pahe-switch__track { box-shadow: var(--shadow-focus); }
.pahe-switch__label { font-size: var(--text-body-md); color: var(--text-body); }
