/* ============================================================
   HUMANISTA DIGITAL — Design System CSS
   Adaptado para el test "¿Eres un humanista digital?"
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap");

:root {
  --background: #faf7f4;
  --foreground: #3c2029;
  --primary: #a82450;
  --primary-foreground: #fcfaf8;
  --secondary: #e9e1da;
  --secondary-foreground: #3c2029;
  --accent: #e8881e;
  --accent-foreground: #3c2029;
  --muted: #ede8e3;
  --muted-foreground: #7a6068;
  --card: #f8f5f2;
  --card-foreground: #3c2029;
  --border: #e2dade;
  --input: #e2dade;
  --ring: #a82450;
  --destructive: #dc2626;
  --destructive-foreground: #fcfaf8;
  --sidebar-bg: #2d1218;
  --sidebar-fg: #ede8e3;
  --sidebar-accent: #3a1a21;
  --sidebar-border: #4a2530;
  --sidebar-primary: #e8881e;
  --map-prof: #a82450;
  --map-entity: #e8780a;
  --map-project: #1e7ab5;
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(60, 32, 41, 0.05);
  --shadow-md: 0 4px 12px rgba(60, 32, 41, 0.08);
  --shadow-lg: 0 12px 34px rgba(60, 32, 41, 0.1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  color: var(--foreground);
  background:
    radial-gradient(circle at top left, rgba(232, 136, 30, 0.1), transparent 28rem),
    linear-gradient(180deg, rgba(250, 247, 244, 0.96), var(--background));
  font-family: "Source Sans 3", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--foreground);
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  color: var(--foreground);
  font-family: "Source Sans 3", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent);
}

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

button {
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--muted);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

.progress-shell {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background-color: rgba(250, 247, 244, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
  min-height: 65px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  color: var(--foreground);
  font-family: "Source Sans 3", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.brand::before {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(168, 36, 80, 0.12);
  content: "";
}

.progress-copy {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: right;
}

.progress-copy strong {
  color: var(--primary);
  font-weight: 700;
}

.progress-track {
  height: 4px;
  background: var(--secondary);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s ease;
}

.page-shell {
  width: min(1100px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2rem 0 4.5rem;
}

.intro {
  display: grid;
  gap: 0.75rem;
  max-width: 820px;
  margin-bottom: 1.5rem;
}

.eyebrow,
.step-heading span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted-foreground);
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before,
.step-heading span::before {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: var(--radius-full);
  background: var(--accent);
  content: "";
}

.intro p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted-foreground);
  font-size: 1.125rem;
}

.test-panel,
.result-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--card);
  box-shadow: var(--shadow-sm);
}

.form-step {
  display: none;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.form-step.is-active {
  display: block;
}

.step-heading {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.step-heading h2 {
  color: var(--foreground);
}

.step-heading p {
  max-width: 820px;
  color: var(--muted-foreground);
}

.field-grid {
  display: grid;
  gap: 1rem;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field span,
.field > label,
.radio-block legend,
.choice-block legend {
  color: var(--foreground);
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
}

.field-help {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.field strong,
.radio-block strong {
  color: var(--primary);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  color: var(--foreground);
  outline: none;
  padding: 0.5rem 0.75rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

select {
  -webkit-appearance: auto;
  appearance: auto;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--muted-foreground);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(168, 36, 80, 0.18);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea,
.choice-block.has-error,
.tag-field.has-error .tag-box,
.repeater-row.has-error {
  border-color: var(--destructive);
}

.counter {
  align-self: flex-end;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.error-message {
  min-height: 1.2em;
  color: var(--destructive);
  font-size: 0.8125rem;
  font-weight: 600;
}

.diagnostic-message {
  display: block;
  margin-top: 0.625rem;
}

.tag-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 46px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  padding: 0.35rem;
}

.tag-list {
  display: contents;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 0.35rem;
  border-radius: var(--radius-full);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.tag button {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border: 0;
  border-radius: var(--radius-full);
  background: rgba(60, 32, 41, 0.12);
  color: var(--foreground);
  line-height: 1;
}

.tag-box input {
  flex: 1 1 220px;
  min-width: 160px;
  border: 0;
  background: transparent;
  padding: 0.35rem;
  box-shadow: none;
}

.tag-box input:focus {
  box-shadow: none;
}

.choice-layout {
  display: grid;
  gap: 1.25rem;
}

.choice-block,
.radio-block {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: rgba(250, 247, 244, 0.72);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.choice-block legend,
.radio-block legend {
  padding: 0 0.5rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
  margin-top: 1rem;
}

.choice-item,
.radio-block label,
.toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.choice-item {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  color: var(--foreground);
  padding: 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease;
}

.choice-item:hover {
  border-color: rgba(168, 36, 80, 0.45);
  background-color: var(--secondary);
}

.choice-item:has(input:checked) {
  border-color: var(--primary);
  background-color: rgba(168, 36, 80, 0.08);
  color: var(--primary);
}

.choice-item input,
.radio-block input,
.toggle input {
  width: auto;
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

.radio-block {
  display: grid;
  gap: 0.75rem;
}

.radio-block label {
  color: var(--foreground);
  font-size: 0.9375rem;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.language-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.toggle {
  flex: 1 1 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--background);
  padding: 0.75rem;
  color: var(--foreground);
  font-weight: 600;
}

.toggle:hover {
  background-color: var(--secondary);
}

.language-option {
  flex-basis: auto;
}

.language-option:has(input:checked) {
  border-color: var(--primary);
  background-color: rgba(168, 36, 80, 0.08);
  color: var(--primary);
}

.repeater {
  display: grid;
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.repeater-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.repeater-heading h3 {
  color: var(--foreground);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.125rem;
}

.repeater-rows {
  display: grid;
  gap: 0.75rem;
}

.repeater-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: rgba(250, 247, 244, 0.72);
  padding: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.repeater-row.entity-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 130px 130px auto;
}

.repeater-row.project-row {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
}

.mini-field {
  display: grid;
  gap: 0.375rem;
}

.mini-field span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.remove-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 42px;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: var(--radius-sm);
  background-color: rgba(220, 38, 38, 0.08);
  color: var(--destructive);
  font-size: 1.25rem;
  font-weight: 700;
  transition:
    background-color 0.15s ease,
    transform 0.1s ease;
}

.remove-row:hover {
  background-color: rgba(220, 38, 38, 0.14);
}

.remove-row:active {
  transform: scale(0.98);
}

.row-error {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding: 1rem clamp(1.25rem, 4vw, 2rem);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.1s ease;
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.98);
}

.primary-button {
  border: none;
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.primary-button:hover {
  background-color: #941f46;
  color: var(--primary-foreground);
}

.secondary-button {
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.secondary-button:hover {
  background-color: #ddd5cc;
}

.result-panel {
  margin-top: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.result-heading {
  display: grid;
  gap: 0.625rem;
  max-width: 860px;
  margin-bottom: 1.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow-sm);
}

.result-heading h2 {
  color: var(--primary);
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 1.05;
}

.result-panel[data-result="positive"] .result-heading {
  border-color: rgba(168, 36, 80, 0.35);
  background:
    linear-gradient(135deg, rgba(168, 36, 80, 0.09), transparent 60%),
    var(--background);
}

.result-panel[data-result="partial"] .result-heading h2 {
  color: var(--accent);
}

.result-panel[data-result="negative"] .result-heading h2 {
  color: var(--foreground);
}

.result-heading p:last-child {
  color: var(--muted-foreground);
  font-size: 1.0625rem;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.25rem;
}

.result-grid article {
  min-width: 0;
}

.permission-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.recommendations-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.recommendations-intro {
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.recommendations-list {
  display: grid;
  gap: 0.875rem;
  margin-top: 0.875rem;
}

.recommendation-group {
  display: grid;
  gap: 0.5rem;
}

.recommendation-group h4 {
  color: var(--primary);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1rem;
}

.recommendation-item {
  display: grid;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--card);
  color: var(--foreground);
  padding: 0.75rem;
  text-decoration: none;
}

.recommendation-item:hover {
  border-color: rgba(168, 36, 80, 0.35);
  color: var(--foreground);
}

.recommendation-item span,
.recommendation-empty {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.permission-question {
  margin-top: 0.75rem;
  color: var(--foreground);
  font-size: 1.05rem;
  font-weight: 600;
}

.permission-note {
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.summary-list {
  display: grid;
  gap: 0.75rem;
}

.summary-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.summary-group h4 {
  margin-bottom: 0.625rem;
  color: var(--primary);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.05rem;
}

.summary-group dl {
  display: grid;
}

.summary-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 0.625rem;
  border-top: 1px solid var(--border);
  padding: 0.55rem 0;
}

.summary-item:first-of-type {
  border-top: 0;
}

.summary-item dt {
  color: var(--muted-foreground);
  font-weight: 600;
}

.summary-item dd {
  margin: 0;
  overflow-wrap: anywhere;
}

pre {
  max-height: 580px;
  overflow: auto;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
}

code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.875rem;
}

.json-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.75rem;
}

.copy-status {
  min-height: 1.4em;
  margin-top: 0.625rem;
  color: var(--primary);
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

@media (max-width: 920px) {
  .two-columns,
  .choice-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .repeater-row,
  .repeater-row.entity-row,
  .repeater-row.project-row {
    grid-template-columns: 1fr;
  }

  .remove-row {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .progress-top {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .page-shell {
    width: min(100% - 2rem, 1100px);
    padding-top: 1.5rem;
  }

  h1 {
    font-size: 1.85rem;
  }

  h2 {
    font-size: 1.35rem;
  }
}

@media (max-width: 640px) {
  .progress-top,
  .form-actions,
  .repeater-heading,
  .json-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-copy {
    justify-content: space-between;
    text-align: left;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .language-toggle {
    grid-template-columns: 1fr;
  }

  .summary-item {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }
}

@media (max-width: 480px) {
  .page-shell {
    width: min(100% - 1.25rem, 1100px);
  }

  .form-step,
  .result-panel {
    padding: 1rem;
  }
}
