/* ===== DESIGN TOKENS ===== */
:root {
  /* Type Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);

  /* 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.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

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

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'Inter', sans-serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;

  /* Content */
  --content-default: 960px;
}

/* ===== LIGHT MODE (default) ===== */
:root,
[data-theme='light'] {
  --color-bg: #f5f3eb;
  --color-surface: #ffffff;
  --color-surface-2: #fafaf7;
  --color-surface-offset: #edeae2;
  --color-divider: rgba(0, 0, 0, 0.06);
  --color-border: rgba(0, 0, 0, 0.12);

  --color-text: #111111;
  --color-text-muted: #555555;
  --color-text-faint: #999999;
  --color-text-inverse: #ffffff;

  --color-primary: #1248ff;
  --color-primary-deep: #0b1f8f;
  --color-primary-hover: #0035d9;
  --color-primary-active: #0028a8;

  --color-accent: #ffb400;
  --color-accent-hover: #e6a200;
  --color-accent-light: rgba(255, 180, 0, 0.12);

  --color-warning-bg: #ffb400;
  --color-success: #22863a;
  --color-error: #d03e3e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* ===== DARK MODE ===== */
[data-theme='dark'] {
  --color-bg: #0f0f12;
  --color-surface: #1a1a20;
  --color-surface-2: #222229;
  --color-surface-offset: #16161c;
  --color-divider: rgba(255, 255, 255, 0.08);
  --color-border: rgba(255, 255, 255, 0.12);

  --color-text: #e4e4e7;
  --color-text-muted: #9b9ba3;
  --color-text-faint: #5c5c66;
  --color-text-inverse: #111111;

  --color-primary: #4d7aff;
  --color-primary-deep: #6b93ff;
  --color-primary-hover: #3a6aff;
  --color-primary-active: #2a5aee;

  --color-accent: #ffc940;
  --color-accent-hover: #ffbe1a;
  --color-accent-light: rgba(255, 201, 64, 0.1);

  --color-warning-bg: #2e2200;
  --color-success: #3fb950;
  --color-error: #f85149;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f0f12;
    --color-surface: #1a1a20;
    --color-surface-2: #222229;
    --color-surface-offset: #16161c;
    --color-divider: rgba(255, 255, 255, 0.08);
    --color-border: rgba(255, 255, 255, 0.12);
    --color-text: #e4e4e7;
    --color-text-muted: #9b9ba3;
    --color-text-faint: #5c5c66;
    --color-text-inverse: #111111;
    --color-primary: #4d7aff;
    --color-primary-deep: #6b93ff;
    --color-primary-hover: #3a6aff;
    --color-primary-active: #2a5aee;
    --color-accent: #ffc940;
    --color-accent-hover: #ffbe1a;
    --color-accent-light: rgba(255, 201, 64, 0.1);
    --color-warning-bg: #2e2200;
    --color-success: #3fb950;
    --color-error: #f85149;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

/* ===== LAYOUT ===== */
.page {
  max-width: var(--content-default);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
}

/* ===== HEADER ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-logo {
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--color-text);
}

.brand-subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  white-space: nowrap;
  gap: var(--space-2);
  line-height: 1.4;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-ghost:hover {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

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

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* ===== CHIP ===== */
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  background: var(--color-accent);
  color: #000;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ===== HERO ===== */
.hero {
  display: grid;
  gap: var(--space-8);
  margin-top: var(--space-4);
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.08;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.hero-text h2 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.4;
}

.hero-text > p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-base);
  line-height: 1.65;
}

.hero-bullets {
  display: grid;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.hero-bullet {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.hero-bullet-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--color-accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.hero-bullet-icon svg {
  width: 18px;
  height: 18px;
  color: var(--color-accent);
}

[data-theme='dark'] .hero-bullet-icon svg {
  color: var(--color-accent);
}

.hero-bullet strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--color-text);
}

.hero-bullet span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Hero Sidebar */
.hero-side {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  align-self: start;
}

.hero-side h3 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary-deep);
  margin-bottom: var(--space-4);
}

.hero-side ol {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-left: var(--space-5);
  display: grid;
  gap: var(--space-2);
}

.hero-side li::marker {
  color: var(--color-primary);
  font-weight: 700;
}

.hero-side small {
  display: block;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

@media (min-width: 768px) {
  .hero {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ===== SECTIONS ===== */
section {
  margin-top: clamp(var(--space-10), 5vw, var(--space-16));
}

section > h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

section > p.lead {
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  font-size: var(--text-base);
  line-height: 1.65;
}

/* ===== TIMELINE ===== */
.timeline {
  display: grid;
  gap: var(--space-6);
}

.timeline-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
}

.timeline-step .badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  flex-shrink: 0;
}

.timeline-step h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.timeline-step p {
  grid-column: 2;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

/* ===== FORM ===== */
.form-wrapper {
  margin-top: var(--space-6);
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: var(--space-8) var(--space-6);
  box-shadow: var(--shadow-sm);
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.form-step-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  white-space: nowrap;
}

.progress {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-divider);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
  border-radius: var(--radius-full);
  transition: width 400ms ease;
}

/* Form Nav */
.form-nav {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.form-nav-item {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-faint);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 180ms ease;
}

.form-nav-item:hover {
  color: var(--color-text-muted);
}

.form-nav-item.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.form-nav-item.completed {
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
  color: var(--color-success);
  border-color: color-mix(in srgb, var(--color-success) 20%, transparent);
}

/* Form Sections */
.form-section {
  display: none;
}

.form-section.active {
  display: block;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.form-section-help {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.55;
}

/* Fields */
.field {
  margin-bottom: var(--space-5);
}

.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.field small {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

.field-help {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
  font-weight: 400;
}

input[type='text'],
input[type='email'],
input[type='tel'],
input[type='number'],
input[type='url'],
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

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

/* Radio & Checkbox Options */
.options {
  display: grid;
  gap: var(--space-2);
}

.option-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease;
}

.option-item:hover {
  background: var(--color-surface-offset);
}

.option-item input[type='radio'],
.option-item input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
}

/* Pill Options */
.pill-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.pill-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all 150ms ease;
  user-select: none;
}

.pill-option:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pill-option.selected {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.pill-option input {
  display: none;
}

/* Likert Table */
.likert-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

.likert-table thead th {
  padding: var(--space-2) var(--space-2);
  text-align: center;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-divider);
  font-size: var(--text-xs);
}

.likert-table thead th:first-child {
  text-align: left;
  width: 50%;
}

.likert-table tbody td {
  padding: var(--space-3) var(--space-2);
  text-align: center;
  border-bottom: 1px solid var(--color-divider);
  color: var(--color-text);
}

.likert-table tbody td:first-child {
  text-align: left;
  font-size: var(--text-sm);
  line-height: 1.4;
  padding-right: var(--space-4);
}

.likert-table input[type='radio'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Figures Table (admira/nao admira) */
.figures-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

.figures-table thead th {
  padding: var(--space-2) var(--space-3);
  text-align: center;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-divider);
  font-size: var(--text-xs);
}

.figures-table thead th:first-child {
  text-align: left;
}

.figures-table tbody td {
  padding: var(--space-2) var(--space-3);
  text-align: center;
  border-bottom: 1px solid var(--color-divider);
}

.figures-table tbody td:first-child {
  text-align: left;
  color: var(--color-text);
  font-weight: 500;
}

.figures-table input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Warning Box */
.warning-box {
  margin-top: var(--space-6);
  background: var(--color-warning-bg);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: #000;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

[data-theme='dark'] .warning-box {
  background: var(--color-accent-light);
  color: var(--color-accent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
}

.warning-box strong {
  font-weight: 700;
}

.warning-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
  line-height: 1;
}

/* Checkbox confirm */
.confirm-field {
  margin-top: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.confirm-field input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

/* Form Footer */
.form-footer {
  margin-top: var(--space-8);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}

.form-footer-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* Form Nav Buttons */
.form-nav-buttons {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: clamp(var(--space-10), 5vw, var(--space-16));
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
}

/* ===== MOBILE ===== */
@media (max-width: 767px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero-text h1 {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
  }

  .form-wrapper {
    padding: var(--space-5) var(--space-4);
  }

  .likert-table {
    font-size: 0.75rem;
  }

  .likert-table thead th:first-child,
  .likert-table tbody td:first-child {
    min-width: 120px;
  }

  .figures-table {
    font-size: var(--text-xs);
  }

  .form-nav {
    gap: var(--space-1);
  }

  .form-nav-item {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
  }
}

/* ===== SCROLL REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Success State */
.form-success {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.form-success h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.form-success p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 480px;
  margin: 0 auto;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-success) 12%, transparent);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-4);
}

/* Required marker */
.req {
  color: var(--color-error, #d03e3e);
  font-weight: 400;
}

/* Validation error state */
.field.field-error input,
.field.field-error textarea,
.field.field-error select {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-error) 12%, transparent);
}

.field.field-error .options,
.field.field-error .pill-options {
  border: 1.5px solid var(--color-error);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.field-error-msg {
  display: block;
  color: var(--color-error);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
  font-weight: 500;
}

/* Character counter */
.char-counter {
  display: flex;
  justify-content: flex-end;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  font-variant-numeric: tabular-nums;
}

.char-counter.over-limit {
  color: var(--color-error);
  font-weight: 600;
}

/* Saved indicator */
.save-indicator {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 100;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.save-indicator.visible {
  opacity: 1;
  transform: translateY(0);
}

.save-indicator svg {
  width: 14px;
  height: 14px;
  color: var(--color-success);
}
