/* ==========================================================================
   Components — buttons, cards, forms, chips, badges, modal, accordion
   ========================================================================== */

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

.btn {
  --btn-bg: var(--ink-900);
  --btn-fg: var(--text-invert);
  --btn-border: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0.8rem 1.5rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Primary — the brass gradient from the wordmark, on ink text. */
.btn--primary {
  --btn-fg: var(--ink-950);
  --btn-bg: none;
  background-image: var(--brass-gradient);
  background-size: 180% 100%;
  background-position: 0% 50%;
  box-shadow: 0 2px 10px rgba(138, 100, 32, 0.28);
  transition: background-position var(--dur-slow) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}

.btn--primary:hover {
  background-position: 100% 50%;
  box-shadow: 0 8px 24px rgba(138, 100, 32, 0.34);
}

.btn--ink {
  --btn-bg: var(--ink-900);
  --btn-fg: var(--text-invert);
}

.btn--ink:hover {
  --btn-bg: var(--ink-700);
}

/* Outline — adapts to whichever surface it sits on. */
.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);
}

.btn--outline:hover {
  --btn-border: var(--brass-500);
  --btn-fg: var(--accent-strong);
  background: var(--accent-soft);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  padding-inline: var(--sp-4);
}

.btn--ghost:hover {
  background: var(--surface-2);
  box-shadow: none;
  transform: none;
}

.btn--phone {
  --btn-bg: transparent;
  --btn-fg: var(--text-invert);
  --btn-border: rgba(255, 255, 255, 0.24);
  padding: 0.6rem 1.15rem;
  font-variant-numeric: tabular-nums;
}

.btn--phone:hover {
  --btn-border: var(--brass-500);
  --btn-fg: var(--brass-300);
  background: rgba(194, 147, 58, 0.12);
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: var(--fs-sm);
}

.btn--lg {
  padding: 1rem 1.9rem;
  font-size: var(--fs-lg);
}

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

/* Text link with an arrow that nudges on hover. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--accent-strong);
  text-decoration: none;
}

.link-arrow svg {
  width: 15px;
  height: 15px;
  transition: transform var(--dur-base) var(--ease-out);
}

.link-arrow:hover svg {
  transform: translateX(4px);
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}

.card--interactive:hover {
  transform: translateY(-3px);
  border-color: var(--brass-300);
  box-shadow: var(--shadow-lg);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--sp-5);
  border-radius: var(--r-md);
  background: var(--brass-100);
  color: var(--brass-700);
  border: 1px solid var(--brass-200);
}

.card__icon svg {
  width: 22px;
  height: 22px;
}

.card h3 {
  margin-bottom: var(--sp-3);
}

.card p {
  color: var(--text-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
}

.card__note {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--line-strong);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brass-700);
}

.card__footer {
  margin-top: auto;
  padding-top: var(--sp-6);
}

/* ---------- Chips / badges / pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge--brass {
  background: var(--brass-100);
  border-color: var(--brass-200);
  color: var(--brass-800);
}

.badge--ink {
  background: var(--ink-800);
  border-color: transparent;
  color: var(--text-invert);
}

.badge--success {
  background: var(--success-100);
  border-color: transparent;
  color: var(--success-600);
}

.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

.field {
  display: grid;
  gap: var(--sp-2);
  /* Keep label+control pinned to the top: side-by-side fields stretch to a
     shared height, and without this a field carrying a hint would push its
     neighbour's input out of alignment. */
  align-content: start;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.field__label .req {
  color: var(--danger-600);
  margin-left: 2px;
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: var(--fs-base);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-subtle);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--brass-400);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brass-500);
  box-shadow: var(--ring);
}

.textarea {
  min-height: 148px;
  resize: vertical;
  line-height: var(--lh-normal);
}

.select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2359697A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 16px;
  cursor: pointer;
}

/* Invalid state is applied by JS after a blur/submit, never on first paint. */
.field.is-invalid .input,
.field.is-invalid .textarea,
.field.is-invalid .select {
  border-color: var(--danger-600);
  background-color: var(--danger-100);
}

.field.is-invalid .input:focus,
.field.is-invalid .textarea:focus,
.field.is-invalid .select:focus {
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.18);
}

.field__error {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--danger-600);
}

.field.is-invalid .field__error {
  display: flex;
}

/* Spam honeypot — hidden from people, reachable by naive bots. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--brass-600);
  cursor: pointer;
}

/* Search input with a leading icon and a clear button. */
.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field__icon {
  position: absolute;
  left: 0.9rem;
  width: 17px;
  height: 17px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-field .input {
  padding-left: 2.6rem;
  padding-right: 2.4rem;
}

.search-field__clear {
  position: absolute;
  right: 0.55rem;
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  color: var(--text-subtle);
  transition: background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.search-field__clear:hover {
  background: var(--surface-2);
  color: var(--text);
}

.search-field.has-value .search-field__clear {
  display: inline-flex;
}

.search-field__clear svg {
  width: 14px;
  height: 14px;
}

/* ---------- Form status banner ---------- */

.form-status {
  display: none;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

.form-status.is-visible {
  display: flex;
}

.form-status svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.form-status--success {
  background: var(--success-100);
  color: var(--success-600);
}

.form-status--error {
  background: var(--danger-100);
  color: var(--danger-600);
}

/* ---------- Accordion ---------- */

.accordion {
  border-top: 1px solid var(--line);
}

.accordion__item {
  border-bottom: 1px solid var(--line);
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  width: 100%;
  padding: var(--sp-5) 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  text-align: left;
  color: var(--text);
  transition: color var(--dur-fast) var(--ease-out);
}

.accordion__trigger:hover {
  color: var(--brass-700);
}

.accordion__icon {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.accordion__icon::before,
.accordion__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 2px;
  border-radius: 2px;
  background: var(--brass-600);
  transform: translate(-50%, -50%);
  transition: transform var(--dur-base) var(--ease-out),
    opacity var(--dur-base) var(--ease-out);
}

.accordion__icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.accordion__trigger[aria-expanded="true"] .accordion__icon::after {
  transform: translate(-50%, -50%) rotate(0deg);
  opacity: 0;
}

.accordion__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-base) var(--ease-out);
}

.accordion__panel[data-open="true"] {
  grid-template-rows: 1fr;
}

.accordion__panel > div {
  overflow: hidden;
}

.accordion__panel p {
  padding-bottom: var(--sp-6);
  max-width: 68ch;
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

/* ---------- Modal / drawer ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--gutter);
  opacity: 0;
  visibility: hidden;
  /* `visibility` is stepped, not eased: it flips to visible immediately on
     open (so the dialog is focusable straight away) and is delayed until
     after the fade on close. Transitioning it like opacity would leave the
     dialog visibility:hidden during the fade-in, and .focus() on a hidden
     element is silently a no-op. */
  transition: opacity var(--dur-base) var(--ease-out),
    visibility 0s linear var(--dur-base);
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 14, 23, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: min(86vh, 800px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  transform: translateY(14px) scale(0.985);
  transition: transform var(--dur-base) var(--ease-out);
}

.modal.is-open .modal__dialog {
  transform: none;
}

.modal__close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-800);
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.modal__close:hover {
  background: #fff;
  transform: rotate(90deg);
}

.modal__close svg {
  width: 17px;
  height: 17px;
}

/* ---------- Skeleton loading ---------- */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.72),
    transparent
  );
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    display: none;
  }
}

/* ---------- Empty / error state ---------- */

.state {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  padding: var(--sp-20) var(--sp-6);
  text-align: center;
}

.state__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: var(--r-pill);
  background: var(--brass-100);
  color: var(--brass-600);
}

.state__icon svg {
  width: 26px;
  height: 26px;
}

.state h3 {
  font-size: var(--fs-xl);
}

.state p {
  max-width: 46ch;
  color: var(--text-muted);
}
