/*
Theme Name: Madrid Real
Theme URI: https://madridreal.es
Author: drama
Description: Tema de bloques para Madrid Real, la antiguía. Sin page builders: plantillas nativas y un bloque «Ficha» que lee los campos de ACF.
Requires at least: 6.6
Tested up to: 6.9
Requires PHP: 8.0
Version: 1.0.2
License: GNU General Public License v2 or later
Text Domain: madridreal
*/

/* ---------- base ---------- */
body { -webkit-font-smoothing: antialiased; }
img { display: block; }
.wp-site-blocks { padding-right: 44px; border-right: 1px solid var(--wp--preset--color--ink); min-height: 100vh; }
.wp-site-blocks > * + * { margin-block-start: 0; }
a { text-underline-offset: .15em; }

/* ---------- rail vertical ---------- */
.mr-rail { position: fixed; top: 0; right: 0; width: 44px; height: 100vh; display: flex; flex-direction: column; align-items: center; padding-top: 22px; gap: 26px; z-index: 50; }
.mr-rail a { writing-mode: vertical-rl; font-weight: 700; font-size: 13px; text-decoration: none; color: inherit; }
.mr-rail .mr-burger { width: 18px; height: 7px; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }

/* ---------- cabecera ---------- */
.mr-header { display: grid !important; grid-template-columns: 1fr auto 1fr; align-items: center; }
.mr-header .wp-block-site-title { font-size: 19px; font-weight: 800; line-height: .86; letter-spacing: -.04em; max-width: 4.2em; }
.mr-header .wp-block-site-title a { text-decoration: none; }
.mr-header .wp-block-navigation { gap: clamp(24px, 8vw, 150px); font-weight: 700; font-size: 13px; }
.mr-header .wp-block-search { justify-self: end; }
.mr-header .wp-block-search__button { background: none; color: inherit; border: 0; padding: 0; }
.mr-header .wp-block-search__button svg { width: 26px; height: 26px; }

/* ---------- mosaico ---------- */
.mr-mosaic .wp-block-post-template { display: grid !important; grid-template-columns: 2fr 2fr 1fr 1fr; grid-template-rows: 200px 200px; gap: 12px; }
.mr-mosaic .wp-block-post-template > li { overflow: hidden; margin: 0; background: var(--wp--preset--color--line); }
.mr-mosaic .wp-block-post-featured-image, .mr-mosaic .wp-block-post-featured-image a { height: 100%; margin: 0; }
.mr-mosaic .wp-block-post-featured-image img { width: 100%; height: 100%; object-fit: cover; }
.mr-mosaic li:nth-child(1) { grid-column: 1; grid-row: 1; }
.mr-mosaic li:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }
.mr-mosaic li:nth-child(3) { grid-column: 3; grid-row: 1; }
.mr-mosaic li:nth-child(4) { grid-column: 4; grid-row: 1; }
.mr-mosaic li:nth-child(5) { grid-column: 3 / 5; grid-row: 2; }
.mr-mosaic li:nth-child(6) { grid-column: 1; grid-row: 2; width: calc(50% - 6px); }
.mr-mosaic { position: relative; }
.mr-blob { position: absolute; left: calc(100% / 6); bottom: 0; width: calc(100% / 6 - 12px); height: 200px; background: var(--wp--preset--color--ink); }
.mr-blob::after { content: ""; position: absolute; inset: 0; background: var(--wp--preset--color--paper); border-radius: 44% / 30%; }
.mr-blob span { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; text-align: center; padding: 20%; font-family: var(--wp--preset--font-family--geist-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- tarjetas ---------- */
.mr-grid .wp-block-post-template { gap: 28px 12px !important; }
.mr-grid .wp-block-post-featured-image { aspect-ratio: 4/3; overflow: hidden; margin: 0; background: var(--wp--preset--color--line); }
.mr-grid .wp-block-post-featured-image img { width: 100%; height: 100% !important; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.mr-grid li:hover .wp-block-post-featured-image img { transform: scale(1.03); }
.mr-card { margin-top: 10px; }
.mr-card a { color: inherit; text-decoration: none; }
.mr-card__tag { font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.mr-card__tag i { font-style: normal; font-weight: 400; color: var(--wp--preset--color--mute); }
.mr-card__barrio { font-size: clamp(22px, 2vw, 28px); font-weight: 300; letter-spacing: -.03em; line-height: 1.05; margin-top: 4px; }
.mr-card__name { font-size: clamp(22px, 2vw, 28px); font-weight: 800; letter-spacing: -.035em; line-height: 1; text-transform: uppercase; margin: 0; }
.mr-card__ex { font-size: 12.5px; margin-top: 7px; max-width: 46ch; }
.mr-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 9px; font-size: 12.5px; font-weight: 700; }
.mr-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--wp--preset--color--accent); margin-right: 5px; }
.mr-dot.is-mid { background: #e0a33b; } .mr-dot.is-low { background: #e0533b; }
.mr-cal::before { content: ""; display: inline-block; width: 9px; height: 8px; border: 1.5px solid currentColor; border-top-width: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- secciones ---------- */
.mr-rule { border-top: 1px solid var(--wp--preset--color--ink); }
.mr-side-list ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 10px; font-size: 13px; }
.mr-side-list li { padding: 1px 0; }
.mr-side-list a { text-decoration: none; } .mr-side-list a:hover { text-decoration: underline; }
.mr-scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; font-size: 12px; }
.mr-scale p { border-bottom: 1px solid var(--wp--preset--color--ink); padding-bottom: 5px; margin: 0; }

/* ---------- barrios ---------- */
.mr-barrios { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mr-barrio { position: relative; aspect-ratio: 3/4; overflow: hidden; border-radius: 999px 999px 0 0; background: var(--wp--preset--color--ink); color: var(--wp--preset--color--paper); text-decoration: none; }
.mr-barrio img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .3s; }
.mr-barrio:hover img { opacity: 1; }
.mr-barrio span { position: absolute; left: 12px; bottom: 10px; font-weight: 800; font-size: 22px; letter-spacing: -.03em; text-transform: uppercase; }
.mr-barrio small { position: absolute; right: 12px; bottom: 14px; font-family: var(--wp--preset--font-family--geist-mono); font-size: 11px; }

/* ---------- ficha ---------- */
.mr-ficha-hero .wp-block-post-featured-image { height: min(62vh, 560px); margin: 0; }
.mr-ficha-hero .wp-block-post-featured-image img { width: 100%; height: 100% !important; object-fit: cover; }
.mr-ficha { position: sticky; top: 16px; }
.mr-ficha__tag { font-size: 12px; font-weight: 700; text-transform: capitalize; }
.mr-ficha__barrio { font-size: clamp(30px, 3.4vw, 48px); font-weight: 300; letter-spacing: -.04em; line-height: 1; margin-top: 10px; }
.mr-ficha__name { font-size: clamp(40px, 5vw, 72px); font-weight: 800; letter-spacing: -.05em; line-height: .9; text-transform: uppercase; margin: 0; }
.mr-ficha__ex { font-size: 17px; font-weight: 300; margin-top: 12px; max-width: 34ch; }
.mr-score { display: flex; align-items: baseline; gap: 10px; margin: 20px 0 8px; border-top: 1px solid var(--wp--preset--color--ink); padding-top: 10px; }
.mr-score b { font-size: 56px; font-weight: 800; letter-spacing: -.05em; line-height: .9; }
.mr-score span { font-size: 12px; font-weight: 700; }
.mr-rows { border-top: 1px solid var(--wp--preset--color--ink); }
.mr-row { display: grid; grid-template-columns: 110px 1fr 54px; gap: 4px 10px; padding: 9px 0; border-bottom: 1px solid var(--wp--preset--color--line); font-size: 13px; }
.mr-row b { font-size: 12px; text-transform: uppercase; }
.mr-row .n { font-weight: 800; text-align: right; }
.mr-bar { grid-column: 2 / 4; height: 4px; background: var(--wp--preset--color--line); }
.mr-bar i { display: block; height: 100%; background: var(--wp--preset--color--ink); }
.mr-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.mr-facts div { background: #ece5d8; border-radius: 12px; padding: 10px; }
.mr-facts small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.mr-facts span { font-size: 13px; }
.mr-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mr-links a { background: var(--wp--preset--color--pill); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 12.5px; text-decoration: none; color: inherit; }
.mr-links a:hover { background: var(--wp--preset--color--ink); color: var(--wp--preset--color--paper); }
.mr-body > p:first-child::first-letter { font-weight: 800; font-size: 3.2em; float: left; line-height: .82; margin: 4px 8px 0 0; letter-spacing: -.04em; }

/* ---------- móvil ---------- */
@media (max-width: 820px) {
  .wp-site-blocks { padding-right: 0; border-right: 0; }
  .mr-rail { display: none; }
  .mr-header { grid-template-columns: 1fr auto; }
  .mr-header .wp-block-navigation { justify-self: end; }
  .mr-header .wp-block-search { display: none; }
  .mr-mosaic .wp-block-post-template { grid-template-columns: 1fr 1fr; grid-template-rows: 150px 150px 150px; }
  .mr-mosaic li:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .mr-mosaic li:nth-child(2) { grid-column: 1; grid-row: 2 / 4; }
  .mr-mosaic li:nth-child(3) { grid-column: 2; grid-row: 2; }
  .mr-mosaic li:nth-child(5) { grid-column: 2; grid-row: 3; }
  .mr-mosaic li:nth-child(4), .mr-mosaic li:nth-child(6), .mr-blob { display: none; }
  .mr-barrios { grid-template-columns: 1fr 1fr; }
  .mr-scale { grid-template-columns: 1fr 1fr; }
  .mr-ficha { position: static; }
  .mr-ficha-hero .wp-block-post-featured-image { height: 320px; }
}
/* ---------- nombres de categoría en minúscula en la base de datos ---------- */
.mr-card__barrio, .mr-ficha__barrio, .mr-side-list a, .wp-block-query-title { text-transform: capitalize; }
/* ---------- criterios: niveles 1–5 ---------- */
.mr-nivel { position: relative; padding: 8px 0 8px 44px; margin: 0 !important; border-bottom: 1px solid var(--wp--preset--color--line); font-size: 15px; }
.mr-nivel__n { position: absolute; left: 0; top: 7px; font-weight: 800; font-size: 22px; letter-spacing: -.04em; line-height: 1; }