/* ============ Fonts (self-hosted — no third-party requests) ============ */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/playfair-display-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/playfair-display-900.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2');
}

/* ============ Design tokens ============ */
:root {
  --bg: #f5f0e8;
  --paper: #faf7f2;
  --ink: #1a1410;
  --ink-mid: #6b5f52;
  --ink-light: #a2937f;
  --accent: #c13d2e;
  --accent-2: #2e5fc1;
  --green: #1e7a4f;
  --amber: #a07414;
  --border: #d4c9ba;
  --shadow: rgba(26, 20, 16, 0.08);
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(193, 61, 46, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(46, 95, 193, 0.04) 0%, transparent 60%);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; }

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ============ Buttons ============ */
.btn {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 14px 28px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
}
.btn:hover { background: var(--accent); color: var(--bg); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--border); color: var(--ink-light); cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--bg); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-mid);
  padding: 10px 18px;
  font-size: 11px;
}
.btn-ghost:hover { background: transparent; border-color: var(--ink); color: var(--ink); }

.btn-small { padding: 8px 16px; font-size: 11px; }

/* ============ Forms ============ */
label.field-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mid);
  margin-bottom: 8px;
}

textarea, input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  border-radius: 0;
}
textarea { resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--ink); }
textarea::placeholder, input::placeholder { color: var(--ink-light); }

.field-hint { font-size: 11px; color: var(--ink-light); margin-top: 6px; }
.field-error { font-size: 11px; color: var(--accent); margin-top: 6px; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-mid);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: auto;
  margin-top: 3px;
  accent-color: var(--ink);
}

/* ============ Panels ============ */
.panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: 3px solid var(--ink);
  padding: 28px;
  box-shadow: 4px 4px 0 var(--border);
}

.eyebrow {
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-mid);
  display: block;
  margin-bottom: 12px;
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 100;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--paper);
  border: 1px solid var(--border);
  border-top: 4px solid var(--ink);
  max-width: 640px;
  width: 100%;
  padding: 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(26, 20, 16, 0.3);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink-mid);
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}
.modal-close:hover { color: var(--ink); }

/* ============ Toast ============ */
.toast-region {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(26, 20, 16, 0.3);
  animation: toast-in 0.25s ease;
  max-width: 90vw;
}
.toast.toast-error { background: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Badges / status ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--ink-mid);
  background: var(--paper);
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-light);
  flex-shrink: 0;
}
.badge.connected .badge-dot { background: var(--green); }
.badge.demo .badge-dot { background: var(--amber); }

/* ============ Spinner ============ */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 32px 0 48px;
  font-size: 11px;
  color: var(--ink-mid);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
  align-items: center;
}
.site-footer a { color: var(--ink-mid); }
.site-footer a:hover { color: var(--ink); }

@media (max-width: 600px) {
  .modal { padding: 24px 18px; }
  .panel { padding: 20px 16px; }
}
