/* ==========================================================================
   IVM · estilos del tema
   1. Base  2. Utilidades  3. Botones/enlaces  4. Cabecera  5. Hero
   6. Equipo médico  7. Ficha y modal  8. Pie  9. Prosa
   ========================================================================== */

/* ---------- 1. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--crema);
	color: var(--texto);
	font-family: var(--font-text);
	font-size: var(--fs-body);
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, ul { margin: 0; }
button { font: inherit; color: inherit; }

:focus-visible {
	outline: 2px solid var(--dorado);
	outline-offset: 3px;
}

body.is-modal-open { overflow: hidden; }

/* ---------- 2. Utilidades ---------- */
.container {
	width: 100%;
	max-width: var(--max);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.screen-reader-text {
	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 {
	position: absolute;
	left: 1rem; top: -100px;
	z-index: 100;
	padding: .75rem 1rem;
	background: var(--negro);
	color: var(--blanco);
	border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.icon { display: inline-flex; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon--arrow { width: 22px; height: 10px; }
.icon--chevron { width: 9px; height: 6px; }
.icon--clock { width: 20px; height: 20px; }
.icon--close { width: 24px; height: 24px; }
.icon--menu { width: 26px; height: 18px; }

.section { padding-block: clamp(56px, 7vw, 92px); }

/* ---------- 3. Botones y enlaces ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-height: 40px;
	padding: 10px 22px;
	border: 0;
	border-radius: var(--radius-pill);
	font-family: var(--font-text);
	font-size: var(--fs-small);
	line-height: 1;
	text-transform: uppercase;
	text-decoration: none;
	letter-spacing: .01em;
	cursor: pointer;
	transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}

.btn--sage { background: var(--salvia); color: var(--blanco); }
.btn--sage:hover { background: #a9b8a5; }
.btn .icon--arrow { transition: transform .25s var(--ease); }
.btn:hover .icon--arrow { transform: translateX(4px); }

.link-arrow {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: var(--fs-xs);
	text-transform: uppercase;
	text-decoration: none;
	color: var(--gris-enlace);
	transition: color .25s var(--ease);
}
.link-arrow .icon--arrow { transition: transform .25s var(--ease); }
.link-arrow:hover { color: var(--texto); }
.link-arrow:hover .icon--arrow { transform: translateX(4px); }
.link-arrow--back .icon--arrow { transform: scaleX(-1); }
.link-arrow--back:hover .icon--arrow { transform: scaleX(-1) translateX(4px); }

/* ---------- 4. Cabecera ---------- */
.site-header {
	position: absolute;
	inset: 0 0 auto;
	z-index: 20;
	color: var(--blanco);
}
.site-header--plain { color: var(--texto); }

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 24px;
	padding-block: 48px 30px;
}

.site-header__logo { flex: none; color: inherit; }
.site-header__logo .logo { width: clamp(190px, 18.75vw, 270px); }

.site-header__panel {
	display: flex;
	align-items: center;
	gap: 34px;
	margin-left: auto;
}

.site-header__burger {
	display: none;
	margin-left: auto;
	padding: 10px;
	background: none;
	border: 0;
	cursor: pointer;
}

.nav__list {
	display: flex;
	align-items: center;
	gap: 22px;
	padding: 0;
	list-style: none;
}

.nav__list > li { position: relative; display: flex; align-items: center; gap: 4px; }

.nav a {
	font-size: var(--fs-body);
	text-decoration: none;
	white-space: nowrap;
	transition: opacity .2s var(--ease);
}
.nav a:hover { opacity: .7; }

.nav .current-menu-item > a,
.nav .current-menu-ancestor > a { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

.nav__toggle {
	display: inline-flex;
	padding: 4px 2px;
	background: none;
	border: 0;
	cursor: pointer;
}
.nav__toggle .icon { transition: transform .2s var(--ease); }
.nav__toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }

.nav .sub-menu {
	position: absolute;
	top: calc(100% + 12px);
	left: -18px;
	z-index: 5;
	min-width: 220px;
	padding: 12px 0;
	list-style: none;
	background: var(--blanco);
	color: var(--texto);
	border-radius: 16px;
	box-shadow: var(--shadow-card);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
}
.nav .sub-menu::before { content: ""; position: absolute; inset: -14px 0 auto; height: 14px; }
.nav .sub-menu a { display: block; padding: 8px 20px; }

.nav__list > li:hover > .sub-menu,
.nav__list > li:focus-within > .sub-menu,
.nav__list > li.is-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: none;
}

/* ---------- 5. Hero ---------- */
.hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: clamp(360px, 39vw, 560px);
	overflow: hidden;
	isolation: isolate;
}

/* Caja de la foto: 1440 × 482 en el Figma (86 % de la cabecera), centrada, esquinas inferiores de 30 */
.hero__media {
	position: absolute;
	inset: 0 0 14%;
	z-index: -1;
	overflow: hidden;
	border-radius: 0 0 30px 30px;
}
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: center; }

/* Capas del Figma («Rectangle 1»): velo negro 34 % + fundido al crema desde el 36 % */
.hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgb(253 244 237 / 0) 36.29%, rgb(253 244 237 / 0.29) 67.23%, var(--crema) 100%),
		rgb(0 0 0 / 0.34);
}

.hero__inner { padding-bottom: clamp(136px, 16.4vw, 236px); }

.hero__title {
	font-family: var(--font-display);
	font-size: var(--fs-hero);
	font-weight: 400;
	line-height: 1.089; /* 98/90 del Figma */
	/* En el Figma el titular va todo en minúsculas: las de Julius Sans One son versalitas */
	text-transform: lowercase;
	color: var(--blanco);
}

.hero--plain {
	min-height: clamp(300px, 28vw, 400px);
	background: linear-gradient(180deg, #efe6dc 0%, var(--crema) 100%);
}
.hero--plain .hero__inner { padding-bottom: clamp(56px, 6vw, 80px); }
.hero--plain .hero__title { color: var(--negro); text-shadow: none; }

/* ---------- 6. Equipo médico ---------- */
.equipo { padding-top: clamp(8px, 2vw, 24px); }

.intro {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px 40px;
	align-items: start;
	margin-bottom: clamp(48px, 7vw, 104px);
}

.intro__title {
	font-family: var(--font-display);
	font-size: var(--fs-h2);
	font-weight: 400;
	line-height: 1.02;
	letter-spacing: .02em;
	color: var(--negro);
	max-width: 9em;
	text-wrap: balance;
}

.intro__text {
	padding-top: .55em;
	font-size: var(--fs-body);
	line-height: 1.3;
	color: var(--texto);
}
.intro__text strong { font-weight: 700; color: var(--negro); }

.medicos-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 50px 21px;
	padding: 0;
	list-style: none;
}

/* Filtro por hospital: píldoras salvia (contorno = inactiva, rellena = activa) */
.equipo__filtro {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: clamp(40px, 5vw, 64px);
}
.equipo__filtro[hidden] { display: none; }
.equipo__filtro-btn {
	min-height: 44px;
	padding: 12px 24px;
	border: 1px solid var(--salvia);
	border-radius: var(--radius-pill);
	background: transparent;
	color: var(--texto);
	font-family: var(--font-text);
	font-size: var(--fs-small);
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.equipo__filtro-btn:hover { background: rgb(184 197 180 / 0.25); }
.equipo__filtro-btn[aria-pressed="true"] { background: var(--salvia); color: var(--blanco); }
.equipo__filtro-btn:focus-visible { outline: 2px solid var(--dorado); outline-offset: 3px; }

/* Bloques por hospital: titular con filete rosa que llega hasta el borde de la rejilla */
.equipo__bloque[hidden] { display: none; }
.equipo__bloque:not([hidden]) ~ .equipo__bloque:not([hidden]) { margin-top: clamp(72px, 8vw, 120px); }
.equipo__bloque-title {
	display: flex;
	align-items: center;
	gap: 24px;
	margin-bottom: clamp(28px, 3vw, 44px);
	font-family: var(--font-display);
	font-size: clamp(1.375rem, 1.1rem + .75vw, 1.875rem);
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: .02em;
	color: var(--negro);
}
.equipo__bloque-title::after {
	content: "";
	flex: 1;
	min-width: 40px;
	height: 1px;
	background: var(--rosa);
}

.medico-card { display: flex; flex-direction: column; gap: 16px; }

.medico-card__photo {
	position: relative;
	display: block;
	aspect-ratio: 315 / 225;
	overflow: hidden;
	border-radius: var(--radius-card);
	background: var(--blanco);
	box-shadow: var(--shadow-card);
}

.medico-card__photo img,
.medico-card__placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 22%;
	transition: transform .6s var(--ease);
}

.medico-card__placeholder {
	display: block;
	background:
		radial-gradient(circle at 50% 38%, var(--crema) 0 16%, transparent 16.5%),
		radial-gradient(ellipse 46% 40% at 50% 100%, var(--crema) 0 98%, transparent 100%),
		linear-gradient(160deg, #eee6df, #e3d9d1);
}

/* Hover del Figma: velo oscuro con «SABER MÁS →» */
.medico-card__more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background: rgb(40 40 40 / 0.55);
	color: var(--blanco);
	font-size: var(--fs-xs);
	text-transform: uppercase;
	opacity: 0;
	transition: opacity .3s var(--ease);
}

.medico-card__photo:hover .medico-card__more,
.medico-card__photo:focus-visible .medico-card__more { opacity: 1; }
.medico-card__photo:hover img { transform: scale(1.03); }

.medico-card__body {
	flex: 1;
	padding: 28px 30px 34px 38px;
	background: var(--blanco);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
}

.medico-card__name {
	font-family: var(--font-text);
	font-size: var(--fs-card-name);
	font-weight: 400;
	line-height: 1.2;
	color: var(--texto);
}

.medico-card__spec {
	margin-top: 4px;
	font-size: var(--fs-body);
	line-height: 1.3;
	color: var(--texto);
}

.medico-card__cita { margin-top: 24px; font-size: var(--fs-body); }

.equipo__empty { font-size: 1.125rem; }

/* ---------- 7. Ficha del médico y modal ---------- */
.ficha {
	display: grid;
	grid-template-columns: 225px minmax(0, 1fr);
	gap: 34px;
	align-items: start;
}

.ficha__photo {
	aspect-ratio: 225 / 300;
	overflow: hidden;
	border-radius: 20px;
	background: var(--crema);
}
.ficha__photo img,
.ficha__photo .medico-card__placeholder { width: 100%; height: 100%; object-fit: cover; }

.ficha__body { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }

.ficha__head { padding-bottom: 16px; position: relative; margin-bottom: 4px; }
.ficha__head::after {
	content: "";
	position: absolute;
	left: 0; bottom: 0;
	width: 190px;
	height: 1px;
	background: var(--rosa);
}

.ficha__name {
	font-family: var(--font-text);
	font-size: clamp(1.375rem, 1.2rem + .5vw, 1.625rem);
	font-weight: 400;
	line-height: 1.15;
	color: var(--negro);
}

.ficha__spec { margin-top: 2px; font-size: 1rem; color: var(--texto); }

.ficha__label { font-size: var(--fs-body); color: var(--texto); }
.ficha__label--strong { font-weight: 700; font-size: 1rem; color: var(--negro); }

.ficha__list {
	margin-top: 2px;
	padding-left: 20px;
	font-size: var(--fs-body);
	line-height: 1.45;
	color: var(--texto);
}
.ficha__list li::marker { content: "•  "; }

/* Currículum completo, plegado para no romper la ficha del Figma */
.ficha__cv { font-size: var(--fs-body); color: var(--texto); }
.ficha__cv summary {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	list-style: none;
	color: var(--negro);
	text-decoration: underline;
	text-decoration-color: var(--rosa);
	text-underline-offset: 4px;
}
.ficha__cv summary::-webkit-details-marker { display: none; }
.ficha__cv summary .icon { width: 10px; transition: transform .25s var(--ease); }
.ficha__cv[open] summary .icon { transform: rotate(180deg); }
.ficha__cv summary:focus-visible { outline: 2px solid var(--dorado); outline-offset: 3px; border-radius: 4px; }
.ficha__cv-text { display: grid; gap: 10px; margin-top: 12px; line-height: 1.55; }

.ficha__horario {
	display: flex;
	gap: 10px;
	font-size: var(--fs-body);
	line-height: 1.4;
	color: var(--texto);
}
.ficha__horario .icon { color: #b7b7b7; margin-top: 1px; }

.ficha__quote { font-size: var(--fs-body); color: var(--salvia); }

.ficha__cta { align-self: flex-start; margin-top: 4px; }

/* Modal (<dialog>) */
.ficha-modal {
	width: min(790px, calc(100vw - 32px));
	max-height: calc(100dvh - 32px);
	padding: 38px 40px 40px 38px;
	overflow: auto;
	border: 0;
	border-radius: var(--radius-modal);
	background: var(--blanco);
	color: var(--texto);
	box-shadow: var(--shadow-modal);
}

.ficha-modal:focus { outline: none; }

.ficha-modal::backdrop {
	background: var(--velo);
	backdrop-filter: blur(1px);
}

.ficha-modal[open] { animation: ivm-modal-in .32s var(--ease); }
.ficha-modal[open]::backdrop { animation: ivm-fade-in .32s var(--ease); }

@keyframes ivm-modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes ivm-fade-in { from { opacity: 0; } }

.ficha-modal__close {
	position: absolute;
	top: 28px; right: 28px;
	padding: 6px;
	background: none;
	border: 0;
	color: var(--negro);
	cursor: pointer;
	transition: transform .2s var(--ease);
}
.ficha-modal__close:hover { transform: rotate(90deg); }
.ficha-modal .ficha__body { padding-right: 40px; }

/* Ficha individual (URL propia) */
.ficha-page { padding-top: 0; }
.ficha-page .link-arrow--back { margin-bottom: 28px; color: var(--texto-suave); }
.ficha-page__card {
	max-width: 900px;
	padding: clamp(24px, 4vw, 48px);
	background: var(--blanco);
	border-radius: var(--radius-modal);
	box-shadow: var(--shadow-card);
}

/* ---------- 8. Pie ---------- */
.site-footer { padding-block: clamp(24px, 3.4vw, 48px) 34px; }

.site-footer__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px 40px;
	flex-wrap: wrap;
	padding-bottom: 42px;
	border-bottom: 1px solid var(--crema-linea);
}

.site-footer__logo { color: var(--negro); }
.site-footer__logo .logo { width: clamp(200px, 19vw, 272px); }

.nav--pie .nav__list { gap: 24px; flex-wrap: wrap; }
.nav--pie a { font-size: var(--fs-small); color: var(--texto); }
.nav--pie .sub-menu { top: auto; bottom: calc(100% + 12px); }
.nav--pie .sub-menu::before { inset: auto 0 -14px; }

.site-footer__bottom {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding-top: 32px;
	text-align: center;
}

.site-footer__meta {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 64px;
	font-size: var(--fs-legal);
	color: var(--texto);
}
.site-footer__meta a { text-decoration: none; }
.site-footer__meta a:hover { text-decoration: underline; }

.nav--legal .nav__list { flex-wrap: wrap; justify-content: center; gap: 0; }
.nav--legal li + li::before { content: "|"; padding-inline: 10px; }
.nav--legal a,
.nav--legal li::before {
	font-size: var(--fs-legal);
	letter-spacing: .32em;
	text-transform: uppercase;
	color: var(--texto);
}

/* ---------- 9. Prosa (páginas con editor) ---------- */
.prose { max-width: 820px; font-size: 1rem; line-height: 1.65; }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3 { font-family: var(--font-display); font-weight: 400; color: var(--negro); line-height: 1.1; }
.prose h2 { font-size: 2rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.5rem; margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
	.site-header__panel { gap: 22px; }
	.nav__list { gap: 16px; }
	.medicos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
	.site-header__burger { display: inline-flex; }

	.site-header__panel {
		position: absolute;
		top: 100%;
		left: var(--gutter);
		right: var(--gutter);
		flex-direction: column;
		align-items: stretch;
		gap: 20px;
		padding: 24px;
		background: var(--blanco);
		color: var(--texto);
		border-radius: 20px;
		box-shadow: var(--shadow-modal);
		opacity: 0;
		visibility: hidden;
		transform: translateY(-8px);
		transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
	}
	.site-header.is-nav-open .site-header__panel { opacity: 1; visibility: visible; transform: none; }

	.nav--principal .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
	.nav--principal .nav__list > li { flex-wrap: wrap; justify-content: space-between; border-bottom: 1px solid var(--crema-linea); }
	.nav--principal .nav__list > li > a { padding-block: 12px; font-size: 1.0625rem; }
	.nav--principal .sub-menu {
		position: static;
		display: none;
		flex-basis: 100%;
		min-width: 0;
		padding: 0 0 10px 12px;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}
	.nav--principal .sub-menu::before { display: none; }
	.nav--principal li.is-open > .sub-menu { display: block; }
	.nav--principal .sub-menu a { padding: 8px 0; }
	.site-header__cta { align-self: flex-start; }
}

@media (max-width: 900px) {
	.medicos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 16px; }
	.intro { grid-template-columns: 1fr; }
	.intro__text { padding-top: 0; }
	.site-footer__top { justify-content: center; text-align: center; }
	.nav--pie .nav__list { justify-content: center; }
}

@media (max-width: 640px) {
	.site-header__inner { padding-block: 24px 16px; }
	.hero__inner { padding-bottom: 110px; }
	.medico-card__body { padding: 16px 16px 18px; }
	.medico-card__cita { margin-top: 14px; }

	.ficha { grid-template-columns: 1fr; gap: 22px; }
	.ficha__photo { width: min(200px, 60%); }
	.ficha-modal { padding: 28px 22px 26px; }
	.ficha-modal .ficha__body { padding-right: 0; }
	.ficha-modal__close { top: 18px; right: 18px; }
	.nav--legal a, .nav--legal li::before { letter-spacing: .16em; }
}

@media (max-width: 420px) {
	.medicos-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
