/*
 * Copyright (C) 2026 Dr. Carlos Galera Román. Todos los derechos reservados.
 * Proyecto «Todos a una» (Unidad VIH, HCUV Arrixaca, Murcia).
 * Software propietario — uso prohibido sin autorización expresa. Ver LICENSE.
 */

/* =========================================================
   Todos a una — hoja de estilos
   WebApp de información para pacientes · Unidad VIH HUVA
   ========================================================= */

:root {
  --primary: #0f8a7e;
  --primary-strong: #0a6b61;
  --primary-050: #e7f4f2;
  --primary-100: #c9e6e1;
  --navy: #173a52;
  --ink: #21323b;
  --muted: #576973;
  --bg: #ffffff;
  --bg-soft: #f1f7f6;
  --line: #d7e4e3;
  --ok-bg: #e6f4ee;
  --ok-line: #b6dcc8;
  --ok-text: #1f6b46;
  --note-bg: #fdf3df;
  --note-line: #ecd8a6;
  --note-text: #855200;
  --danger: #b22a22;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(23, 58, 82, .08), 0 2px 6px rgba(23, 58, 82, .06);
  --shadow-md: 0 8px 26px rgba(23, 58, 82, .13);
  --maxw: 1060px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
ul, ol { padding-left: 1.25rem; }
a { color: var(--primary-strong); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; font-weight: 700; }

:focus-visible {
  outline: 3px solid var(--primary-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.15rem; }
.stack > * + * { margin-top: 1.15rem; }
.text-center { text-align: center; }
.lead { font-size: 1.2rem; color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: .5rem; top: -120px;
  background: var(--navy); color: #fff; padding: .7rem 1.1rem;
  border-radius: 0 0 10px 10px; z-index: 300; font-weight: 700; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--primary-strong); color: #fff; }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 68px;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand__logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.18; }
.brand__name { font-size: 1.2rem; font-weight: 700; }
.brand__sub { font-size: .72rem; font-weight: 500; opacity: .85; letter-spacing: .2px; }

.nav { display: flex; gap: .15rem; }
.nav a {
  display: block; color: #fff; text-decoration: none;
  padding: .55rem .85rem; border-radius: 9px; font-weight: 600; font-size: 1.02rem;
}
.nav a:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .22); }

.nav-toggle {
  display: none; align-items: center; gap: .45rem;
  background: rgba(255, 255, 255, .12); color: #fff; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 1rem;
  padding: .55rem .85rem; border-radius: 9px;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .22); }
.nav-toggle svg { width: 22px; height: 22px; }

/* ---------- Hero (inicio) ---------- */
.hero { background: linear-gradient(155deg, #0a6b61 0%, #0d7d6f 100%); color: #fff; }
.hero__inner { padding-block: 3rem 3.2rem; }
.hero h1 { color: #fff; font-size: 2.15rem; max-width: 19ch; }
.hero p { margin-top: .9rem; font-size: 1.22rem; max-width: 48ch; color: #eafaf7; }
.hero__actions { margin-top: 1.7rem; display: flex; flex-wrap: wrap; gap: .8rem; }

/* ---------- Cabecera de página interior ---------- */
.page-head { background: var(--primary-050); border-bottom: 1px solid var(--primary-100); }
.page-head__inner { padding-block: 2.3rem; }
.page-head h1 { font-size: 1.95rem; }
.page-head p { margin-top: .6rem; color: var(--muted); font-size: 1.15rem; max-width: 62ch; }
.breadcrumb { font-size: .95rem; margin-bottom: .55rem; color: var(--muted); }
.breadcrumb a { font-weight: 600; }

/* ---------- Secciones ---------- */
.section { padding-block: 2.8rem; }
.section--soft { background: var(--bg-soft); }
.section__head { margin-bottom: 1.5rem; }
.section__head h2 { font-size: 1.6rem; }
.section__head p { margin-top: .4rem; color: var(--muted); max-width: 62ch; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; font-size: 1.06rem;
  padding: .8rem 1.5rem; min-height: 54px;
  border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn--primary { background: var(--primary-strong); color: #fff; }
.btn--primary:hover { background: var(--navy); color: #fff; }
.btn--ghost { background: #fff; color: var(--primary-strong); border-color: var(--primary-strong); }
.btn--ghost:hover { background: var(--primary-050); color: var(--primary-strong); }
.btn--light { background: #fff; color: var(--primary-strong); }
.btn--light:hover { background: #eafaf7; color: var(--primary-strong); }
.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn--outline-light:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* ---------- Tarjetas ---------- */
.card-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-sm);
}
a.card {
  text-decoration: none; color: inherit; display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
a.card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.card__icon {
  width: 52px; height: 52px; border-radius: 13px;
  background: var(--primary-050); color: var(--primary-strong);
  display: grid; place-items: center; margin-bottom: 1rem; flex: none;
}
.card__icon svg { width: 27px; height: 27px; }
.card h3 { font-size: 1.2rem; margin-bottom: .35rem; }
.card p { color: var(--muted); font-size: 1.02rem; }
.card__cta {
  margin-top: auto; padding-top: .9rem; color: var(--primary-strong); font-weight: 700;
  display: inline-flex; align-items: center; gap: .35rem;
}
a.card:hover .card__cta { gap: .6rem; }

/* ---------- Avisos / callouts ---------- */
.callout {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: 1.1rem 1.25rem; border-radius: var(--radius);
  border: 1px solid var(--primary-100); background: var(--primary-050); color: var(--navy);
  font-size: 1.03rem;
}
.callout svg { width: 26px; height: 26px; flex: none; }
.callout p + p { margin-top: .4rem; }
.callout a { color: inherit; font-weight: 700; }
.callout--note { background: var(--note-bg); border-color: var(--note-line); color: var(--note-text); }
.callout--ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }

/* ---------- Acordeón (details/summary) ---------- */
.acc-list > .acc:last-child { margin-bottom: 0; }
.acc {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; margin-bottom: .85rem; box-shadow: var(--shadow-sm);
}
.acc > summary {
  list-style: none; cursor: pointer;
  padding: 1.1rem 1.25rem; font-weight: 700; color: var(--navy); font-size: 1.14rem;
  display: flex; align-items: center; gap: .8rem;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
  content: ""; flex: none; margin-left: auto;
  width: .6em; height: .6em;
  border-right: 3px solid currentColor; border-bottom: 3px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease;
}
.acc[open] > summary::after { transform: rotate(-135deg); }
.acc > summary:hover { color: var(--primary-strong); }
.acc__body { padding: 0 1.25rem 1.3rem; }
.acc__body p { margin-bottom: .6rem; }
.acc__body ul { display: grid; gap: .4rem; }

/* ---------- Pasos ---------- */
.steps { display: grid; gap: 1.1rem; }
@media (min-width: 740px) { .steps--row { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.step { display: flex; gap: .95rem; align-items: flex-start; }
.step__num {
  flex: none; width: 40px; height: 40px; border-radius: 999px;
  background: var(--primary-strong); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
}
.step h3 { font-size: 1.1rem; margin-bottom: .2rem; }
.step p { color: var(--muted); font-size: 1.01rem; }

/* ---------- Formularios ---------- */
.form { max-width: 620px; }
.fieldset { border: 0; padding: 0; margin: 0; }
.fieldset > legend { font-weight: 700; color: var(--navy); font-size: 1.05rem; margin-bottom: .55rem; padding: 0; }
.field { margin-bottom: 1.35rem; }
.field > label { display: block; font-weight: 700; color: var(--navy); margin-bottom: .35rem; }
.field .hint { font-size: .96rem; color: var(--muted); margin-bottom: .5rem; }
.req { color: var(--danger); }
.optional { font-weight: 500; color: var(--muted); font-size: .95rem; }
input[type="email"], input[type="text"], select, textarea {
  width: 100%; font: inherit; font-size: 1.05rem;
  padding: .75rem .85rem; min-height: 54px;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
input[type="email"]:focus, input[type="text"]:focus, select:focus, textarea:focus { border-color: var(--primary-strong); }
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem; line-height: 1.5; resize: vertical; min-height: 160px;
}
.checks { display: grid; gap: .6rem; }
.check {
  display: flex; gap: .7rem; align-items: flex-start;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: .75rem .9rem; cursor: pointer;
}
.check:hover { border-color: var(--primary-100); background: var(--primary-050); }
.check input { flex: none; width: 24px; height: 24px; margin-top: .12rem; accent-color: var(--primary-strong); cursor: pointer; }
.check span { font-weight: 600; color: var(--ink); }
.field--error input, .field--error select { border-color: var(--danger); }
.error-msg { display: block; color: var(--danger); font-weight: 700; font-size: .98rem; margin-top: .4rem; }
.error-msg:empty { display: none; }
.form__actions { margin-top: 1.5rem; }

/* ---------- Listado de recursos ---------- */
.res-list { display: grid; gap: .9rem; }
.res-item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow-sm);
}
.res-item h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.res-meta { margin-top: .55rem; font-size: .98rem; color: var(--muted); }
.res-meta a { font-weight: 700; }
.pending {
  display: inline-block; font-size: .82rem; font-weight: 700;
  color: var(--note-text); background: var(--note-bg);
  border: 1px solid var(--note-line); border-radius: 6px; padding: .05rem .4rem;
}

/* ---------- Texto largo (privacidad) ---------- */
.prose { max-width: 70ch; }
.prose h2 { font-size: 1.35rem; margin-top: 2rem; }
.prose h3 { font-size: 1.12rem; margin-top: 1.3rem; }
.prose p, .prose ul { margin-top: .7rem; }
.prose li { margin-bottom: .3rem; }

/* ---------- Tabla de datos ---------- */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table.data { border-collapse: collapse; width: 100%; min-width: 460px; font-size: 1rem; }
table.data th, table.data td { text-align: left; padding: .7rem .8rem; border: 1px solid var(--line); vertical-align: top; }
table.data thead th { background: var(--primary-050); color: var(--navy); }

/* ---------- Pie ---------- */
.site-footer { background: var(--navy); color: #c6d4dc; padding-block: 2.5rem 1.6rem; font-size: 1rem; }
.site-footer a { color: #fff; }
.site-footer__grid { display: grid; gap: 1.7rem; grid-template-columns: 1.6fr 1fr 1.2fr; }
.site-footer h2 { color: #fff; font-size: 1.05rem; margin-bottom: .7rem; }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: .4rem; }
.site-footer__brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.site-footer__brand img { width: 36px; height: 36px; border-radius: 9px; }
.site-footer__brand span { color: #fff; font-weight: 700; font-size: 1.1rem; }
.footer-disclaimer { font-size: .95rem; color: #aebec8; }
.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, .16); margin-top: 1.8rem; padding-top: 1.2rem;
  font-size: .9rem; color: #9aabb6;
  display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; justify-content: space-between;
}

/* ---------- Panel de administración ---------- */
.admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--line); margin-bottom: .25rem;
}
.admin-bar p { margin: 0; }
.btn--small { padding: .4rem .9rem; min-height: 36px; font-size: .95rem; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--primary-050); padding: .05rem .35rem; border-radius: 4px; font-size: .92em;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    flex-direction: column; gap: .15rem;
    background: var(--primary-strong); padding: .5rem 1.15rem 1rem;
    box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .85rem .85rem; font-size: 1.06rem; }
  .site-footer__grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 1.06rem; }
  .hero h1 { font-size: 1.78rem; }
  .hero p { font-size: 1.1rem; }
  .page-head h1 { font-size: 1.6rem; }
  .section__head h2 { font-size: 1.4rem; }
  .hero__actions { flex-direction: column; }
  .hero__actions .btn { width: 100%; }
  .form__actions .btn { width: 100%; }
  .site-footer__bottom { flex-direction: column; }
}
