/* ==========================================================================
   CIMYR – Centro Integral de Medicina y Rehabilitación
   ========================================================================== */

:root {
    --bordo: #8c2a29;
    --bordo-dark: #6e1f1e;
    --bordo-light: #a8403f;
    --yellow: #eeee22;
    --gold: #dba400;
    --yellow-soft: #ffff77;
    --yellow-pale: #fffbd6;
    --text: #222222;
    --muted: #666666;
    --border: #e4e4e4;
    --bg-alt: #f7f7f7;
    --white: #ffffff;
    --radius: 6px;
    --shadow: 0 6px 24px rgba(0, 0, 0, .08);
    --font-head: "Ubuntu Condensed", "Arial Narrow", sans-serif;
    --font-body: "Open Sans", Arial, Helvetica, sans-serif;
    --container: 1170px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--white);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--bordo); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 {
    font-family: var(--font-head);
    font-weight: 400;
    line-height: 1.2;
    margin: 0 0 .6em;
    color: var(--text);
}
h1 { font-size: 2.6rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.45rem; }

p { margin: 0 0 1em; }

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 16px;
}

.section { padding: 64px 0; }
.section--alt { background: var(--bg-alt); }
.section--tight { padding: 40px 0; }

.section-title {
    text-align: center;
    margin-bottom: 40px;
}
.section-title h2 { margin-bottom: .3em; }
.section-title::after,
.divider {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gold);
    margin: 14px auto 0;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 40px;
    font-family: var(--font-head);
    font-size: 1.1rem;
    letter-spacing: .5px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
}
.btn-bordo { background: var(--bordo); color: var(--white); }
.btn-bordo:hover { background: var(--bordo-dark); color: var(--white); }
.btn-yellow { background: var(--yellow); color: var(--bordo-dark); }
.btn-yellow:hover { background: var(--white); color: var(--bordo); }
.btn-outline-light { border-color: var(--white); color: var(--white); }
.btn-outline-light:hover { background: var(--white); color: var(--bordo); }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--bordo-dark);
    color: rgba(255, 255, 255, .85);
    font-size: 12.5px;
}
.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
    gap: 16px;
}
.topbar a { color: rgba(255, 255, 255, .85); }
.topbar a:hover, .topbar a.active { color: var(--yellow); }
.topbar .sep { opacity: .4; margin: 0 8px; }
.topbar-menu { display: flex; gap: 20px; }

/* ---------- Header ---------- */
.site-header {
    background: var(--bordo);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 96px;
}
.logo img { width: 230px; height: auto; }

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}
.main-nav a {
    display: block;
    position: relative;
    padding: 10px 12px;
    color: var(--white);
    font-family: var(--font-head);
    font-size: 1.12rem;
}
.main-nav a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 2px;
    background: var(--yellow);
    transform: scaleX(0);
    transition: transform .25s;
}
.main-nav a:hover,
.main-nav a.active { color: var(--yellow); }
.main-nav a:hover::after,
.main-nav a.active::after { transform: scaleX(1); }
.main-nav .main-nav-secondary { display: none; }

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 10px;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 2px;
    margin: 6px 0;
    background: var(--white);
    transition: transform .25s, opacity .25s;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Hero / slider ---------- */
.hero {
    position: relative;
    height: clamp(240px, 34.6vw, 450px);
    overflow: hidden;
    background: #333;
}
.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease;
    transform: scale(1.03);
}
.hero-slide.is-active { opacity: 1; animation: kenburns 7s ease-out forwards; }
@keyframes kenburns { to { transform: scale(1); } }

.hero-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 36px;
    z-index: 2;
}
.hero-caption h1 {
    display: inline-block;
    margin: 0;
    padding: 10px 22px;
    background: rgba(140, 42, 41, .92);
    color: var(--white);
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    border-left: 5px solid var(--yellow);
}
.hero-caption p {
    display: table;
    margin: 0;
    padding: 6px 22px;
    background: var(--yellow);
    color: var(--bordo-dark);
    font-family: var(--font-head);
    font-size: 1.15rem;
}
.hero-dots {
    position: absolute;
    right: 20px;
    bottom: 16px;
    z-index: 3;
    display: flex;
    gap: 8px;
}
.hero-dots button {
    width: 12px;
    height: 12px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--white);
    background: transparent;
    cursor: pointer;
}
.hero-dots button.is-active { background: var(--yellow); border-color: var(--yellow); }

/* ---------- Layout utilitario ---------- */
.grid { display: grid; gap: 30px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-side { grid-template-columns: 1fr 2fr; align-items: center; }
.align-center { align-items: center; }

.rounded { border-radius: var(--radius); }
.shadow { box-shadow: var(--shadow); }

.lead { font-size: 1.15rem; color: var(--muted); }

/* ---------- Home ---------- */
.intro-box {
    background: var(--gold);
    color: #000;
    padding: 36px;
    border-radius: var(--radius);
}
.intro-box h2 { color: #000; }
.intro-box ul { margin: 0; padding-left: 20px; }
.intro-box li { margin-bottom: .5em; }

.dropcap::first-letter {
    float: left;
    font-family: var(--font-head);
    font-size: 3.6rem;
    line-height: .9;
    padding: 8px 12px;
    margin: 4px 12px 0 0;
    background: var(--bordo);
    color: var(--white);
    border-radius: 4px;
}

.service-card {
    display: block;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform .25s, box-shadow .25s;
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0, 0, 0, .14); color: var(--text); }
.service-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.service-card-body { padding: 18px 20px 22px; border-top: 4px solid var(--yellow); }
.service-card h3 { margin-bottom: .3em; color: var(--bordo); }
.service-card p { margin: 0; font-size: .93rem; color: var(--muted); }

.parallax {
    min-height: 380px;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    display: flex;
    align-items: center;
}
.parallax::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(140, 42, 41, .85), rgba(140, 42, 41, .2));
}
.parallax .container { position: relative; color: var(--white); }
.parallax h2 { color: var(--white); font-size: clamp(1.8rem, 4vw, 2.8rem); max-width: 640px; }
.parallax p { max-width: 560px; font-size: 1.1rem; }

.features { text-align: center; }
.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--bordo);
    color: var(--yellow);
    display: grid;
    place-items: center;
}
.feature-icon svg { width: 30px; height: 30px; }

/* ---------- Contenido de páginas ---------- */
.content-block { font-size: 1.02rem; }
.content-block strong { color: var(--bordo); }

.side-img img { border-radius: var(--radius); box-shadow: var(--shadow); }

.box-yellow {
    background: var(--yellow-pale);
    border-left: 6px solid var(--gold);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 32px;
}
.box-yellow h2 { color: var(--bordo); }
.box-yellow .float-img {
    float: right;
    width: 300px;
    max-width: 45%;
    margin: 0 0 16px 24px;
    border-radius: var(--radius);
}
.box-yellow::after { content: ""; display: block; clear: both; }

.check-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1em;
    columns: 2;
    column-gap: 30px;
}
.check-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 6px;
    break-inside: avoid;
}
.check-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: .55em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
}

/* ---------- Galería ---------- */
.gallery { display: grid; gap: 16px; margin-top: 24px; }
.gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gallery.cols-4 { grid-template-columns: repeat(4, 1fr); }
.gallery-item {
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    position: relative;
}
.gallery-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform .4s;
}
.gallery-item::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 3rem;
    color: var(--white);
    background: rgba(140, 42, 41, .55);
    opacity: 0;
    transition: opacity .3s;
}
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item:hover::after { opacity: 1; }

/* ---------- Acordeón (instalaciones) ---------- */
.accordion details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: var(--white);
    overflow: hidden;
}
.accordion summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 18px;
    font-family: var(--font-head);
    font-size: 1.25rem;
    color: var(--bordo);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; font-size: 1.5rem; color: var(--gold); transition: transform .2s; }
.accordion details[open] summary { background: var(--bordo); color: var(--white); }
.accordion details[open] summary::after { content: "–"; color: var(--yellow); }
.accordion .accordion-body { padding: 16px; }
.accordion .accordion-body img { width: 100%; border-radius: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 24px 0; }
.stat {
    background: var(--bordo);
    color: var(--white);
    border-radius: var(--radius);
    padding: 18px 10px;
    text-align: center;
}
.stat strong { display: block; font-family: var(--font-head); font-size: 2.2rem; color: var(--yellow); line-height: 1; }
.stat span { font-size: .85rem; }

/* ---------- Staff ---------- */
.staff-group { margin-bottom: 56px; }
.staff-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    border-top: 4px solid var(--bordo);
    height: 100%;
}
.staff-card .avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--yellow);
    color: var(--bordo);
    font-family: var(--font-head);
    font-size: 1.6rem;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
}
.staff-card h3 { margin-bottom: .1em; color: var(--bordo); }
.staff-card .role { font-weight: 600; color: var(--gold); margin-bottom: .6em; }
.staff-card ul { padding-left: 18px; margin: .4em 0 0; }

/* ---------- Contacto ---------- */
.map iframe { display: block; width: 100%; height: 420px; border: 0; }
.contact-info h2 { font-size: 1.6rem; margin-top: 1.2em; color: var(--bordo); }
.contact-info h2:first-child { margin-top: 0; }

.contact-action {
    display: block;
    padding: 18px 22px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: var(--bg-alt);
    border-left: 5px solid var(--gold);
    color: var(--text);
    transition: background .2s, transform .2s;
}
.contact-action:hover { background: var(--bordo); color: var(--white); transform: translateX(4px); }
.contact-action strong { display: block; font-family: var(--font-head); font-size: 1.35rem; font-weight: 400; color: var(--bordo); }
.contact-action:hover strong { color: var(--yellow); }

/* ---------- CTA + Footer ---------- */
.cta { background: var(--gold); padding: 40px 0; }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.cta h2 { margin: 0 0 .2em; color: #000; }
.cta p { margin: 0; color: #2b2100; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.cta .btn-yellow { background: var(--bordo); color: var(--white); }
.cta .btn-yellow:hover { background: var(--bordo-dark); }
.cta .btn-outline-light { border-color: var(--bordo); color: var(--bordo); }
.cta .btn-outline-light:hover { background: var(--bordo); color: var(--white); }

.site-footer { background: var(--bordo); color: rgba(255, 255, 255, .85); font-size: .92rem; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1.3fr;
    gap: 30px;
    padding-top: 56px;
    padding-bottom: 40px;
}
.footer-logo { width: 200px; margin-bottom: 14px; }
.site-footer h3 { color: var(--yellow); font-size: 1.3rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: rgba(255, 255, 255, .85); }
.site-footer a:hover { color: var(--yellow); }
.footer-bottom {
    background: var(--bordo-dark);
    padding: 14px 0;
    font-size: .82rem;
    text-align: center;
    color: rgba(255, 255, 255, .6);
}

.wa-float {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #25d366;
    color: var(--white);
    display: grid;
    place-items: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    transition: transform .2s;
}
.wa-float:hover { transform: scale(1.08); color: var(--white); }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 60px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 88vh; width: auto; border-radius: 4px; }
.lightbox button {
    position: absolute;
    background: none;
    border: 0;
    color: var(--white);
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    padding: 10px;
}
.lightbox button:hover { color: var(--yellow); }
.lightbox-close { top: 10px; right: 16px; }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* ---------- Animación de entrada ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s, box-shadow .25s; }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .service-card.reveal.is-visible:hover { transform: translateY(-4px); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .main-nav a { font-size: 1rem; padding: 10px 8px; }
    .logo img { width: 190px; }
}

@media (max-width: 960px) {
    .topbar-menu { display: none; }
    .nav-toggle { display: block; }
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(300px, 82vw);
        background: var(--bordo-dark);
        padding: 80px 20px 20px;
        transform: translateX(100%);
        transition: transform .3s;
        overflow-y: auto;
        z-index: 150;
    }
    .nav-open .main-nav { transform: none; box-shadow: -10px 0 30px rgba(0, 0, 0, .3); }
    .main-nav ul { flex-direction: column; }
    .main-nav a { font-size: 1.25rem; padding: 10px 6px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
    .main-nav a::after { display: none; }
    .main-nav .main-nav-secondary { display: flex; margin-top: 20px; }
    .main-nav .main-nav-secondary a { font-size: 1.05rem; opacity: .85; }
    .nav-toggle { position: relative; z-index: 160; }
    .header-inner { min-height: 76px; }
    .logo img { width: 170px; }

    .grid-3, .grid-4, .gallery.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-side { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .parallax { background-attachment: scroll; }
}

@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.65rem; }
    .section { padding: 44px 0; }
    .topbar-info .sep, .topbar-info a:last-child { display: none; }
    .grid-3, .grid-4, .gallery.cols-3 { grid-template-columns: 1fr; }
    .gallery.cols-4, .gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr; }
    .check-list { columns: 1; }
    .box-yellow { padding: 22px; }
    .box-yellow .float-img { float: none; width: 100%; max-width: 100%; margin: 0 0 16px; }
    .intro-box { padding: 24px; }
    .lightbox { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .reveal { opacity: 1; transform: none; }
}
