/* Sitio público — Ildefonso Gómez
   Rediseño: base fría y sobria, tipografía editorial para titulares, tarjetas con jerarquía y pie oscuro. */

:root {
  --bg: #FFFFFF;
  --bg-raised: #F3F5F6;      /* bandas alternas de sección */
  --surface: #FFFFFF;        /* tarjetas */
  --text: #15222B;
  --text-secondary: #4F5D66;
  --border: #DCE2E6;
  --accent: #1F4A5C;
  --accent-strong: #163847;
  --accent-soft: #E3EDF1;
  --on-accent: #FFFFFF;
  --alert-error-bg: #F7E6E4;
  --alert-error-text: #8E3830;
  --footer-bg: #11232C;
  --footer-text: #E8EEF1;
  --footer-muted: #9FB1BA;
  --footer-line: #25404C;
  --footer-link: #A9CFDF;
  --radius: 12px;
  --radius-sm: 8px;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --gutter: 32px;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1417; --bg-raised: #141B1F; --surface: #192126; --text: #E9EEF1;
    --text-secondary: #A3B0B8; --border: #28333A; --accent: #8DB8CB; --accent-strong: #A9CFDF;
    --accent-soft: #1D3039; --on-accent: #0F1417;
    --alert-error-bg: #3A2220; --alert-error-text: #F0B4AE;
    --footer-bg: #0A0F12; --footer-line: #1F2B31;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1417; --bg-raised: #141B1F; --surface: #192126; --text: #E9EEF1;
  --text-secondary: #A3B0B8; --border: #28333A; --accent: #8DB8CB; --accent-strong: #A9CFDF;
  --accent-soft: #1D3039; --on-accent: #0F1417;
  --alert-error-bg: #3A2220; --alert-error-text: #F0B4AE;
  --footer-bg: #0A0F12; --footer-line: #1F2B31;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* Bandas de sección: alternan fondo para dar estructura sin líneas por todas partes */
body > section:nth-of-type(odd) { background: var(--bg-raised); }

/* ------------------------------------------------------------------ */
/* Cabecera y menú                                                     */
/* ------------------------------------------------------------------ */
header.site {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 14px max(var(--gutter), calc((100% - var(--maxw)) / 2 + var(--gutter)));
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.site-name {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
}
.site-name::before {
  content: "IG"; display: inline-grid; place-items: center; width: 34px; height: 34px;
  background: var(--accent); color: var(--on-accent); border-radius: 8px;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
}
nav.site { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
nav.site a {
  text-decoration: none; color: var(--text-secondary); font-size: 0.95rem; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-sm); transition: color .15s ease, background-color .15s ease;
}
nav.site a:hover { color: var(--text); background: var(--bg-raised); }
nav.site a.current { color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------------ */
/* Botones y enlaces                                                   */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 0.98rem; font-weight: 600; text-decoration: none;
  padding: 13px 24px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.link, .field .link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.97rem; font-weight: 600; text-decoration: none; color: var(--accent);
}
.link::after {
  content: ""; width: 7px; height: 7px; border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .15s ease;
}
.link:hover::after { transform: translateX(3px) rotate(45deg); }
.link:hover { color: var(--accent-strong); }

/* ------------------------------------------------------------------ */
/* Hero de la home                                                     */
/* ------------------------------------------------------------------ */
.hero { padding: 88px 0 96px; }
.hero .wrap { display: grid; grid-template-columns: 1.25fr 1fr; gap: 72px; align-items: center; }
.hero .wrap > * { min-width: 0; }
.hero h1 {
  font-weight: 500; font-size: clamp(2.5rem, 5.2vw, 4rem); line-height: 1.07; letter-spacing: -0.02em;
  margin: 0 0 28px; max-width: 15ch;
}
.hero .lede { font-size: 1.2rem; line-height: 1.6; color: var(--text-secondary); max-width: 44ch; margin: 0 0 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 40px; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; padding-top: 28px; border-top: 1px solid var(--border); }
.hero .location { margin: 0; font-size: 0.95rem; color: var(--text-secondary); }
.hero .location .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 10px; vertical-align: middle; }
/* object-position prioriza la parte alta de la foto: en un retrato, ahí está la cara. */
.hero-photo {
  aspect-ratio: 4 / 5; width: 100%; object-fit: cover; object-position: 50% 15%; display: block;
  border-radius: var(--radius); box-shadow: 16px 16px 0 var(--accent-soft);
}
.hero-photo.placeholder {
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 0.85rem; text-align: center; padding: 24px;
}
.social-links { display: flex; gap: 8px; margin: 0; }
.social-links a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--text-secondary);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.social-links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Único momento animado de la página: la portada se asienta al cargar */
@keyframes settle { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hero .wrap > * { animation: settle .6s cubic-bezier(.2,.7,.2,1) both; }
.hero .wrap > *:nth-child(2) { animation-delay: .12s; }

/* ------------------------------------------------------------------ */
/* Secciones comunes                                                   */
/* ------------------------------------------------------------------ */
section.practice, section.about, section.facts, section.approach, section.projects,
section.featured-book, section.materials, section.contact, section.blog-list { padding: 88px 0; }
section.next { padding: 64px 0; }

section.practice > .wrap > h2,
section.projects h2, section.materials > .wrap > h2,
.about-grid h2, .approach-grid h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.2; margin: 0; max-width: 24ch;
}
section.practice > .wrap > h2, section.projects h2 { margin-bottom: 48px; }

/* Tríptico de los tres sectores */
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.field {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; transition: border-color .15s ease;
}
.field:hover { border-color: var(--accent); }
.field .icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 24px;
  background: var(--accent-soft); color: var(--accent); border-radius: 10px;
}
.field .icon svg { width: 24px; height: 24px; }
.field .kicker { font-size: 0.88rem; color: var(--text-secondary); font-weight: 500; margin: 0 0 6px; }
.field h3 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 14px; }
.field p { color: var(--text-secondary); font-size: 1rem; margin: 0 0 28px; }
.field .link { margin-top: auto; }

/* Sobre mí / Cómo trabajo / Libro / Contacto: dos columnas */
.about-grid, .approach-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 64px; align-items: start; }
.about-grid p, .approach-grid p { color: var(--text-secondary); font-size: 1.1rem; max-width: 62ch; margin: 0 0 20px; }
.about-grid p:last-child, .approach-grid p:last-child { margin-bottom: 0; }

/* Cabecera de página interna */
.page-hero { padding: 48px 0 72px; }
.breadcrumb {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
}
.breadcrumb:hover { color: var(--accent); }
.page-hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.3rem); line-height: 1.1; letter-spacing: -0.02em; margin: 28px 0 20px; max-width: 20ch; }
.page-hero .lede { font-size: 1.18rem; color: var(--text-secondary); max-width: 56ch; margin: 0; }
.page-hero .hero-link { margin: 28px 0 0; }

/* Datos clave (cuidado sociosanitario) */
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 28px 26px; }
.fact .num { font-family: var(--serif); font-size: 2.4rem; line-height: 1.1; font-weight: 500; color: var(--accent); margin: 0 0 10px; }
.fact .label { font-size: 0.98rem; color: var(--text-secondary); margin: 0; }

/* Lista de proyectos (informática) */
.project-list { display: grid; gap: 20px; }
.project {
  display: grid; grid-template-columns: 1fr 1.8fr; gap: 40px; padding: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.project .kicker { font-size: 0.88rem; color: var(--accent); font-weight: 600; }
.project h3 { font-size: 1.45rem; line-height: 1.2; margin: 8px 0 0; }
.project p { color: var(--text-secondary); font-size: 1.02rem; margin: 0 0 18px; max-width: 58ch; }
.project .stack { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; }
.project .stack span {
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
  padding: 4px 12px; border-radius: 999px; margin: 0;
}
.empty-state {
  color: var(--text-secondary); font-size: 1rem; padding: 40px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Libros (escritura) */
.book-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 64px; align-items: start; }
.book-status { display: inline-block; font-size: 0.85rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin: 0 0 16px; }
.book-grid h2 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); line-height: 1.15; margin: 0 0 6px; }
.book-grid .by { font-size: 0.95rem; color: var(--text-secondary); margin: 0 0 24px; }
.book-grid p.synopsis { color: var(--text-secondary); font-size: 1.1rem; max-width: 60ch; margin: 0 0 28px; }
.book-cover { width: 100%; max-width: 220px; margin-top: 20px; border-radius: 6px; box-shadow: 8px 8px 0 var(--accent-soft); }

section.next p { color: var(--text-secondary); font-size: 1.05rem; margin: 0; max-width: 58ch; }
section.next .label { font-size: 0.95rem; font-weight: 600; color: var(--accent); margin: 0 0 8px; }

/* Materiales descargables */
.materials-intro { color: var(--text-secondary); font-size: 1.1rem; max-width: 60ch; margin: 16px 0 0; }
.material-group { margin-top: 56px; }
.material-group h3 { font-size: 1.45rem; margin: 0 0 6px; }
.material-group .group-desc { color: var(--text-secondary); font-size: 1rem; margin: 0; max-width: 60ch; }
.material-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.material-card {
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 24px;
}
.material-card > :not(.material-thumb) { margin-left: 8px; margin-right: 8px; }
.material-thumb {
  width: 100%; aspect-ratio: 4 / 3; background: var(--accent-soft); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 18px;
}
.material-thumb img { width: 100%; height: 100%; object-fit: cover; }
.material-thumb .ext { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; }
.material-card h4 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 6px; }
.material-card p { color: var(--text-secondary); font-size: 0.97rem; margin: 0 0 10px; }
.material-card .material-meta { font-size: 0.85rem; margin: 0 0 16px; }
.material-card .link { margin-top: auto; }

/* ------------------------------------------------------------------ */
/* Contacto                                                            */
/* ------------------------------------------------------------------ */
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 64px; align-items: start; }
.direct h2 { font-size: 1.5rem; margin: 0 0 24px; }
.direct .item { margin: 0 0 22px; }
.direct .item .k { font-size: 0.88rem; color: var(--text-secondary); margin: 0 0 2px; }
.direct .item .v { font-size: 1.08rem; margin: 0; }
.direct a.v { color: var(--accent); font-weight: 600; text-decoration: none; }
.direct a.v:hover { text-decoration: underline; text-underline-offset: 3px; }

form.contact-form {
  display: flex; flex-direction: column; gap: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px;
}
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group label { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.field-group input, .field-group textarea {
  font-family: var(--sans); font-size: 1rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; transition: border-color .15s ease, box-shadow .15s ease;
}
.field-group input:focus, .field-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-group textarea { resize: vertical; min-height: 140px; }
.submit-row { margin-top: 4px; }
button.send {
  font-family: var(--sans); font-size: 1rem; font-weight: 600;
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: var(--radius-sm); padding: 14px 30px; cursor: pointer;
  transition: background-color .15s ease;
}
button.send:hover { background: var(--accent-strong); }
.form-note { font-size: 0.85rem; color: var(--text-secondary); margin-top: 10px; }
.alert { font-size: 0.95rem; padding: 14px 18px; border-radius: var(--radius-sm); margin: 0 0 24px; }
.alert-success { background: var(--accent-soft); color: var(--accent); }
.alert-error { background: var(--alert-error-bg); color: var(--alert-error-text); }

/* ------------------------------------------------------------------ */
/* Blog                                                                */
/* ------------------------------------------------------------------ */
.article-list { display: grid; gap: 20px; }
.article-row {
  display: grid; grid-template-columns: 1fr 1.8fr; gap: 40px; padding: 28px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.article-row time { font-size: 0.88rem; color: var(--text-secondary); }
.article-row h3 { font-size: 1.4rem; line-height: 1.25; margin: 6px 0 0; }
.article-row p { color: var(--text-secondary); font-size: 1.02rem; margin: 0 0 14px; max-width: 60ch; }
article.article-single { padding: 72px 0 96px; }
article.article-single h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); line-height: 1.12; letter-spacing: -0.02em; margin: 20px 0 10px; }
article.article-single time { font-size: 0.92rem; color: var(--text-secondary); }
article.article-single .cover { margin: 36px 0; border-radius: var(--radius); }
article.article-single .body { font-family: var(--serif); font-size: 1.25rem; line-height: 1.7; max-width: 66ch; }
article.article-single .body p { margin: 0 0 24px; }

/* ------------------------------------------------------------------ */
/* Pie de página                                                       */
/* ------------------------------------------------------------------ */
footer.site { background: var(--footer-bg); color: var(--footer-text); padding: 72px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; align-items: start; }
footer.site h2 { font-size: 1.9rem; line-height: 1.15; margin: 0 0 14px; font-weight: 500; }
footer.site .email { color: var(--footer-link); font-size: 1.1rem; font-weight: 600; text-decoration: none; }
footer.site .email:hover { text-decoration: underline; text-underline-offset: 3px; }
footer.site h3 { font-family: var(--sans); font-size: 0.9rem; font-weight: 600; letter-spacing: 0; color: var(--footer-muted); margin: 0 0 14px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-links a { color: var(--footer-text); text-decoration: none; font-size: 0.98rem; }
.footer-links a:hover { color: var(--footer-link); }
.footer-meta { color: var(--footer-muted); font-size: 0.98rem; }
.footer-meta p { margin: 0 0 10px; }
.footer-meta a { color: var(--footer-text); text-decoration: none; }
.footer-meta a:hover { color: var(--footer-link); }
.footer-bottom {
  margin-top: 56px; padding: 24px 0 32px; border-top: 1px solid var(--footer-line);
  color: var(--footer-muted); font-size: 0.88rem;
}

/* ------------------------------------------------------------------ */
/* Adaptación a pantallas pequeñas                                     */
/* ------------------------------------------------------------------ */
@media (max-width: 960px) {
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .triptych { grid-template-columns: 1fr; }
  .hero .wrap { gap: 48px; }
}
@media (max-width: 760px) {
  :root { --gutter: 24px; }
  body { font-size: 1rem; }
  header.site { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 12px; padding-bottom: 10px; position: static; }
  nav.site { justify-content: flex-start; margin: 0 -10px; }
  nav.site a { padding: 8px 10px; }
  .hero { padding: 48px 0 56px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
  /* En móvil la foto mantiene su formato vertical (antes se recortaba a 16:10 y cortaba la cabeza). */
  .hero-photo { aspect-ratio: 4 / 5; max-width: 420px; box-shadow: 10px 10px 0 var(--accent-soft); }
  .hero-actions .btn { flex: 1 1 auto; }
  section.practice, section.about, section.facts, section.approach, section.projects,
  section.featured-book, section.materials, section.contact, section.blog-list { padding: 56px 0; }
  section.next { padding: 44px 0; }
  .page-hero { padding: 32px 0 48px; }
  .facts-grid, .material-grid { grid-template-columns: 1fr; gap: 16px; }
  .field, .project, .article-row { padding: 24px; }
  .about-grid, .approach-grid, .book-grid, .contact-grid, .project, .article-row { grid-template-columns: 1fr; gap: 16px; }
  section.practice > .wrap > h2, section.projects h2 { margin-bottom: 32px; }
  form.contact-form { padding: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }
  footer.site { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
