/* ============================================================
   RHM Design System v1 — Warm cream / amber editorial
   Inspired by The Browser Company, premium editorial sites
   ============================================================ */

:root {
  /* Surfaces */
  --bg:             #FAF7F2;
  --bg-soft:        #F5EFE6;
  --surface:        #FFFFFF;
  --surface-2:      #FAF8F3;
  --surface-3:      #F1EBDD;
  --border:         #DDD6C5;
  --border-subtle:  #ECE7D9;

  /* Text */
  --text:           #18181C;
  --text-2:         #2F2F38;       /* darker than #3F3F47 — body prose */
  --text-3:         #5A5852;       /* darker than #6B6B74 — captions, sub-text */
  --text-4:         #8A8479;       /* slightly darker than #9A9485 — disabled/placeholder */
  --text-on-dark:   #FFFFFF;
  --text-on-dark-2: rgba(255, 255, 255, 0.78);
  --text-on-dark-3: rgba(255, 255, 255, 0.62);

  /* Brand accent — warm amber */
  --accent:         #A6722A;
  --accent-soft:    #C58B3F;
  --accent-dim:     #7E5520;
  --accent-bg:      rgba(166, 114, 42, 0.10);

  /* Status */
  --success:        #1F8B5B;
  --success-bg:     rgba(31, 139, 91, 0.10);
  --warning:        #B57700;
  --warning-bg:     rgba(181, 119, 0, 0.10);
  --danger:         #C13C3C;
  --danger-bg:      rgba(193, 60, 60, 0.10);
  --info:           #2D6CB0;
  --info-bg:        rgba(45, 108, 176, 0.10);

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(24, 24, 28, 0.04);
  --shadow:    0 1px 3px rgba(24, 24, 28, 0.04), 0 8px 24px rgba(24, 24, 28, 0.05);
  --shadow-lg: 0 4px 12px rgba(24, 24, 28, 0.06), 0 24px 48px rgba(24, 24, 28, 0.10);

  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --max-w:    1200px;
  --header-h: 68px;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent); color: #FFFFFF; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

.num, .mono, .tnum,
input[type="number"], input[type="date"], input[type="time"] {
  font-variant-numeric: tabular-nums lining-nums;
}

h1, h2, h3, h4 {
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 400;
}
h1 em, h2 em, h3 em { color: var(--accent); font-style: italic; font-weight: 400; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  background: white;
  color: var(--text);
  transition: all 0.18s var(--ease-out);
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--text); color: white; border-color: var(--text);
}
.btn-primary:hover { background: #2B2A2F; border-color: #2B2A2F; }
.btn-accent {
  background: var(--accent); color: white; border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(166, 114, 42, 0.10);
}
.btn-accent:hover {
  background: var(--accent-dim); border-color: var(--accent-dim);
  box-shadow: 0 4px 12px rgba(166, 114, 42, 0.20);
}
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-2); }
.btn-on-dark {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.30); color: white;
}
.btn-on-dark:hover { border-color: white; background: rgba(255, 255, 255, 0.05); }
.btn-soft { background: var(--surface-2); border-color: var(--border-subtle); }
.btn-pill { border-radius: var(--radius-pill); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============================================================ FORMS */
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; margin-bottom: 0; }
.label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: white; color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 114, 42, 0.15);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.help-text { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500;
}
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-danger  { color: var(--danger);  background: var(--danger-bg);  }
.badge-info    { color: var(--info);    background: var(--info-bg);    }
.badge-muted   { color: var(--text-3);  background: var(--surface-3); }
.badge-accent  { color: var(--accent);  background: var(--accent-bg); }

/* ============================================================ CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-hover { transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out); }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; font-weight: 500; margin: 0; letter-spacing: -0.005em; }

/* ============================================================ TABLES */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 18px; text-align: left; font-size: 14px; }
.table thead th {
  font-size: 12px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--text-3); text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}
.table tbody tr { border-top: 1px solid var(--border-subtle); transition: background 0.15s; }
.table tbody tr:first-child { border-top: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .right { text-align: right; }
.table .center { text-align: center; }
.table .num { font-variant-numeric: tabular-nums lining-nums; }
.table a { color: var(--text); font-weight: 500; }
.table a:hover { color: var(--accent); }

/* ============================================================ EMPTY */
.empty { text-align: center; padding: 60px 24px; color: var(--text-3); }
.empty .icon { font-size: 32px; margin-bottom: 12px; }
.empty h3 { color: var(--text); font-size: 17px; font-weight: 500; margin: 0 0 6px; }

/* ============================================================ BRAND MARK */
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), var(--accent-dim));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em; position: relative;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset, 0 4px 12px rgba(126, 85, 32, 0.20);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), transparent 50%);
  pointer-events: none;
}
.brand-link { display: inline-flex; align-items: center; gap: 12px; }
.brand-link .name { font-weight: 600; font-size: 15px; letter-spacing: -0.005em; color: var(--text); }

/* ============================================================ FLASH */
.flash {
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 18px; font-size: 14px;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-bg); color: var(--success); border-color: rgba(31, 139, 91, 0.25); }
.flash-error,
.flash-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(193, 60, 60, 0.25); }
.flash-info    { background: var(--info-bg);    color: var(--info);    border-color: rgba(45, 108, 176, 0.25); }
.flash-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(181, 119, 0, 0.25); }

/* ============================================================ ANIMATIONS */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.5s var(--ease-out) both; }

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