:root {
  --bg-page: #f5f7fa;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border-color: #dbe3ec;
  --accent: #1e3a5f;
  --accent-soft: #e8eef5;
  --info-bg: #eff6ff;
  --info-border: #2563eb;
  --warn-bg: #fffbeb;
  --warn-border: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

a:hover {
  color: #10253f;
}

/* Cabecera institucional minimalista */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.875rem 1rem;
}

.site-header-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: var(--accent);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
}

.jurisdiction-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Contenedor principal */
.main-container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  flex: 1;
}

/* Vistas de estado (raíz y 404) */
.status-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.status-card {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  text-align: center;
}

.status-brand {
  display: inline-block;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  background-color: var(--accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.status-card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  line-height: 1.3;
  color: var(--text-main);
}

.status-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.975rem;
}

/* Artículo de orientación */
.doc-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}

.badge-category {
  background-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.doc-title {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--text-main);
}

.doc-description {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.doc-description p:first-child {
  margin-top: 0;
}

.doc-description p:last-child {
  margin-bottom: 0;
}

.doc-section {
  margin-top: 1.5rem;
}

.section-heading {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Requisitos */
.prereq-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}

.prereq-list li + li {
  margin-top: 0.4rem;
}

/* Pasos */
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.step-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.95rem;
  background-color: #fcfdff;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.4rem;
}

.step-number {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  font-size: 0.825rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}

.step-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.step-detail {
  color: var(--text-secondary);
  padding-left: 0;
  margin-top: 0.35rem;
}

.step-detail p:first-child {
  margin-top: 0;
}

.step-detail p:last-child {
  margin-bottom: 0;
}

/* Figuras e imágenes */
.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.media-figure {
  margin: 0.75rem 0 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-subtle);
}

.media-figure img {
  width: 100%;
  background-color: #ffffff;
}

.media-caption {
  padding: 0.55rem 0.75rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* Tablas responsivas */
.table-title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 420px;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

th {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

/* Callouts: notas y advertencias */
.callout-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.callout {
  border-radius: 8px;
  padding: 0.85rem 1rem;
  border-left: 4px solid;
  font-size: 0.95rem;
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-info {
  background-color: var(--info-bg);
  border-color: var(--info-border);
  color: #1e3a8a;
}

.callout-warn {
  background-color: var(--warn-bg);
  border-color: var(--warn-border);
  color: #78350f;
}

/* Preguntas frecuentes */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-surface);
  padding: 0.75rem 0.9rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-main);
  list-style-position: inside;
  line-height: 1.45;
}

.faq-answer {
  margin-top: 0.55rem;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.faq-answer p:first-child {
  margin-top: 0;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Descargas y enlaces */
.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resource-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-subtle);
}

.resource-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.resource-label {
  font-weight: 600;
  color: var(--text-main);
}

.resource-note {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background-color: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-link:hover {
  background-color: #162c49;
  color: #ffffff;
}

/* Pie de página discreto */
.site-footer {
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 640px) {
  .main-container {
    padding: 2rem 1.25rem 3rem;
  }

  .doc-card {
    padding: 2rem 2rem;
  }

  .doc-title {
    font-size: 1.75rem;
  }

  .step-detail {
    padding-left: 2.25rem;
    margin-top: 0;
  }

  .status-card {
    padding: 2.5rem 2rem;
  }
}

@media print {
  body {
    background-color: #ffffff;
  }

  .doc-card {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .btn-link {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: none;
  }
}
