/* IMPULS — shared tokens, reset, typography and form controls. */

:root {
  --paper: #f6f7f2;
  --paper-2: #edf3ea;
  --white: #ffffff;
  --mint: #d9eed5;
  --mint-strong: #b9e0b4;
  --cover-green: #99d094;
  --ink: #14182e;
  --ink-2: #474c60;
  --ink-3: #6b7083;
  --line: rgba(20, 24, 46, 0.14);
  --line-strong: rgba(20, 24, 46, 0.32);
  --error: #a3221b;
  --error-bg: #fbecea;
  --ok: #1f6b3a;
  --ok-bg: #e3f3e6;
  --warn-bg: #fff4dc;
  --focus: #14182e;
  --focus-halo: rgba(153, 208, 148, 0.75);

  --chrome: linear-gradient(135deg, #f4f5f7 0%, #c9ced6 22%, #fbfbfc 40%, #b7bec8 58%, #eef0f3 76%, #c3c9d1 100%);
  --iris: linear-gradient(120deg, #f6d8ea 0%, #f7efd0 30%, #d4f0dc 62%, #d8e6f8 100%);

  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --tap: 52px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--white);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Type ---------- */

.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.display {
  font-family: var(--sans);
  font-weight: 500;
  font-stretch: condensed;
  text-transform: uppercase;
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: var(--ink);
}

.display span {
  display: block;
}

.lead {
  font-size: clamp(1.0625rem, 0.98rem + 0.3vw, 1.25rem);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 34ch;
}

/* ---------- Form controls ---------- */

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.005em;
}

.field__help {
  font-size: 0.9375rem;
  color: var(--ink-2);
  line-height: 1.45;
}

.field__error {
  min-height: 0;
  font-size: 0.9375rem;
  color: var(--error);
  font-weight: 500;
}

.field__error:empty {
  margin: 0;
  padding: 0;
}

.field__error:not(:empty) {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
}

.field__error:not(:empty)::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--error);
  color: var(--white);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 1.0625rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input::placeholder {
  color: #8d91a0;
}

.input:hover {
  border-color: var(--ink-2);
}

.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--focus-halo);
}

.input[aria-invalid="true"] {
  border-color: var(--error);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(163, 34, 27, 0.18);
}

select.input {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink) 50%),
    linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 22px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: rgba(20, 24, 46, 0.06);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--ink);
  color: var(--white);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 10px 24px -14px rgba(20, 24, 46, 0.7);
}

.btn--primary:hover {
  background: #262b4a;
}

.btn--chrome {
  background: var(--chrome);
  border-color: rgba(20, 24, 46, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 6px 16px -10px rgba(20, 24, 46, 0.5);
}

.btn--chrome:hover {
  background: var(--chrome);
  filter: brightness(1.04);
}

.btn--danger {
  background: var(--error);
  border-color: var(--error);
  color: var(--white);
}

.btn--danger:hover {
  background: #861a14;
}

.btn--quiet {
  border-color: transparent;
  padding-inline: 14px;
}

.btn--small {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 0.9375rem;
}

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

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

.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 1;
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle, currentColor 0 18%, transparent 19% 100%),
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.95), #d4f0dc, #f6d8ea, rgba(255, 255, 255, 0.15));
  -webkit-mask: radial-gradient(circle, transparent 0 22%, #000 24%);
  mask: radial-gradient(circle, transparent 0 22%, #000 24%);
  animation: spin 0.9s linear infinite;
}

.btn[aria-busy="true"] .btn__spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Notices ---------- */

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.notice::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.notice--ok::before {
  background: #2f9e57;
}

.notice--warn {
  background: var(--warn-bg);
  border-color: rgba(150, 100, 0, 0.25);
}

.notice--warn::before {
  background: #c27c00;
}

.notice--error {
  background: var(--error-bg);
  border-color: rgba(163, 34, 27, 0.25);
}

.notice--error::before {
  background: var(--error);
}

/* ---------- Details / disclosure ---------- */

.disclosure {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.disclosure summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  list-style: none;
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure summary::before {
  content: "+";
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1;
}

.disclosure[open] summary::before {
  content: "−";
}

.disclosure__body {
  display: grid;
  gap: 10px;
  padding: 4px 0 12px 32px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 52ch;
}

/* ---------- Motion preferences ---------- */

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

  .btn__spinner {
    animation: none !important;
  }
}
