/*
 * Article and article-index templates (src/guides, docs/INFRAESTRUCTURA.md §6.4), whose g- parts the
 * case pages reuse (src/cases, with casos.css after this file), and the CTA blocks of both
 * (src/site/cta-blocks.ts, cta- classes). Plain CSS, mobile first. Linked between base.css and
 * site-chrome.css (always last); it never styles the chrome's sc- classes. Font and colours of Jose's
 * home design (docs/design/package/inmercost-web-daci-2026-11-04): Atkinson Hyperlegible Next, #1B3D14
 * text, #4A5D43 secondary text, #3A7A26 green, #D3E5CB lines, #EEF6EA soft backgrounds and its rounded
 * cards, pills and buttons.
 */

:root {
  --g-text: #1b3d14;
  --g-muted: #4a5d43;
  --g-accent: #3a7a26;
  --g-line: #d3e5cb;
  --g-soft: #eef6ea;
  --g-mark: #fff3b0;
  --g-measure: 680px;
  /* The side padding of the site chrome (.sc-header__inner, .sc-footer__inner): text lines up with the logo. */
  --g-gutter: clamp(20px, 4vw, 48px);
}

.g-main {
  display: block;
  box-sizing: border-box;
  max-width: calc(var(--g-measure) + 2 * var(--g-gutter));
  margin: 0 auto;
  padding: 16px var(--g-gutter) 48px;
  font-family: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible Next Fallback', 'Helvetica Neue', Arial,
    sans-serif;
  color: var(--g-text);
  line-height: 1.6;
  overflow-wrap: break-word;
}

.g-main h2,
.g-main h3,
.g-main h4,
.g-sources li {
  scroll-margin-top: 5rem;
}

.g-main a {
  color: var(--g-accent);
  text-underline-offset: 2px;
}

.g-main a:focus-visible,
.g-table:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}

.g-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.g-draft {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid #c9a700;
  background: var(--g-mark);
  font-size: 0.875rem;
}

/* Breadcrumbs, title, standfirst and byline */

.g-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--g-muted);
}

.g-crumbs li + li::before {
  content: '›';
  content: '›' / '';
  margin-right: 8px;
}

.g-crumbs a {
  color: inherit;
}

.g-crumbs [aria-current='page'] {
  color: var(--g-text);
}

.g-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  line-height: 1.15;
}

.g-standfirst {
  margin: 0 0 16px;
  font-size: 1.125rem;
  color: var(--g-muted);
}

.g-byline {
  margin: 0 0 24px;
  font-size: 0.875rem;
  color: var(--g-muted);
}

.g-byline p {
  margin: 0;
}

.g-byline__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.g-byline a {
  color: inherit;
}

/* Images */

.g-cover,
.g-figure {
  margin: 24px 0;
}

.g-cover img,
.g-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: var(--g-soft);
}

.g-main figcaption {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--g-muted);
}

/* Short answer and key takeaways */

.g-answer {
  margin: 24px 0;
  padding: 16px 20px;
  border-left: 4px solid var(--g-accent);
  background: var(--g-soft);
}

.g-answer__text {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.g-answer__points {
  margin: 12px 0 0;
  padding-left: 1.25em;
}

/* Table of contents (public/assets/js/article.js marks the current entry with aria-current) */

.g-toc {
  margin: 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--g-line);
  border-radius: 4px;
}

.g-toc__title {
  margin: 0 0 8px;
  font-weight: 700;
}

.g-toc ol {
  margin: 0;
  padding-left: 1.25em;
}

.g-toc li + li {
  margin-top: 4px;
}

.g-toc a[aria-current='true'] {
  color: var(--g-text);
  font-weight: 700;
}

/* Body */

.g-body h2,
.g-faq h2,
.g-conclusion h2,
.g-sources h2,
.g-read-next h2 {
  margin: 40px 0 12px;
  font-size: 1.5rem;
  line-height: 1.25;
}

.g-body h3,
.g-faq h3 {
  margin: 28px 0 8px;
  font-size: 1.1875rem;
  line-height: 1.3;
}

.g-body h4 {
  margin: 24px 0 8px;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.g-body p,
.g-body ul,
.g-body ol,
.g-body blockquote {
  margin: 0 0 16px;
}

.g-body ul,
.g-body ol {
  padding-left: 1.5em;
}

.g-body li + li {
  margin-top: 4px;
}

.g-body li > ul,
.g-body li > ol {
  margin: 4px 0 0;
}

.g-body blockquote {
  padding-left: 16px;
  border-left: 3px solid var(--g-line);
  color: var(--g-muted);
}

.g-body blockquote p:last-child {
  margin-bottom: 0;
}

.g-body hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--g-line);
}

.g-body code {
  padding: 0 4px;
  border-radius: 3px;
  background: var(--g-soft);
  font-size: 0.9em;
}

.g-body mark {
  background: var(--g-mark);
  color: inherit;
}

.g-table {
  margin: 0 0 16px;
  overflow-x: auto;
}

.g-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.g-table th,
.g-table td {
  padding: 8px 12px;
  border: 1px solid var(--g-line);
  text-align: left;
  vertical-align: top;
}

.g-table thead th {
  background: var(--g-soft);
}

.g-checklist {
  padding-left: 0;
  list-style: none;
}

.g-body .g-checklist {
  padding-left: 0;
}

.g-checklist li {
  position: relative;
  padding-left: 1.75em;
}

.g-checklist li::before {
  content: '';
  position: absolute;
  top: 0.3em;
  left: 0;
  box-sizing: border-box;
  width: 1em;
  height: 1em;
  border: 2px solid var(--g-muted);
  border-radius: 3px;
}

.g-checklist li[data-checked='true']::before {
  border-color: var(--g-accent);
  background: var(--g-accent);
}

/* Video facade (§6.7): the player replaces the link after a click */

.g-video {
  margin: 24px 0;
}

.g-video__facade,
.g-video__frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #000;
}

.g-video__facade img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.g-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  margin: -24px 0 0 -34px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.75);
}

.g-video__play::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 28px;
  border-width: 10px 0 10px 16px;
  border-style: solid;
  border-color: transparent transparent transparent #fff;
}

.g-video__facade:hover .g-video__play,
.g-video__facade:focus-visible .g-video__play {
  background: #b00;
}

/* FAQ (always open: H3 + paragraph), conclusion, sources */

.g-faq__item p {
  margin: 0 0 12px;
}

.g-sources ol {
  padding-left: 1.5em;
  font-size: 0.9375rem;
}

.g-sources li {
  margin-bottom: 6px;
}

.g-sources li:target {
  background: var(--g-mark);
}

/* Author box and "Leer después" */

.g-authors {
  margin: 40px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--g-line);
}

.g-author {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.g-author + .g-author {
  margin-top: 16px;
}

.g-author__photo {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  background: var(--g-soft);
}

.g-author__name {
  margin: 0;
  font-weight: 700;
}

.g-author__role,
.g-author__bio {
  margin: 4px 0 0;
  font-size: 0.9375rem;
}

.g-author__role {
  color: var(--g-muted);
}

.g-authors__note {
  margin: 16px 0 0;
  font-size: 0.875rem;
  color: var(--g-muted);
}

.g-read-next ul,
.g-cards {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.g-read-next li,
.g-card {
  padding: 16px 20px;
  border: 1px solid var(--g-line);
  border-radius: 20px;
}

.g-read-next p,
.g-card p {
  margin: 6px 0 0;
  font-size: 0.9375rem;
  color: var(--g-muted);
}

/* Article index: a grid of cards (cover, category, title, standfirst) and the search */

/* The indexes take the chrome's container (1240 px with its padding), so they line up with the logo. */
.g-main--ancho {
  max-width: 1240px;
}

/* «¿Tu situación es concreta? Mira los casos» at the end of /guias. */
.g-index__casos {
  margin: 40px 0 0;
  font-size: 1.125rem;
}

.g-main--ancho .g-standfirst {
  max-width: 680px;
}

.g-cards {
  margin-top: 24px;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.g-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: #fff;
}

.g-card[hidden] {
  display: none;
}

.g-card--foto {
  padding: 0;
  overflow: hidden;
}

.g-card__img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--g-soft);
}

.g-card--foto .g-card__cuerpo {
  padding: 18px 20px 22px;
}

.g-card h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.g-main .g-card h2 a {
  color: var(--g-text);
  text-decoration: none;
}

/* The whole card opens the guide; the title is the only link (one stop for keyboards and readers) */
.g-card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.g-card:hover h2 a {
  text-decoration: underline;
}

.g-card:focus-within {
  outline: 3px solid #4c9d33;
  outline-offset: 2px;
}

.g-main .g-card h2 a:focus-visible {
  outline: none;
}

.g-categoria {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--g-accent);
}

.g-main a.g-categoria {
  text-decoration: none;
}

.g-main a.g-categoria:hover {
  text-decoration: underline;
}

.g-search {
  margin: 24px 0 8px;
  padding: 20px;
  border-radius: 20px;
  background: var(--g-soft);
}

.g-search__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.g-search__input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid #c7ddbe;
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 17px;
  color: var(--g-text);
}

.g-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}

.g-chip {
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid #c7ddbe;
  border-radius: 999px;
  background: #fff;
  color: var(--g-text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.g-chip:hover {
  border-color: var(--g-text);
}

.g-chip[aria-pressed='true'] {
  border-color: var(--g-text);
  background: var(--g-text);
  color: #eef6ea;
  font-weight: 700;
}

.g-search__count {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--g-muted);
}

.g-search__vacio {
  margin: 24px 0 0;
  padding: 20px 24px;
  border: 1px solid var(--g-line);
  border-radius: 20px;
}

.g-search__vacio[hidden] {
  display: none;
}

.g-search__vacio p {
  margin: 0;
}

.g-search__vacio p + p {
  margin-top: 8px;
}

/* Reading progress: the bar is created by article.js */

.g-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  height: 3px;
  background: var(--g-accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/*
 * CTA blocks (src/site/cta-blocks.ts): the valuation form and WhatsApp at the end of the cases, the
 * appointment at the office under every guide. They open WhatsApp (public/assets/js/whatsapp.js keeps
 * the message in step with the form).
 */

/* What needs the script (fields, calendar, search) is hidden without it: the links still work */
html:not(.js) [data-wa-js],
html:not(.js) .g-search {
  display: none !important;
}

.cta-caso,
.cta-guia {
  margin: 48px 0 0;
}

.cta-titulo {
  margin: 0;
  font-size: clamp(1.625rem, 1.2rem + 1.8vw, 2.25rem);
  line-height: 1.15;
  font-weight: 700;
}

.cta-intro {
  margin: 10px 0 0;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--g-muted);
}

.cta-tarjetas {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.g-main--ancho .cta-tarjetas {
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
}

.cta-tarjeta,
.cta-cita {
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vw, 36px);
  border-radius: 20px;
  background: var(--g-soft);
}

.cta-cita {
  border-radius: 24px;
}

.cta-cita .cta-titulo {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
}

.cta-tarjeta--whatsapp {
  background: #1b3d14;
  color: #eef6ea;
}

.cta-antetitulo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--g-accent);
}

.cta-tarjeta--whatsapp .cta-antetitulo {
  color: #8cc474;
}

.cta-subtitulo {
  margin: 10px 0 0;
  font-size: 1.625rem;
  line-height: 1.15;
  font-weight: 700;
}

.cta-texto {
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--g-muted);
}

.cta-tarjeta--whatsapp .cta-texto {
  color: #c6ddbc;
}

.cta-campos {
  display: flex;
  flex-direction: column;
}

.cta-etiqueta {
  margin-top: 16px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
}

.cta-input {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1.5px solid #c7ddbe;
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--g-text);
}

.cta-grupo {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

/* A legend ignores its own top margin inside the fieldset: the fieldset carries it */
.cta-grupo > .cta-etiqueta {
  margin: 0;
}

.cta-opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.cta-opcion {
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid #c7ddbe;
  border-radius: 999px;
  background: #fff;
  color: var(--g-text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.cta-opcion:hover {
  border-color: #1b3d14;
}

.cta-opcion[aria-pressed='true'] {
  border-color: #1b3d14;
  background: #1b3d14;
  color: #eef6ea;
  font-weight: 700;
}

.cta-accion {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-top: auto;
  padding-top: 24px;
}

.g-main .cta-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 32px;
  border-radius: 999px;
  background: #1b3d14;
  color: #eef6ea;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.g-main .cta-boton:hover {
  background: #10260c;
}

.g-main .cta-boton--whatsapp {
  background: #4c9d33;
  color: #10260c;
}

.g-main .cta-boton--whatsapp:hover {
  background: #8cc474;
}

.cta-nota {
  flex-basis: 100%;
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--g-muted);
}

.cta-burbuja {
  align-self: flex-end;
  max-width: 85%;
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 18px 18px 4px 18px;
  background: #eef6ea;
  color: #1b3d14;
  font-size: 16px;
  line-height: 1.45;
}

.cta-telefono {
  font-size: 15px;
  color: #c6ddbc;
}

.cta-oficina {
  margin: 20px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--g-muted);
}

.cta-horario {
  display: block;
}

.cta-planb {
  margin: 16px 0 0;
  font-size: 1.0625rem;
  text-align: center;
}

.g-main .cta-enlace {
  font-weight: 700;
}

.cta-input:focus-visible,
.cta-opcion:focus-visible,
.g-chip:focus-visible,
.g-search__input:focus-visible,
.g-main .cta-boton:focus-visible {
  outline: 3px solid #4c9d33;
  outline-offset: 2px;
}

@media print {
  .g-toc,
  .g-progress,
  .g-search,
  .cta-caso,
  .cta-guia {
    display: none;
  }
}
