/* Hitchhiking design tokens + base primitives — single source of truth */
/* Fonts are local only (no Google Fonts / external CDN).
   @font-face inlined here (no CSS @import waterfall / unversioned duplicate fetch). */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn%5Bwght%5D.woff2?v=1.1.9") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Neutral light/dark brand — no blue accents */
  --hh-ink: #171717;
  --hh-muted: #525252;
  --hh-line: #e5e5e5;
  --hh-surface: #ffffff;
  --hh-field: #f5f5f5;
  --hh-accent: #262626;
  --hh-accent-2: #171717;
  --hh-teal: #404040;
  --hh-accent-grad: linear-gradient(180deg, #262626 0%, #404040 100%);
  --hh-accent-soft: rgba(23, 23, 23, 0.08);
  --hh-bg-1: #fafafa;
  --hh-bg-2: #f0f0f0;
  --hh-danger: #c24141;
  --hh-ok: #15803d;
  --hh-warn: #b45309;
  --hh-radius: 16px;
  --hh-radius-lg: 22px;
  --hh-shadow: 0 12px 40px rgba(23, 23, 23, 0.08);
  --hh-font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hh-btn-on-accent: #ffffff;

  /* Bridge legacy variables used across style.css */
  --primary-color: var(--hh-accent);
  --primary-dark: var(--hh-accent-2);
  --primary-light: #737373;
  --secondary-color: var(--hh-teal);
  --success-color: var(--hh-ok);
  --warning-color: var(--hh-warn);
  --danger-color: var(--hh-danger);
  --info-color: var(--hh-accent);
  --bg-primary: var(--hh-surface);
  --bg-secondary: var(--hh-bg-1);
  --bg-tertiary: var(--hh-field);
  --text-primary: var(--hh-ink);
  --text-secondary: var(--hh-muted);
  --text-muted: var(--hh-muted);
  --border-color: var(--hh-line);
  --border-light: #ececec;
}

@media (prefers-color-scheme: dark) {
  :root:not(.page-theme-light) {
    --hh-ink: #f5f5f5;
    --hh-muted: #a3a3a3;
    --hh-line: #3f3f46;
    --hh-surface: #171717;
    --hh-field: #262626;
    --hh-accent: #e5e5e5;
    --hh-accent-2: #fafafa;
    --hh-teal: #a3a3a3;
    --hh-accent-grad: linear-gradient(180deg, #e5e5e5 0%, #a3a3a3 100%);
    --hh-accent-soft: rgba(245, 245, 245, 0.1);
    --hh-bg-1: #0a0a0a;
    --hh-bg-2: #141414;
    --hh-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --hh-btn-on-accent: #0a0a0a;
    --primary-light: #d4d4d4;
    --bg-primary: var(--hh-surface);
    --bg-secondary: var(--hh-bg-1);
    --bg-tertiary: var(--hh-field);
    --text-primary: var(--hh-ink);
    --text-secondary: var(--hh-muted);
    --text-muted: var(--hh-muted);
    --border-color: var(--hh-line);
    --border-light: #262626;
    color-scheme: dark;
  }
}

html.page-theme-dark {
  --hh-ink: #f5f5f5;
  --hh-muted: #a3a3a3;
  --hh-line: #3f3f46;
  --hh-surface: #171717;
  --hh-field: #262626;
  --hh-accent: #e5e5e5;
  --hh-accent-2: #fafafa;
  --hh-teal: #a3a3a3;
  --hh-accent-grad: linear-gradient(180deg, #e5e5e5 0%, #a3a3a3 100%);
  --hh-accent-soft: rgba(245, 245, 245, 0.1);
  --hh-bg-1: #0a0a0a;
  --hh-bg-2: #141414;
  --hh-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --hh-btn-on-accent: #0a0a0a;
  --primary-light: #d4d4d4;
  --bg-primary: var(--hh-surface);
  --bg-secondary: var(--hh-bg-1);
  --bg-tertiary: var(--hh-field);
  --text-primary: var(--hh-ink);
  --text-secondary: var(--hh-muted);
  --text-muted: var(--hh-muted);
  --border-color: var(--hh-line);
  --border-light: #262626;
  color-scheme: dark;
}

.hh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--hh-radius);
  padding: 0.75rem 1rem;
  font-family: var(--hh-font);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.hh-btn:active {
  transform: scale(0.98);
}

.hh-btn--primary {
  background: var(--hh-accent-grad);
  color: var(--hh-btn-on-accent) !important;
  box-shadow: 0 8px 20px rgba(23, 23, 23, 0.18);
}

.hh-btn--ghost {
  background: var(--hh-field);
  border-color: var(--hh-line);
  color: var(--hh-ink) !important;
}

.hh-btn--link {
  background: transparent;
  color: var(--hh-accent) !important;
  padding-inline: 0.35rem;
}

.hh-panel {
  background: var(--hh-surface);
  border: 1px solid rgba(15, 42, 50, 0.08);
  border-radius: var(--hh-radius-lg);
  box-shadow: var(--hh-shadow);
  padding: 1rem 1.15rem;
}

.hh-field {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--hh-line);
  background: var(--hh-field);
  border-radius: var(--hh-radius);
  padding: 0.85rem 1rem;
  font: inherit;
  color: var(--hh-ink);
  outline: none;
}

.hh-field:focus {
  border-color: rgba(23, 23, 23, 0.45);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.12);
  background: var(--hh-surface);
}

html.page-theme-dark .hh-field:focus {
  border-color: rgba(245, 245, 245, 0.35);
  box-shadow: 0 0 0 3px rgba(245, 245, 245, 0.08);
}

.hh-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 42, 50, 0.45);
  backdrop-filter: blur(4px);
}

.hh-modal.is-hidden {
  display: none !important;
}

.hh-modal__content {
  width: min(440px, 100%);
  background: var(--hh-surface);
  border-radius: var(--hh-radius-lg);
  border: 1px solid var(--hh-line);
  box-shadow: var(--hh-shadow);
  overflow: hidden;
}

/* Native <dialog> is centered with UA margin:auto. The global * { margin:0 }
   reset pins it to the inline-start (right in RTL). Restore viewport center. */
dialog:modal,
dialog[open] {
  position: fixed;
  inset: 0;
  margin: auto;
}
