/*
 * The "Pergaminho, vinho e latão" theme of the MENTORJUDI app, carried to the
 * web. Every value comes from the app's `src/theme` (colors.ts, typography.ts,
 * spacing.ts), not from the backoffice: the portal is where the lawyer meets
 * the colleague, the same place the app is.
 *
 * - brass is an accent, never a background (brand manual);
 * - protocol red only for real time and urgency;
 * - Instrument Serif for display, IBM Plex Sans for body, IBM Plex Mono for
 *   whatever the profession treats as a record (OAB, dates, times, labels).
 */
:root {
  --paper: #f4ece2;
  --paper-light: #fbf6f0;
  --paper-2: #eee2d4;
  --paper-3: #e6d8c8;
  --line: #dcccbd;
  --line-strong: #c7b09e;
  --ink: #2b171a;
  --ink-soft: #5f4c4a;
  --ink-muted: #8c7b77;
  --wine: #5b1a23;
  --wine-light: #6b2029;
  --wine-deep: #42121a;
  --wine-dark: #2a0c11;
  --ebony: #1b1214;
  --ebony-raised: #3a2528;
  --gold: #c39a45;
  --gold-ink: #8a6a22;
  --gold-light: #e2c98c;
  --red: #c4402c;
  --red-deep: #a8321f;
  --red-light: #f0a088;
  --green: #2e6b48;
  --green-light: #8fd3ae;
  --cream: #f6eee4;
  --cream-muted: #c9b3af;

  --gold-tint-16: rgba(195, 154, 69, 0.16);
  --gold-tint-30: rgba(195, 154, 69, 0.3);
  --gold-tint-45: rgba(195, 154, 69, 0.45);
  --gold-tint-60: rgba(195, 154, 69, 0.6);
  --shadow: rgba(42, 12, 17, 0.28);

  --room-bg: #2a0c11;
  --room-surface: #3a141b;
  --room-control: #3e161d;
  --room-control-lit: #4e2029;
  --room-border: rgba(195, 154, 69, 0.3);

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 30px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.47;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

/* ---------- Type ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mono {
  font-family: var(--font-mono);
}

.brass {
  color: var(--gold-ink);
}

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.05em;
  color: var(--cream);
}

.wordmark b {
  font-weight: 400;
  color: var(--gold);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s,
    opacity 0.2s;
}

.btn svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: var(--cream);
  background: linear-gradient(180deg, var(--wine-light), var(--wine) 55%, var(--wine-deep));
  border-color: var(--gold-tint-60);
  box-shadow:
    inset 0 1px 0 rgba(226, 201, 140, 0.25),
    0 6px 18px -8px rgba(42, 12, 17, 0.7);
}

.btn-primary:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(226, 201, 140, 0.35),
    0 10px 26px -10px rgba(42, 12, 17, 0.85);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: var(--paper-2);
}

.btn-live {
  color: #fff;
  background: linear-gradient(180deg, #d24c37, var(--red) 55%, var(--red-deep));
  border-color: rgba(240, 160, 136, 0.55);
  box-shadow: 0 10px 28px -10px rgba(196, 64, 44, 0.8);
}

.btn-live:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 14px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-light);
  color: var(--ink-soft);
  transition: background 0.2s;
}

.icon-btn:hover {
  background: var(--paper-2);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Fields ---------- */

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--paper-light);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.control:focus-within {
  border-color: var(--wine);
  box-shadow: 0 0 0 4px rgba(91, 26, 35, 0.12);
}

.control > svg {
  width: 20px;
  height: 20px;
  margin-left: 14px;
  color: var(--gold-ink);
  flex: none;
}

.control input,
.control select {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 14px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.control select {
  appearance: none;
  cursor: pointer;
  font-family: var(--font-mono);
}

.control .chevron {
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  margin: 0;
  pointer-events: none;
  color: var(--ink-muted);
}

.control .reveal {
  margin-right: 6px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  padding: 8px;
  border-radius: 8px;
}

.control .reveal svg {
  width: 20px;
  height: 20px;
  display: block;
}

.field.invalid .control {
  border-color: var(--red);
}

.field-error {
  font-size: 12.5px;
  color: var(--red-deep);
  min-height: 0;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(246, 238, 228, 0.35);
  border-top-color: var(--cream);
  animation: spin 0.8s linear infinite;
}

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

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