/* =====================================================================
   Plinth Design System
   A clean, minimal light system organized around a tactile press motif.
   Components rest on a dark outlined base with an offset top face
   that lifts on hover and presses on active.
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

/* ---------- Tokens ---------- */
:root {
  /* Color */
  --color-canvas: #ffffff;
  --color-paper: #faf7f2;
  --color-ink: #111111;
  --color-mute: #5a5a5a;
  --color-hairline: #ebe6dd;
  --color-coral: #fd9b9b;
  --color-coral-soft: #ffe2db;

  /* Semantic surfaces */
  --surface-page: var(--color-canvas);
  --surface-face: var(--color-paper);
  --surface-tint: var(--color-coral-soft);
  --text-primary: var(--color-ink);
  --text-secondary: var(--color-mute);
  --text-on-coral: var(--color-ink);
  --border-strong: var(--color-ink);
  --border-quiet: var(--color-hairline);
  --accent: var(--color-coral);
  --focus-ring: var(--color-coral);

  /* Typography */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --text-display-xl: 4rem;     /* 64px */
  --text-display-lg: 3rem;     /* 48px */
  --text-headline-lg: 2.25rem; /* 36px */
  --text-headline-md: 1.5rem;  /* 24px */
  --text-title-md: 1.125rem;   /* 18px */
  --text-body-lg: 1.0625rem;   /* 17px */
  --text-body-md: 1rem;        /* 16px */
  --text-body-sm: 0.875rem;    /* 14px */
  --text-label-sm: 0.75rem;    /* 12px */

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.55;

  --tracking-tight: -0.02em;
  --tracking-eyebrow: 0.08em;

  /* Spacing scale */
  --space-2xs: 0.25rem;  /* 4px  */
  --space-xs: 0.5rem;    /* 8px  */
  --space-sm: 0.75rem;   /* 12px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4.5rem;   /* 72px */

  --layout-max: 1180px;
  --layout-gutter: 1.5rem;

  /* Radius */
  --radius-none: 0;
  --radius-sm: 6px;
  --radius-md: 12px;   /* primary */
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* Borders */
  --border-w: 2px;
  --border-w-hair: 1px;
  --focus-w: 3px;

  /* Press offset depth */
  --press-rest: 4px;
  --press-hover: 6px;
  --press-active: 0px;

  /* Motion */
  --ease-press: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-press: 120ms;
  --dur-base: 180ms;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--color-coral-soft);
  color: var(--color-ink);
}

/* ---------- Typography primitives ---------- */
.display,
.headline {
  font-family: var(--font-display);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin: 0;
}

.display-xl { font-size: var(--text-display-xl); font-weight: 700; }
.display-lg { font-size: var(--text-display-lg); font-weight: 700; }
.headline-lg { font-size: var(--text-headline-lg); font-weight: 600; }
.headline-md { font-size: var(--text-headline-md); font-weight: 600; }

.title-md {
  font-family: var(--font-display);
  font-size: var(--text-title-md);
  font-weight: 600;
  line-height: var(--leading-snug);
  margin: 0;
}

.body-lg { font-size: var(--text-body-lg); line-height: var(--leading-normal); color: var(--text-primary); }
.body-md { font-size: var(--text-body-md); line-height: var(--leading-normal); color: var(--text-primary); }
.body-sm { font-size: var(--text-body-sm); line-height: var(--leading-normal); color: var(--text-secondary); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.eyebrow--accent {
  color: var(--color-ink);
  background: var(--color-coral-soft);
  border: var(--border-w-hair) solid var(--border-quiet);
  border-radius: var(--radius-full);
  padding: 0.35em 0.75em;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--layout-max);
  margin-inline: auto;
  padding-inline: var(--layout-gutter);
}

.stack-sm > * + * { margin-top: var(--space-sm); }
.stack-md > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }
.stack-xl > * + * { margin-top: var(--space-xl); }

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 820px) {
  .grid-3,
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
}

.divider {
  height: var(--border-w-hair);
  background: var(--border-quiet);
  border: 0;
}

/* =====================================================================
   Press primitive
   The shared push-button language. Wrap any face in .press to gain
   the stacked offset, lift on hover, snap on active.
   ===================================================================== */
.press {
  position: relative;
  display: inline-block;
  background: var(--color-ink);
  border-radius: var(--radius-md);
  isolation: isolate;
}

.press__face {
  position: relative;
  display: block;
  background: var(--surface-face);
  color: var(--text-primary);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md);
  transform: translateY(calc(-1 * var(--press-rest)));
  transition: transform var(--dur-press) var(--ease-press),
              background-color var(--dur-base) var(--ease-press);
  will-change: transform;
}

.press:hover .press__face {
  transform: translateY(calc(-1 * var(--press-hover)));
}

.press:active .press__face,
.press.is-pressed .press__face {
  transform: translateY(var(--press-active));
}

.press:focus-visible,
.press:has(:focus-visible) {
  outline: var(--focus-w) solid var(--focus-ring);
  outline-offset: 3px;
}

/* =====================================================================
   Button
   ===================================================================== */
.btn {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  background: var(--color-ink);
  color: var(--text-primary);
  border: 0;
  border-radius: var(--radius-md);
  padding: 0;
  cursor: pointer;
  isolation: isolate;
}

.btn__face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.85em 1.6em;
  background: var(--surface-face);
  color: var(--text-primary);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md);
  transform: translateY(calc(-1 * var(--press-rest)));
  transition: transform var(--dur-press) var(--ease-press),
              background-color var(--dur-base) var(--ease-press),
              color var(--dur-base) var(--ease-press);
  will-change: transform;
}

.btn:hover .btn__face { transform: translateY(calc(-1 * var(--press-hover))); }
.btn:active .btn__face { transform: translateY(var(--press-active)); }

.btn:focus-visible {
  outline: var(--focus-w) solid var(--focus-ring);
  outline-offset: 3px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn:disabled .btn__face,
.btn[aria-disabled="true"] .btn__face {
  transform: translateY(calc(-1 * var(--press-rest)));
}

/* Variants */
.btn--primary .btn__face {
  background: var(--color-coral);
  color: var(--text-on-coral);
}

.btn--secondary .btn__face {
  background: var(--surface-face);
  color: var(--text-primary);
}

.btn--ghost {
  background: transparent;
}

.btn--ghost .btn__face {
  background: var(--surface-page);
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(0);
}

.btn--ghost:hover .btn__face {
  background: var(--surface-face);
  transform: translateY(0);
}

.btn--ghost:active .btn__face {
  background: var(--color-coral-soft);
}

/* Sizes */
.btn--sm .btn__face {
  font-size: var(--text-body-sm);
  padding: 0.65em 1.15em;
}

.btn--lg .btn__face {
  font-size: 1.125rem;
  padding: 1em 1.85em;
}

.btn .icon {
  width: 1.05em;
  height: 1.05em;
  stroke-width: 2;
}

/* =====================================================================
   Input
   ===================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.field__label {
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.field__hint {
  font-size: var(--text-label-sm);
  color: var(--text-secondary);
}

.input {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--text-primary);
  background: var(--surface-page);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85em 1em;
  width: 100%;
  transition: box-shadow var(--dur-base) var(--ease-press),
              border-color var(--dur-base) var(--ease-press),
              background-color var(--dur-base) var(--ease-press);
}

.input::placeholder {
  color: var(--text-secondary);
}

.input:hover {
  background: var(--surface-face);
}

.input:focus,
.input:focus-visible {
  outline: 0;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 var(--focus-w) var(--focus-ring);
  background: var(--surface-page);
}

.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--surface-face);
}

.input--with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input--with-icon .input { padding-left: 2.5em; }

.input--with-icon .icon {
  position: absolute;
  left: 0.9em;
  width: 1.1em;
  height: 1.1em;
  color: var(--text-secondary);
  pointer-events: none;
}

/* =====================================================================
   Card
   ===================================================================== */
.card {
  position: relative;
  background: var(--color-ink);
  border-radius: var(--radius-md);
  isolation: isolate;
}

.card__face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--surface-page);
  color: var(--text-primary);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transform: translateY(calc(-1 * var(--press-rest)));
  transition: transform var(--dur-press) var(--ease-press);
  will-change: transform;
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover .card__face {
  transform: translateY(calc(-1 * var(--press-hover)));
}

.card--interactive:active .card__face {
  transform: translateY(var(--press-active));
}

.card--paper .card__face {
  background: var(--surface-face);
}

.card--accent {
  background: var(--color-ink);
}

.card--accent .card__face {
  background: var(--color-coral-soft);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-title-md);
  font-weight: 600;
  margin: 0;
}

.card__body {
  font-size: var(--text-body-md);
  color: var(--text-primary);
  margin: 0;
}

.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

/* =====================================================================
   Checkbox
   ===================================================================== */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-body-md);
  color: var(--text-primary);
}

.check__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.check__box {
  position: relative;
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  background: var(--color-ink);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  isolation: isolate;
}

.check__box::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--surface-page);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-sm);
  transform: translateY(calc(-1 * var(--press-rest)));
  transition: transform var(--dur-press) var(--ease-press),
              background-color var(--dur-base) var(--ease-press);
}

.check__box::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.55em;
  height: 0.3em;
  border-left: 2.5px solid var(--color-ink);
  border-bottom: 2.5px solid var(--color-ink);
  transform: translate(-55%, calc(-75% - var(--press-rest))) rotate(-45deg) scale(0);
  transform-origin: center;
  transition: transform var(--dur-base) var(--ease-press);
  z-index: 1;
}

.check:hover .check__box::before {
  transform: translateY(calc(-1 * var(--press-hover)));
}

.check:hover .check__input:checked + .check__box::after {
  transform: translate(-55%, calc(-75% - var(--press-hover))) rotate(-45deg) scale(1);
}

.check__input:checked + .check__box::before {
  background: var(--color-coral);
}

.check__input:checked + .check__box::after {
  transform: translate(-55%, calc(-75% - var(--press-rest))) rotate(-45deg) scale(1);
}

.check__input:active + .check__box::before,
.check__input:checked:active + .check__box::before {
  transform: translateY(var(--press-active));
}

.check__input:checked:active + .check__box::after {
  transform: translate(-55%, calc(-75% + var(--press-active))) rotate(-45deg) scale(1);
}

.check__input:focus-visible + .check__box {
  outline: var(--focus-w) solid var(--focus-ring);
  outline-offset: 3px;
}

/* =====================================================================
   Tabs
   Segmented control with an ink frame and an offset top-face active pill.
   ===================================================================== */
.tabs {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  background: var(--color-ink);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.tabs__tab {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--surface-face);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius-md) - 4px);
  padding: 0.6em 1.1em;
  cursor: pointer;
  transition: color var(--dur-base) var(--ease-press),
              background-color var(--dur-base) var(--ease-press);
}

.tabs__tab:hover {
  color: var(--color-canvas);
}

.tabs__tab[aria-selected="true"],
.tabs__tab.is-active {
  background: var(--surface-face);
  color: var(--text-primary);
  border: var(--border-w) solid var(--border-strong);
  transform: translateY(calc(-1 * var(--press-rest)));
  box-shadow: 0 calc(var(--press-rest)) 0 calc(-1 * var(--press-rest) + 0px) var(--color-ink);
}

.tabs__tab:focus-visible {
  outline: var(--focus-w) solid var(--focus-ring);
  outline-offset: 3px;
}

/* =====================================================================
   Press Tile — signature element
   A stacked, pressable feature/stat tile that surfaces a metric, label,
   and small icon using the same offset language.
   ===================================================================== */
.press-tile {
  position: relative;
  display: block;
  background: var(--color-ink);
  border-radius: var(--radius-md);
  isolation: isolate;
  text-decoration: none;
  color: inherit;
}

.press-tile__face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  min-width: 11rem;
  background: var(--surface-face);
  color: var(--text-primary);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md);
  transform: translateY(calc(-1 * var(--press-rest)));
  transition: transform var(--dur-press) var(--ease-press),
              background-color var(--dur-base) var(--ease-press);
  will-change: transform;
}

.press-tile:hover .press-tile__face {
  transform: translateY(calc(-1 * var(--press-hover)));
}

.press-tile:active .press-tile__face {
  transform: translateY(var(--press-active));
}

.press-tile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.press-tile__label {
  font-family: var(--font-body);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-secondary);
}

.press-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border: var(--border-w-hair) solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-canvas);
  color: var(--text-primary);
}

.press-tile__icon .icon {
  width: 1.05rem;
  height: 1.05rem;
  stroke-width: 2;
}

.press-tile__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.press-tile__caption {
  font-size: var(--text-body-sm);
  color: var(--text-secondary);
}

.press-tile--accent .press-tile__face {
  background: var(--color-coral-soft);
}

.press-tile--inverse .press-tile__face {
  background: var(--color-coral);
  color: var(--text-on-coral);
}

.press-tile--inverse .press-tile__label,
.press-tile--inverse .press-tile__caption {
  color: var(--color-ink);
}

/* =====================================================================
   Badge
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.35em 0.7em;
  background: var(--surface-face);
  color: var(--text-primary);
  border: var(--border-w-hair) solid var(--border-strong);
  border-radius: var(--radius-full);
}

.badge--accent {
  background: var(--color-coral-soft);
  color: var(--color-ink);
}

.badge--dot::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  background: var(--color-coral);
  border-radius: var(--radius-full);
}

/* =====================================================================
   Icon helper
   ===================================================================== */
.icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: middle;
  color: currentColor;
  stroke-width: 2;
}

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