/* Components. Surface roles from base.css. */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-5);
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  background-color: transparent;
  color: inherit;
  font: 600 var(--fs-body)/1 var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(.98); }

.btn__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-yellow);
  transition: transform var(--dur) var(--ease-out);
}
.btn:focus-visible .btn__dot { transform: scale(1.6); }

/* Primary: ink pill, paper text, yellow dot */
.btn--primary { background-color: var(--c-ink); color: var(--c-paper); }

/* Secondary: outline in the surface's text color */
.btn--secondary { border-color: currentColor; }

.btn--block { display: flex; width: 100%; }

/* Large: the hero's single CTA */
.btn--lg { min-height: 64px; padding: 0 var(--s-7); gap: 12px; font-size: var(--fs-lead); }
.btn--lg .btn__dot { width: 10px; height: 10px; }

@media (hover: hover) {
  .btn:hover .btn__dot { transform: scale(1.6); }
  .btn--primary:hover { background-color: var(--c-ink-2); }
  .btn--secondary:hover { background-color: color-mix(in srgb, currentColor 8%, transparent); }
}

.btn:disabled,
.btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn:disabled .btn__dot,
.btn[aria-disabled="true"] .btn__dot { transform: none; }

/* Busy: the dot spins (transform only); same footprint */
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .btn__dot,
.btn[aria-busy="true"]:not(:has(.btn__dot))::before {
  width: 16px;
  height: 16px;
  margin: -4px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  background: transparent;
  transform: none;
  animation: btn-spin 700ms linear infinite;
}
.btn[aria-busy="true"]:not(:has(.btn__dot))::before { content: ''; flex: none; margin: 0; }
@keyframes btn-spin { to { transform: rotate(1turn); } }

/* --- Link-looking button --- */
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration-line: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
  touch-action: manipulation;
}

/* --- Chip & tag --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: var(--s-1) var(--s-3);
  border: 1.5px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.2;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--s-2);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-family: var(--font-label);
  font-size: var(--fs-micro);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* --- Cards: depth by surface color, no shadows --- */
.card {
  --surface: var(--c-paper-2);
  --on-surface: var(--c-ink);
  --fg-muted: var(--c-muted);
  --ring: var(--c-ink);
  padding: var(--s-6);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--on-surface);
}
.card--ink {
  --surface: var(--c-ink-2);
  --on-surface: var(--c-paper);
  --fg-muted: var(--c-muted-on-ink);
  --ring: var(--c-paper);
}

/* --- Icons: Lucide sprite (icons.svg#i-NAME) --- */
.icon {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 24px; height: 24px; }

/* --- Form controls --- */
.field { display: grid; gap: var(--s-2); align-content: start; }

.field__label { font-size: var(--fs-small); font-weight: 600; line-height: 1.3; }

/* Controls: white with ink text, contrast on any surface */
.field__control {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--s-3) var(--s-4);
  border: 2px solid color-mix(in srgb, currentColor 55%, transparent);
  border-radius: var(--r-sm);
  background-color: var(--c-white);
  color: var(--c-ink);
  font: 400 max(16px, var(--fs-body))/1.4 var(--font-body);
}
.field__control::placeholder { color: var(--c-muted); opacity: 1; }
.field__control:focus { border-color: currentColor; }
.field__control:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
@media (hover: hover) {
  .field__control:hover { border-color: color-mix(in srgb, currentColor 80%, transparent); }
}
.field__control:disabled { opacity: .45; cursor: not-allowed; }

textarea.field__control { min-height: 128px; line-height: 1.5; resize: vertical; }

select.field__control {
  appearance: none;
  padding-right: var(--s-7);
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 24px) 50%, calc(100% - 18px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field__hint { font-size: var(--fs-small); line-height: 1.4; color: var(--fg-muted); }

/* Error = icon + text, never color alone */
.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.4;
  color: var(--c-danger);
}
.field__error:empty { display: none; }
.field__error .icon { width: 16px; height: 16px; margin-top: 2px; }

.is-invalid .field__control,
.field__control[aria-invalid="true"] { border-color: var(--c-danger); }

/* Checkbox row */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: 44px;
  padding-block: 9px;
  line-height: 1.55;
  cursor: pointer;
}
.check input[type="checkbox"] {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  accent-color: var(--ring);
  cursor: pointer;
}
/* Form rows: the label is the whole 44px target */
div.check { gap: 0; padding-block: 0; }
div.check input[type="checkbox"] { margin-top: 10px; }
div.check > label { flex: 1; min-width: 0; padding: 9px 0 9px var(--s-3); }
.is-invalid .check input[type="checkbox"],
.check input[aria-invalid="true"] { outline: 2px solid var(--c-danger); outline-offset: 2px; }
.check input[type="checkbox"]:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

/* --- Segmented: .segmented > .segmented__btn[aria-pressed] --- */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  padding: var(--s-1);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.segmented__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-pill);
  background-color: transparent;
  color: inherit;
  font: 600 var(--fs-small)/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease-out);
}
.segmented__btn:active { transform: scale(.98); }
.segmented__btn:focus-visible { outline-offset: 1px; }
@media (hover: hover) {
  .segmented__btn:hover { background-color: color-mix(in srgb, currentColor 10%, transparent); }
}
.segmented__btn[aria-pressed="true"] {
  background-color: var(--on-surface);
  color: var(--surface);
}
.segmented__btn:disabled { opacity: .45; cursor: not-allowed; }

/* .link-draw: underline + hover line; .link-hover: hover line only (--hl colour) */
.link-draw { text-decoration: none; }
.link-draw, .link-hover { position: relative; --hl: var(--c-green-deep); }
:is(.section--ink, .consent-banner, .site-footer) :is(.link-draw, .link-hover) { --hl: var(--c-green); }
.link-draw::before, :is(.link-draw, .link-hover)::after { content: ""; position: absolute; inset: auto var(--ld-x, 0) var(--ld-b, 0); height: 1.5px; background: currentColor; }
:is(.link-draw, .link-hover)::after { height: 2px; background: var(--hl); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-slow) var(--ease-out); }
@media (hover: hover) { :is(.link-draw, .link-hover):hover::after { transform: none; } }
