/* Haftam design tokens and base styles (specs 01 and 08). Shared by the Angular app and the static pages as /css/styles.css. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/InterVariable.woff2") format("woff2");
}

:root {
  --brand: #0f4c5c;
  --brand-strong: #0b3a47;
  --brand-tint: #e6f0f2;
  --accent: #f2a93b;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --border: #e2dfd8;
  --text: #1d2327;
  --muted: #5e666d;
  --good: #1e7b4f;
  --warn: #a35f00;
  --bad: #b3261e;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius-card: 12px;
  --radius-control: 10px;
  --duration: 180ms;
  --content-width: 640px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration: 0ms;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-3);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--brand);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-strong);
}

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

.num {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: var(--text-sm);
}

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

/* Icons: Font Awesome Free paths as inline SVG (shared/icon.ts, landing page), so no icon font has to load. */
.fa {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
  fill: currentColor;
}

.fa.spin {
  animation: spin 1s steps(8) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .fa.spin {
    animation: none;
  }
}

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

/* Layout */

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}

.stack > * + * {
  margin-top: var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.spread {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Wordmark */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--brand);
  font-weight: 600;
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.wordmark svg {
  width: 26px;
  height: 20px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: 0 var(--space-5);
  border: 1px solid var(--brand);
  border-radius: var(--radius-control);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration) ease-out, border-color var(--duration) ease-out;
}

.btn:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--brand);
}

.btn-secondary:hover {
  background: var(--brand-tint);
  color: var(--brand-strong);
}

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

.btn-danger:hover {
  background: #8f1e18;
  border-color: #8f1e18;
}

.btn-small {
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

.btn-block {
  width: 100%;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-danger {
  color: var(--bad);
}

/* Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field > label,
.label {
  font-weight: 500;
}

.hint {
  color: var(--muted);
  font-size: var(--text-sm);
}

.input,
select.input,
textarea.input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid #c9c5bc;
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-md);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
}

.input:focus {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 0;
}

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

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .input {
  flex: 1;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .addon {
  flex: none;
}

.input-group .addon {
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  padding: 0 var(--space-3);
  border: 1px solid #c9c5bc;
  border-left: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
}

button.addon {
  color: var(--brand);
  font-weight: 500;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: 44px;
  padding-top: var(--space-2);
  cursor: pointer;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 48px;
  cursor: pointer;
}

.switch input {
  appearance: none;
  flex: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 14px;
  background: #c9c5bc;
  cursor: pointer;
  transition: background-color var(--duration) ease-out;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--duration) ease-out;
}

.switch input:checked {
  background: var(--brand);
}

.switch input:checked::after {
  transform: translateX(20px);
}

.error-text {
  color: var(--bad);
  font-size: var(--text-sm);
}

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

@media (min-width: 560px) {
  .form-grid.two {
    grid-template-columns: 1fr 1fr;
  }
}

/* Cards, badges, alerts */

.card {
  padding: var(--space-5) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.card-raised {
  box-shadow: 0 1px 2px rgba(29, 35, 39, 0.06), 0 4px 16px rgba(29, 35, 39, 0.06);
}

.card > :last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.badge-good {
  border-color: currentColor;
  color: var(--good);
}

.badge-warn {
  border-color: currentColor;
  color: var(--warn);
}

.badge-bad {
  border-color: currentColor;
  color: var(--bad);
}

.badge-brand {
  border-color: var(--brand-tint);
  background: var(--brand-tint);
  color: var(--brand);
}

.badge-accent {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text);
}

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.alert > .fa {
  margin-top: 4px;
}

.alert p:last-child {
  margin-bottom: 0;
}

.alert-info {
  border-color: var(--brand-tint);
  background: var(--brand-tint);
  color: var(--brand-strong);
}

.alert-warn {
  border-color: #f0d9b5;
  background: #fdf6ea;
  color: #6b3f00;
}

.alert-error {
  border-color: #efc4c1;
  background: #fcf0ef;
  color: #8f1e18;
}

.good {
  color: var(--good);
}

.warn {
  color: var(--warn);
}

.bad {
  color: var(--bad);
}

.divider {
  height: 1px;
  margin: var(--space-4) 0;
  border: 0;
  background: var(--border);
}

/* Footer (Angular and static pages) */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-sm);
}

.site-footer .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}

.site-footer a {
  color: var(--muted);
}

.site-footer p {
  max-width: 72ch;
}

/* Legal pages */

.legal h1 {
  margin-top: var(--space-4);
}

.legal h2 {
  margin-top: var(--space-6);
  font-size: var(--text-lg);
}

.legal .summary {
  margin: var(--space-4) 0 var(--space-5);
}

.legal li {
  margin-bottom: var(--space-2);
}

@media print {
  body {
    background: #fff;
  }
}

app-password-input,
app-amount-input {
  display: block;
}

fieldset > legend + * {
  clear: both;
}
