/* ═══════════════════════════════════════════════════════════════
   STILLSTONE VAULT — DESIGN SYSTEM
   Custom dark-first palette. No light mode — the vault is always dark.
   ═══════════════════════════════════════════════════════════════ */

/* ── GOOGLE FONTS LOADED VIA HTML ── */

:root {
  /* Type Scale */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.2vw, 0.8125rem);
  --text-sm:   clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  --text-lg:   clamp(1.0625rem, 1rem + 0.4vw, 1.375rem);
  --text-xl:   clamp(1.25rem,   1.1rem + 0.7vw, 1.75rem);
  --text-2xl:  clamp(1.75rem,   1.4rem + 1.5vw, 2.75rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Font families */
  --font-display: 'IBM Plex Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
  --sidebar-width: 248px;
  --topbar-height: 52px;

  /* ── STILLSTONE CUSTOM DARK PALETTE ── */

  /* System surfaces */
  --color-bg:              #0A0A0A;
  --color-surface:         #111111;
  --color-surface-2:       #1A1A1A;
  --color-surface-offset:  #222222;
  --color-surface-offset-2: #2A2A2A;
  --color-surface-dynamic: #333333;

  /* Borders & dividers */
  --color-divider:         rgba(255,255,255,0.06);
  --color-border:          rgba(255,255,255,0.12);
  --color-border-subtle:   rgba(255,255,255,0.07);

  /* Text */
  --color-text:            #FFFFFF;
  --color-text-muted:      #888888;
  --color-text-faint:      #4A4A4A;
  --color-text-inverse:    #0A0A0A;

  /* Gold accent — drawer level only */
  --color-gold:            #C5A55A;
  --color-gold-hover:      #D4B46A;
  --color-gold-active:     #B0904A;
  --color-gold-subtle:     rgba(197, 165, 90, 0.10);
  --color-gold-border:     rgba(197, 165, 90, 0.25);

  /* Semantic */
  --color-error:           #C0564A;
  --color-error-subtle:    rgba(192, 86, 74, 0.10);

  /* Shadows */
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.35);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.45);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.55);
  --shadow-xl: 0 24px 64px oklch(0 0 0 / 0.65);
}

/* ═══════════════════════════════════════════════
   BASE RESET
   ═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.2;
  font-family: var(--font-display);
}
p, li { text-wrap: pretty; }

::selection {
  background: rgba(197, 165, 90, 0.25);
  color: var(--color-text);
}

:focus-visible {
  outline: 1.5px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

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

/* ═══════════════════════════════════════════════
   TYPOGRAPHY UTILITIES
   ═══════════════════════════════════════════════ */
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }

.text-primary { color: var(--color-text); }
.text-muted   { color: var(--color-text-muted); }
.text-faint   { color: var(--color-text-faint); }
.text-gold    { color: var(--color-gold); }

.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }

.label-caps {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--color-text-muted);
  font-family: var(--font-body);
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-interactive);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--color-gold);
  color: var(--color-text-inverse);
  border-color: var(--color-gold);
}
.btn-primary:hover { background: var(--color-gold-hover); border-color: var(--color-gold-hover); }
.btn-primary:active { background: var(--color-gold-active); }

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-offset); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.btn-ghost-danger {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}
.btn-ghost-danger:hover {
  color: var(--color-error);
  background: var(--color-error-subtle);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-full { width: 100%; }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-family: var(--font-body);
}

.form-input,
.form-textarea,
.form-select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--color-text-faint); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px var(--color-gold-subtle);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}
.form-select option { background: var(--color-surface-2); }

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15em var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-body);
  white-space: nowrap;
}

.badge-type {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-subtle);
}

.badge-gold {
  background: var(--color-gold-subtle);
  color: var(--color-gold);
  border: 1px solid var(--color-gold-border);
}

.badge-muted {
  background: var(--color-surface-2);
  color: var(--color-text-faint);
  border: 1px solid var(--color-border-subtle);
}

/* ═══════════════════════════════════════════════
   DIVIDERS
   ═══════════════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--color-divider);
}

.divider-gold {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(197, 165, 90, 0.35), transparent);
}

/* ═══════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--transition-slow);
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-gold);
  letter-spacing: -0.01em;
}

.modal-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

.modal-close {
  color: var(--color-text-faint);
  transition: color var(--transition-interactive);
  padding: var(--space-1);
  flex-shrink: 0;
}
.modal-close:hover { color: var(--color-text-muted); }

.modal-body { display: flex; flex-direction: column; gap: var(--space-5); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--color-surface-offset-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(8px);
  transition: all var(--transition-slow);
  pointer-events: auto;
  max-width: 280px;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ═══════════════════════════════════════════════
   FILE UPLOAD AREA
   ═══════════════════════════════════════════════ */
.upload-area {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-interactive);
  background: var(--color-surface-2);
}

.upload-area:hover {
  border-color: var(--color-gold-border);
  background: var(--color-surface-offset);
}

.upload-area-icon {
  color: var(--color-text-faint);
  margin: 0 auto var(--space-3);
  width: 32px;
  height: 32px;
}

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

.upload-area-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

/* ═══════════════════════════════════════════════
   LOGO SVG INLINE
   ═══════════════════════════════════════════════ */
.logo-mark { display: inline-block; }

/* ═══════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
