/* ─── RBC PORTAL — BRAND TOKENS ─── */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Raleway:wght@300;400;500;600&display=swap');

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

:root {
  --navy:     #083A4F;
  --gold:     #A58D66;
  --aqua:     #C0D5D6;
  --teal:     #407E8C;
  --sand:     #E5E1DD;
  --charcoal: #2d2d2d;
  --muted:    #8a9a9e;
  --error:    #c0392b;
  --warning:  #e67e22;
  --success:  #27ae60;

  --gold-dim:    rgba(165,141,102, 0.4);
  --gold-glow:   rgba(165,141,102, 0.12);
  --navy-light:  #0a4d6a;
  --navy-deep:   #062a3a;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Cormorant Garamond', Garamond, serif;
  --font-ui:      'Raleway', 'Futura', sans-serif;

  --radius:    4px;
  --radius-lg: 8px;
  --shadow:    0 2px 12px rgba(0,0,0,0.15);
  --transition: 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--navy);
  color: var(--sand);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }

/* ─── TYPOGRAPHY ─── */

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--gold);
  line-height: 1.2;
}

h1 { font-size: clamp(28px, 5vw, 42px); letter-spacing: 0.02em; }
h2 { font-size: clamp(22px, 4vw, 32px); }
h3 { font-size: clamp(18px, 3vw, 24px); }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.6;
}

.body-serif {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: rgba(229,225,221, 0.7);
}

/* ─── LAYOUT ─── */

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

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

.page-header {
  text-align: center;
  padding: 48px 24px 36px;
  border-bottom: 1px solid var(--gold-dim);
}

.page-header .eyebrow { margin-bottom: 16px; }
.page-header h1 { margin-bottom: 8px; }

.page-header .subtitle {
  font-family: var(--font-body);
  font-size: 18px;
  color: rgba(229,225,221, 0.5);
  font-style: italic;
}

/* ─── CARDS ─── */

.card {
  background: rgba(255,255,255, 0.03);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--gold);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 18px;
  color: var(--sand);
}

/* ─── BUTTONS ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
}
.btn-primary:hover {
  background: #b89a72;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(165,141,102, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-secondary:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(192,57,43, 0.3);
}
.btn-danger:hover {
  background: rgba(192,57,43, 0.1);
  border-color: var(--error);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 11px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ─── FORMS ─── */

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--sand);
  background: rgba(255,255,255, 0.04);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition), background var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--gold);
  background: rgba(255,255,255, 0.06);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--muted);
  font-style: italic;
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
}

/* ─── BADGES ─── */

.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  line-height: 1.4;
}

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

.badge-teal {
  background: rgba(64,126,140, 0.15);
  color: var(--teal);
  border: 1px solid rgba(64,126,140, 0.3);
}

.badge-success {
  background: rgba(39,174,96, 0.12);
  color: var(--success);
  border: 1px solid rgba(39,174,96, 0.3);
}

.badge-warning {
  background: rgba(230,126,34, 0.12);
  color: var(--warning);
  border: 1px solid rgba(230,126,34, 0.3);
}

/* ─── TOAST ─── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: var(--sand);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 14px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow);
}

.toast.toast-error { border-color: var(--error); }
.toast.toast-success { border-color: var(--success); }

.toast.hiding {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(12px); }
}

/* ─── LOADING ─── */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,42,58, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--gold-dim);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── MODAL ─── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,42,58, 0.85);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--navy);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 22px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── NAV BAR ─── */

.portal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gold-dim);
}

.portal-nav .nav-brand {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.portal-nav .nav-brand span {
  font-weight: 400;
  color: var(--sand);
  opacity: 0.5;
  font-size: 14px;
  margin-left: 8px;
}

.portal-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal-nav .nav-link {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--transition);
  cursor: pointer;
}

.portal-nav .nav-link:hover {
  color: var(--gold);
}

/* ─── RULED LINES ─── */

.rule {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dim), transparent);
  margin: 32px 0;
}

.rule-gold {
  background: linear-gradient(to right, var(--gold), var(--teal), transparent);
}

/* ─── UTILITIES ─── */

.text-gold { color: var(--gold); }
.text-muted { color: var(--muted); }
.text-sand { color: var(--sand); }
.text-teal { color: var(--teal); }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ─── RESPONSIVE ─── */

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .card { padding: 24px 20px; }
  .page-header { padding: 36px 16px 28px; }
  .btn { padding: 12px 24px; }
  .modal { padding: 24px 20px; }
}
