:root {
	--cream: #FBF8F3;
	--card: #FFFFFF;
	--ink: #2B2A28;
	--muted: #6B665E;
	--line: #E7E1D7;
	--red: #C8102E;
	--red-dark: #9E0C24;
	--red-soft: #FCEBEE;
	--gold: #B8862B;
	--wa: #1F8F4E;
	--radius: 16px;
	--serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--tab-h: 72px;
	color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--cream);
	color: var(--ink);
	font: 18px/1.55 var(--sans);
	-webkit-font-smoothing: antialiased;
}
body.is-app { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); }
img { max-width: 100%; display: block; }
a { color: var(--red-dark); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 16px; }
.center { text-align: center; }
.lead { font-size: 20px; line-height: 1.5; }
.ico { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }

/* Monograma KH / RP */
.mono {
	--s: 44px;
	width: var(--s); height: var(--s);
	border-radius: 50%;
	border: calc(var(--s) * .07) solid var(--gold);
	overflow: hidden;
	display: inline-flex; flex-direction: column;
	flex: none;
	font-family: var(--serif);
	font-size: calc(var(--s) * .3);
	font-weight: 600;
	letter-spacing: .02em;
	background: #fff;
}
.mono-t, .mono-b { flex: 1; display: flex; justify-content: center; }
.mono-t { background: #fff; color: var(--ink); align-items: flex-end; padding-bottom: 1px; }
.mono-b { background: var(--red); color: #fff; align-items: flex-start; }

/* Cabecera pública */
.pub-top {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line);
	position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: var(--serif); font-size: 20px; letter-spacing: .08em; }
.langs { display: flex; gap: 4px; }
.langs a {
	min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
	text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 600; border-radius: 10px;
}
.langs a.on { color: var(--red-dark); background: var(--red-soft); }

/* Cabecera de la app */
.app-top {
	position: sticky; top: 0; z-index: 10;
	display: flex; align-items: center; gap: 12px;
	padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
	background: rgba(251, 248, 243, .96);
	border-bottom: 1px solid var(--line);
	backdrop-filter: saturate(1.2) blur(8px);
}
.top-title { font-size: 22px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-back, .top-brand {
	width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
	color: var(--ink); text-decoration: none; border-radius: 12px;
}
.top-back { background: #fff; border: 1px solid var(--line); }

/* Barra de abajo */
.tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
	display: grid; grid-template-columns: repeat(5, 1fr);
	height: calc(var(--tab-h) + env(safe-area-inset-bottom));
	padding-bottom: env(safe-area-inset-bottom);
	background: #fff; border-top: 1px solid var(--line);
}
.tabbar a {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 600;
}
.tabbar a.on { color: var(--red); }
.tabbar a.tab-pub .ico { color: var(--red); }

/* Botones */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 56px; padding: 12px 22px;
	border-radius: 14px; border: 1px solid transparent;
	font: 600 19px/1.2 var(--sans); text-decoration: none; cursor: pointer;
}
.btn-block { display: flex; width: 100%; margin: 12px 0; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-wa { background: var(--wa); color: #fff; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
	outline: 3px solid var(--gold); outline-offset: 2px;
}

/* Tarjetas */
.card {
	display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px; margin: 0 0 12px; color: var(--ink); text-decoration: none;
}
a.card:active { background: #FFFDF9; }
.section { margin: 24px 0; }
.section-title { font-size: 21px; margin-bottom: 12px; }
.hello { font-family: var(--serif); font-size: 26px; margin: 6px 0 16px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

.chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 10px; border-radius: 999px;
	background: var(--bg); color: var(--c); font-size: 14px; font-weight: 600;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tipo { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .03em; }
.tipo-busco { color: #185FA5; }
.tipo-ofrezco { color: #0F6E56; }
.tipo-iniciativa { color: var(--red-dark); }
.tipo-enlace { color: #854F0B; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }

.post-title { font-size: 20px; margin: 0 0 6px; }
.post-excerpt { color: var(--muted); margin-bottom: 10px; }
.post-thumb { width: 100%; aspect-ratio: 1.91; object-fit: cover; border-radius: 12px; margin: 4px 0 10px; }
.post-by { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.post-full .post-title-full { font-size: 26px; }
.post-body { font-size: 19px; }

.link-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); margin: 12px 0; }
.link-card img { width: 100%; aspect-ratio: 1.91; object-fit: cover; }
.link-in { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: #FFFDF9; }

/* Caras: foto o bandera */
.face {
	--s: 56px;
	width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	background: #F4EFE6; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.face img { width: 100%; height: 100%; object-fit: cover; }
.face-flag { font-size: calc(var(--s) * .58); line-height: 1; }

/* Cónsul destacado */
.carousel { position: relative; }
.feat { display: none; border-top: 5px solid var(--red); }
.feat.on { display: block; animation: fade .5s ease; }
.feat-top { display: flex; align-items: center; gap: 14px; }
.feat-name { font-family: var(--serif); font-size: 22px; margin: 0 0 2px; }
.feat-quote { margin: 14px 0 0; font-family: var(--serif); font-size: 19px; color: var(--ink); border-left: 3px solid var(--gold); padding-left: 12px; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--red); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .feat.on { animation: none; } }

.cta-card { display: flex; gap: 14px; align-items: center; border: 2px dashed var(--gold); background: #FFFBF2; }

/* Evento con cuenta atrás */
.event-card { display: flex; gap: 16px; align-items: flex-start; }
.countdown {
	flex: none; width: 84px; padding: 10px 6px; text-align: center;
	background: var(--red-soft); color: var(--red-dark); border-radius: 14px;
}
.cd-num { display: block; font: 600 36px/1 var(--serif); }
.cd-label { font-size: 14px; font-weight: 600; }
.event-title { font-family: var(--serif); font-size: 20px; margin-bottom: 6px; }
.event-card p { margin-bottom: 4px; }

.news-card { display: flex; gap: 14px; align-items: center; }
.news-img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; flex: none; }
.news-ico { width: 56px; height: 56px; border-radius: 12px; background: #F4EFE6; display: flex; align-items: center; justify-content: center; flex: none; color: var(--gold); }
.news-title { font-family: var(--serif); font-size: 19px; margin: 0 0 2px; }
.news-hero { width: 100%; border-radius: 12px; margin-bottom: 12px; }

/* Lista de cónsules */
.search {
	display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line);
	border-radius: 14px; padding: 0 14px; margin-bottom: 8px; color: var(--muted);
}
.search input { border: 0; outline: 0; background: transparent; font: inherit; min-height: 54px; width: 100%; color: var(--ink); }
.consul-row { display: flex; align-items: center; gap: 14px; }
.row-body { flex: 1; min-width: 0; }
.row-name { font-family: var(--serif); font-size: 20px; margin: 0; }
.consul-row p { margin: 0; }

/* Perfil */
.profile { text-align: center; padding: 8px 0 12px; }
.profile .face { margin: 0 auto 12px; }
.profile-name { font-size: 26px; margin-bottom: 4px; }
.profile-title { color: var(--muted); margin-bottom: 6px; }
.actions { margin-top: 12px; }
.facts p { margin-bottom: 12px; }
.answer h3 { color: var(--red-dark); font-size: 19px; }

/* Áreas */
.area-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.area-tile {
	position: relative; min-height: 150px; border-radius: var(--radius); padding: 14px;
	display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
	background: var(--bg); color: var(--c); text-decoration: none; overflow: hidden;
}
.area-tile.has-photo { background: #333 var(--photo) center / cover; color: #fff; }
.area-tile.has-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), rgba(0,0,0,.05) 70%); }
.area-tile > * { position: relative; }
.area-ico { margin-bottom: auto; }
.area-name { font-family: var(--serif); font-size: 18px; line-height: 1.15; overflow-wrap: anywhere; hyphens: auto; }
.area-n { font-size: 14px; font-weight: 600; opacity: .85; }
.area-head { display: flex; gap: 12px; align-items: center; background: var(--bg); color: var(--c); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.area-head p { margin: 0; font-weight: 600; }
.filter { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.filter a { flex: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 600; }
.filter a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Formularios */
.form-page { padding-top: 8px; }
.form { margin: 0; }
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=url], input[type=tel], select, textarea {
	width: 100%; min-height: 54px; padding: 12px 14px; font: inherit; color: var(--ink);
	background: #fff; border: 1.5px solid #D9D1C4; border-radius: 12px;
}
textarea { min-height: 110px; resize: vertical; }
.code-input { font-size: 32px !important; letter-spacing: .3em; text-align: center; }
.form-card h2 { font-size: 21px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
fieldset.step { border: 0; padding: 0; margin: 0 0 24px; }
.step legend { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; margin-bottom: 12px; padding: 0; }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; display: inline-flex; align-items: center; justify-content: center; font: 700 17px var(--sans); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; display: block; cursor: pointer; }
.tile input { position: absolute; opacity: 0; inset: 0; }
.tile-in {
	display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 120px; padding: 14px;
	background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
}
.tile-in strong { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.tile-in small { color: var(--muted); font-size: 15px; line-height: 1.3; }
.tile input:checked + .tile-in { border-color: var(--red); background: var(--red-soft); }
.tile input:focus-visible + .tile-in { outline: 3px solid var(--gold); outline-offset: 2px; }
.tile-area .tile-in { color: var(--c); min-height: 96px; }
.tile-area input:checked + .tile-in { background: var(--bg); border-color: var(--c); }
.tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.publish [data-only="enlace"] { display: none; }
.publish.is-enlace [data-only="enlace"] { display: block; }
.face-choice { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.radio, .switch { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; cursor: pointer; }
.radio input, .switch input { width: 24px; height: 24px; flex: none; margin: 2px 0 0; accent-color: var(--red); }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.check-chip { cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; }
.check-chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; background: #fff; border: 2px solid var(--line); color: var(--c); font-weight: 600; font-size: 16px; }
.check-chip input:checked + span { background: var(--bg); border-color: var(--c); }
.check-chip input:focus-visible + span { outline: 3px solid var(--gold); }

.notice { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.notice-ok { background: #EAF3DE; color: #27500A; }
.notice-err { background: var(--red-soft); color: var(--red-dark); }
.done { text-align: center; padding-top: 24px; }
.done .ico { color: var(--wa); margin: 0 auto 8px; }

.menu-list { margin-top: 12px; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.menu-item span { flex: 1; font-weight: 600; }
.menu-langs .langs { margin-left: auto; }
.danger-zone { margin-top: 24px; }
.steps ol { padding-left: 22px; margin: 0; }
.steps li { margin-bottom: 8px; }
.prose h2 { font-size: 21px; margin-top: 1.2em; }

/* Portada */
.hero {
	min-height: 260px; display: flex; align-items: flex-end;
	margin: -16px -16px 0; padding: 24px 20px;
	background:
		linear-gradient(180deg, #fff 0 50%, var(--red) 50% 100%) left top / 100% 10px no-repeat,
		#F3ECE0;
}
.hero.has-photo { background: #555 var(--hero) center / cover; position: relative; }
.hero.has-photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); }
.hero-in { position: relative; }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.hero-title { font-size: 34px; margin: 0; }
.hero.has-photo .hero-title, .hero.has-photo .eyebrow { color: #fff; }
.pub-intro { padding: 20px 0 8px; }
.pub-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.pub-block h2 { font-size: 22px; }
.pub-block p { margin: 0; }
.area-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.area-mini-i { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--bg); color: var(--c); font-weight: 600; font-size: 15px; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.pub-foot { text-align: center; padding: 24px 0 16px; color: var(--muted); }
.flagbar { height: 8px; border-radius: 4px; background: linear-gradient(180deg, #fff 0 50%, var(--red) 50% 100%); border: 1px solid var(--line); margin: 0 0 16px; }
.pronto { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.brand-big { font-family: var(--serif); font-size: 34px; letter-spacing: .1em; margin: 16px 0 4px; }

@media (min-width: 720px) {
	.wrap { padding: 24px; }
	.tiles-3, .area-grid { grid-template-columns: repeat(3, 1fr); }
	.area-mini { grid-template-columns: repeat(3, 1fr); }
	.hero { margin: -24px -24px 0; border-radius: 0 0 var(--radius) var(--radius); min-height: 320px; }
}
