/* =============================================
   INSV Refresh — Support page (donation + business contact)
   Topbar + footer + wordmark come from app-chrome.css.
   Tokens: variaveis.css (fs, space, radius, weight, brand-a, motion).
   ============================================= */

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

body {
  font-family: var(--font-ui);
  background: var(--surface-2, #F5F6FB);
  color: var(--text, var(--ink-800));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}

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

/* ── Content ───────────────────────────────── */
.support-content {
  flex: 1;
  padding: var(--space-12) var(--space-10) var(--space-14);
}

.support-layout {
  max-width: 880px;
  margin: 0 auto;
}

/* ── Heading ───────────────────────────────── */
/* Left-aligned like the settings and privacy pages it sits between. */
.support-header {
  margin-bottom: var(--space-8);
}

.support-header h1 {
  font-size: var(--fs-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  color: var(--text, var(--ink-800));
  margin-bottom: var(--space-2);
  text-wrap: balance;
}

.support-header p {
  font-size: var(--fs-base);
  line-height: var(--leading-normal);
  color: var(--text-muted, #6B7390);
  max-width: 60ch;
  text-wrap: pretty;
}

/* ── Grid ──────────────────────────────────── */
.support-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
  gap: var(--space-5);
  align-items: stretch;
}

/* ── Cards ─────────────────────────────────── */
.support-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #E5E7EF);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.support-card h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-heading);
  color: var(--text, var(--ink-800));
}

.card-icon {
  flex-shrink: 0;
  color: var(--brand-600);
}

/* Gold on the heart ties the donation to the Support entry in the sidebar.
   A deeper step on light surfaces, where gold-500 nearly vanishes on white. */
.card-icon.donate { color: var(--warning-500); }

.card-desc {
  font-size: var(--fs-sm);
  line-height: var(--leading-normal);
  color: var(--text-muted, #6B7390);
  max-width: 60ch;
}

.card-note {
  font-size: var(--fs-xs);
  line-height: var(--leading-snug);
  color: var(--text-muted, #6B7390);
}

/* The note closes the donation card, level with the business card's footer. */
#doar > .card-note { margin-top: auto; }

/* ── Donation form ─────────────────────────── */
#donate-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.amount-group {
  border: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.amount-chip {
  position: relative;
  cursor: pointer;
}

.amount-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.amount-chip span {
  display: block;
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--ink-200);
  font-size: var(--fs-base);
  font-weight: var(--weight-semibold);
  color: var(--text, var(--ink-800));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}

.amount-chip input:checked + span {
  background: color-mix(in srgb, var(--brand-500) 10%, transparent);
  border-color: var(--brand-500);
  color: var(--brand-700);
}

.amount-chip input:focus-visible + span {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.amount-chip:active span { transform: scale(0.97); }

.custom-amount {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.custom-amount-label {
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  color: var(--text, var(--ink-700));
}

.custom-amount-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  background: var(--surface, #fff);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.custom-amount-field:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-a15);
}

.custom-amount-prefix {
  font-weight: var(--weight-semibold);
  color: var(--ink-400);
}

.custom-amount-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--weight-semibold);
  color: var(--text, var(--ink-800));
  padding: 10px 0;
  font-variant-numeric: tabular-nums;
}

.custom-amount-field input::placeholder { color: var(--ink-400); }

.donate-status {
  min-height: 1.4em;
  font-size: var(--fs-sm);
  line-height: var(--leading-snug);
  color: var(--text-muted, #6B7390);
}

.donate-status[data-tone="ok"] { color: var(--success-700); }
.donate-status[data-tone="error"] { color: var(--danger-600); }

/* ── Business card ─────────────────────────── */
/* Informational, no control: what the feature is and why it ships off. */
.api-info {
  border-left: 3px solid var(--brand-500);
  background: color-mix(in srgb, var(--brand-500) 6%, transparent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: var(--space-3) var(--space-4);
}

.api-info h3 {
  font-size: var(--fs-sm);
  font-weight: var(--weight-semibold);
  color: var(--text, var(--ink-800));
  margin-bottom: var(--space-1);
}

.api-info p {
  font-size: var(--fs-xs);
  line-height: var(--leading-normal);
  color: var(--text-muted, #6B7390);
}

.business-cta {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Shown as text so it can be copied when no mail app is set up. */
.email-address {
  text-align: center;
  user-select: all;
}

/* ── Buttons ───────────────────────────────── */
.btn-support {
  width: 100%;
  padding: 11px var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  border: none;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
  text-decoration: none;
  text-align: center;
  font-family: inherit;
  display: block;
}

.btn-support:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.btn-support.primary {
  background: var(--brand-600); /* white on brand-500 is 2.93:1, below AA 3:1 for the primary CTA */
  color: #fff;
}

.btn-support.primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-support.outlined {
  background: transparent;
  color: var(--text, var(--ink-800));
  border: 1.5px solid var(--ink-200);
}

@media (hover: hover) and (pointer: fine) {
  .amount-chip:hover span { border-color: var(--brand-400); }
  .btn-support.primary:hover:not(:disabled) { background: var(--brand-700); }
  .btn-support.outlined:hover {
    background: var(--surface-2);
    border-color: var(--ink-300);
  }
}

/* Press feedback: the control dips the moment it is pressed. */
.btn-support:active:not(:disabled) { transform: scale(0.97); }

/* Toast styling is shared (showToast in scripts/util.js injects .insv-toast). */

/* ── Dark mode ─────────────────────────────── */
[data-theme="dark"] .support-header h1 { color: var(--ink-50); }
[data-theme="dark"] .support-header p  { color: var(--ink-300); }

[data-theme="dark"] .support-card {
  background: #11172A;
  border-color: rgb(255 255 255 / 0.1);
}

[data-theme="dark"] .support-card h2 { color: var(--ink-50); }
[data-theme="dark"] .card-icon { color: var(--brand-300); }
[data-theme="dark"] .card-icon.donate { color: var(--gold-500); }
[data-theme="dark"] .card-desc,
[data-theme="dark"] .card-note { color: var(--ink-300); }

[data-theme="dark"] .amount-chip span {
  color: var(--ink-50);
  border-color: rgb(255 255 255 / 0.2);
}

[data-theme="dark"] .amount-chip input:checked + span {
  background: color-mix(in srgb, var(--brand-500) 18%, transparent);
  border-color: var(--brand-400);
  color: var(--brand-200);
}

[data-theme="dark"] .custom-amount-label { color: var(--ink-200); }

[data-theme="dark"] .custom-amount-field {
  background: rgb(255 255 255 / 0.04);
  border-color: rgb(255 255 255 / 0.2);
}

[data-theme="dark"] .custom-amount-field:focus-within { border-color: var(--brand-400); }
[data-theme="dark"] .custom-amount-prefix { color: var(--ink-300); }
[data-theme="dark"] .custom-amount-field input { color: var(--ink-50); }
[data-theme="dark"] .custom-amount-field input::placeholder { color: var(--ink-400); }

[data-theme="dark"] .donate-status { color: var(--ink-300); }
[data-theme="dark"] .donate-status[data-tone="ok"] { color: var(--success-500); }
[data-theme="dark"] .donate-status[data-tone="error"] { color: var(--danger-500); }

[data-theme="dark"] .api-info { background: color-mix(in srgb, var(--brand-500) 12%, transparent); }
[data-theme="dark"] .api-info h3 { color: var(--ink-50); }
[data-theme="dark"] .api-info p { color: var(--ink-300); }

[data-theme="dark"] .btn-support.outlined {
  color: var(--ink-50);
  border-color: rgb(255 255 255 / 0.25);
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="dark"] .btn-support.outlined:hover {
    background: rgb(255 255 255 / 0.06);
    border-color: rgb(255 255 255 / 0.4);
  }
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .support-content { padding: var(--space-8) var(--space-4) var(--space-12); }
  .support-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .amount-group { grid-template-columns: repeat(2, 1fr); }
}

/* ── Reduced motion ────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Reduced motion is not "no feedback". What has to go is travel: transforms,
     slides, anything that moves across the screen. Opacity and colour still
     carry meaning, so they keep a short linear cross-fade. */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-property: opacity, color, background, background-color, border-color, box-shadow, fill, stroke !important;
    transition-duration: var(--dur-fast) !important;
    transition-timing-function: linear !important;
  }
  .btn-support:active:not(:disabled),
  .amount-chip:active span { transform: none; }
}
