/* BartekFinanse — Gold-Rimmed Vault
   Single source of truth for colors. Screens use vault-* utility
   classes from assets/vault-utilities.css (no CDN).
   Do not hardcode HEX in screens; change tokens here only. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Serif";
  src: url("fonts/IBMPlexSerif-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* HEX (Flutter ColorScheme / ThemeExtension) */
  --bg: #16171C;
  --raised: #1A1B21;
  --surface: #1F212A;
  --hover: #2A2C36;
  --input: #181A21;
  --fg: #F2F1ED;
  --muted: #9A9CA8;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --accent: #E3A94D;
  --sage: #7FBF8F;
  --coral: #D97B77;
  --amber: #D6A85A;

  /* RGB channels for Tailwind opacity modifiers (bg-vault-amber/10) */
  --rgb-bg: 22 23 28;
  --rgb-raised: 26 27 33;
  --rgb-surface: 31 33 42;
  --rgb-hover: 42 44 54;
  --rgb-input: 24 26 33;
  --rgb-fg: 242 241 237;
  --rgb-muted: 154 156 168;
  --rgb-accent: 227 169 77;
  --rgb-sage: 127 191 143;
  --rgb-coral: 217 123 119;
  --rgb-amber: 214 168 90;

  /* OKLCh mirrors (docs / future CSS-native theming) */
  --oklch-bg: oklch(0.205 0.008 275);
  --oklch-surface: oklch(0.245 0.012 275);
  --oklch-fg: oklch(0.955 0.006 95);
  --oklch-muted: oklch(0.685 0.015 275);
  --oklch-accent: oklch(0.78 0.12 80);

  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 100ms;
  --dur: 150ms;
  --dur-enter: 220ms;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  overflow-x: hidden;
}
.font-display { font-family: "IBM Plex Serif", Georgia, serif; }
.tabular { font-variant-numeric: tabular-nums; }
.tracking-caps { letter-spacing: 0.08em; }
.tracking-ui { letter-spacing: 0.02em; }
.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;
}
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@keyframes pulse-dot {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
.pulse-dot { animation: pulse-dot 1.2s ease-in-out infinite; }
.pulse-dot:nth-child(2) { animation-delay: 0.15s; }
.pulse-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes spin-soft {
  to { transform: rotate(360deg); }
}
.spin-soft { animation: spin-soft 0.8s linear infinite; }
.safe-screen {
  min-height: 100dvh;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}
.btn-press {
  transition: transform var(--dur-fast) var(--ease-out), filter var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.btn-press:active:not(:disabled) { transform: translateY(1px); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.06); }
.btn-gold:active:not(:disabled) { filter: brightness(0.96); }
.btn-sage:hover:not(:disabled) { filter: brightness(1.05); }
.btn-disabled,
button:disabled,
a[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  filter: none;
  transform: none;
}
.surface-hover:hover { background-color: var(--hover); }
dialog::backdrop { background: rgba(10, 11, 14, 0.72); }

/* Bottom tab bar — ghost tabs (no UA button chrome) */
.tab-bar {
  z-index: 40;
  background-color: var(--surface);
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 64px;
  height: 52px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0.75rem;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.tab-item:hover {
  color: var(--fg);
  background-color: transparent !important;
}
.tab-item[aria-current="page"],
.tab-item.is-active {
  color: var(--accent);
}
.tab-item span {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
}
.tab-item[aria-current="page"] span,
.tab-item.is-active span {
  font-weight: 600;
}
.tab-fab-slot {
  position: relative;
  width: 72px;
  height: 52px;
  flex-shrink: 0;
}
.tab-fab {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 41;
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  border: 0;
  background-color: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px -8px rgba(227, 169, 77, 0.55);
}
.tab-fab.btn-press:active:not(:disabled) {
  transform: translateX(-50%) translateY(1px);
}

/* Pager: parchment when current — never gold (gold budget) */
.pager-dot {
  height: 6px;
  width: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.2);
  transition: background-color var(--dur) var(--ease-out);
}
.pager-dot[aria-current="step"] {
  width: 22px;
  background: var(--fg);
}

/* ModeSelectCard selection chrome (03-setup) */
.mode-card {
  display: block;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 14px;
  position: relative;
  transition: border-color var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.mode-card.is-selected {
  border-width: 2px;
  border-color: var(--accent);
}
.mode-card .mode-check {
  height: 20px;
  width: 20px;
  border-radius: 9999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.mode-card.is-selected .mode-check {
  border-color: var(--accent);
  background: var(--raised);
}

/* Lightweight toast for stub / empty / error feedback */
.vault-toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  z-index: 40;
  max-width: min(92vw, 360px);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-enter) var(--ease-out), transform var(--dur-enter) var(--ease-out);
}
.vault-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.vault-toast[data-tone="error"] {
  border-color: rgba(217, 123, 119, 0.35);
  color: var(--coral);
}
.vault-toast[data-tone="warn"] {
  border-color: rgba(214, 168, 90, 0.35);
  color: var(--amber);
}

.vault-empty {
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: var(--raised);
  padding: 28px 20px;
  text-align: center;
}
.vault-empty h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.vault-empty p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot,
  .spin-soft {
    animation: none !important;
  }
  .pulse-dot {
    opacity: 1;
    transform: none;
  }
  .btn-press,
  .pager-dot,
  .mode-card,
  .vault-toast {
    transition: none !important;
  }
  .btn-press:active:not(:disabled) {
    transform: none;
  }
}
