/* ============================================================
   refactored-styles.css — Centro Escolar Cadereyta
   Arquitectura: BEM | Layout: Flexbox + Grid | Sin !important
   ============================================================ */

@import url("fontawesome-all.min.css");
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600&display=swap");

/* ============================================================
   1. RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: #f7f7f7 url("images/bg01.png") repeat;
    color: #26225B;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.7;
    -webkit-text-size-adjust: none;
    overflow-x: hidden;
}

/* Preload — disable animations during initial load */
body.is-preload * {
    animation: none !important; /* intentional: one-shot preload block */
    transition: none !important;
}

/* ============================================================
   2. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    color: inherit;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 0.75em;
}

h2 { font-size: 1.75rem; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem;  letter-spacing: -0.01em; }

p, ul, ol, dl, table, blockquote { margin-bottom: 1.5em; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; }
em, i     { font-style: italic; }

a {
    color: #018A38;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover {
    color: #01a844;
    border-bottom-color: transparent;
}

ul { list-style: none; }

hr {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin: 2em 0;
}

/* ============================================================
   3. LAYOUT — Container & Grid
   ============================================================ */
.container {
    margin-inline: auto;
    padding-inline: 2em;
    width: min(1400px, 100%);
}

/* Simple gap-based flex grid — no negative margins */
.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5em;
}

.grid__col--12 { width: 100%; }
.grid__col--9  { flex: 0 0 calc(75% - 2.5em);    min-width: 0; }
.grid__col--8  { flex: 0 0 calc(66.667% - 2.5em); min-width: 0; }
.grid__col--6  { flex: 0 0 calc(50% - 2.5em);    min-width: 0; }
.grid__col--4  { flex: 0 0 calc(33.333% - 2.5em); min-width: 0; }
.grid__col--3  { flex: 0 0 calc(25% - 2.5em);    min-width: 0; }

/* two-column content+sidebar layout */
.layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3em;
    align-items: start;
}

/* ============================================================
   4. BUTTON
   ============================================================ */
.button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
    display: inline-block;
    appearance: none;
    background-color: #018A38;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    min-width: 9em;
    padding: 0.85em 1.6em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    box-shadow: 0 2px 8px rgba(1,138,56,0.25);
}

.button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
    background-color: #01a844;
    box-shadow: 0 4px 18px rgba(1,138,56,0.4);
    transform: translateY(-1px);
    color: #fff;
    border-bottom: none;
}

.button:active,
input[type="submit"]:active { transform: translateY(0); }

.button--alt {
    background-color: #26225B;
    box-shadow: 0 2px 8px rgba(38,34,91,0.2);
}
.button--alt:hover { background-color: #332e7a; box-shadow: 0 4px 18px rgba(38,34,91,0.35); }

.button--outline {
    background-color: transparent;
    border: 2px solid #018A38;
    color: #018A38;
    box-shadow: none;
}
.button--outline:hover {
    background-color: #018A38;
    color: #fff;
}

.button--fit { width: 100%; }

/* ============================================================
   5. ICONS LIST (footer / sidebar contact)
   ============================================================ */
.icon-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
}

.icon-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.6em;
    line-height: 1.5;
    font-size: 0.9rem;
}

.icon-list li::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #018A38;
    min-width: 1.2em;
    text-align: center;
    margin-top: 0.1em;
}
.icon-list .fa-home::before     { content: "\f015"; }
.icon-list .fa-phone::before    { content: "\f095"; }
.icon-list .fa-envelope::before { content: "\f0e0"; }
.icon-list .fa-clock::before    { content: "\f017"; }

/* Social icons list */
.social-icons {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1em;
    margin: 1.5em 0;
}
.social-icons a,
.social-icons__fb-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6em;
    height: 2.6em;
    border-radius: 50%;
    background-color: rgba(38,34,91,0.1);
    color: #999;
    border: 0;
    font-size: 1rem;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}
.social-icons a:hover,
.social-icons__fb-link:hover {
    background-color: #26225B;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(38,34,91,0.3);
}

/* SVG logo Facebook */
.social-icons__fb-img {
    width: 1.2em;
    height: 1.2em;
    display: block;
    /* Filtro para convertir el SVG original a blanco cuando hay hover */
    filter: invert(50%) sepia(0%) brightness(1.2);
    transition: filter 0.25s ease;
}
.social-icons__fb-link:hover .social-icons__fb-img {
    filter: brightness(0) invert(1);
}

/* ============================================================
   6. BOX COMPONENT (post cards)
   ============================================================ */
.box {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(38,34,91,0.07);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.box:hover {
    box-shadow: 0 6px 28px rgba(38,34,91,0.13);
    transform: translateY(-2px);
}

.box__image-link {
    display: block;
    overflow: hidden;
}
.box__image-link img {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.box__image-link:hover img { transform: scale(1.04); }

.box__body {
    padding: 1.25em 1.5em 1.5em;
}
.box__body h3 {
    color: #26225B;
    margin-bottom: 0.4em;
    font-size: 1.05rem;
}
.box__body p {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 0;
}

/* ============================================================
   7. PAGE WRAPPER
   ============================================================ */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================
   8. HEADER
   ============================================================ */
.header {
    background-color: #fff;
    background-image: url("images/bg02.png"), url("images/bg01.png");
    background-position: top left, top left;
    background-size: 100% 6em, auto;
    background-repeat: no-repeat, repeat;
    padding: 2.5em 0 0;
    text-align: center;
}

.header__logo-wrap {
    display: block;
    margin-bottom: 1.5em;
}
.header__logo-wrap img {
    max-height: 80px;
    width: auto;
}

/* ============================================================
   9. NAVIGATION
   ============================================================ */
.nav {
    background-color: #26225B;
    background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25));
    position: relative;
    overflow: visible; /* MUST be visible — dropotron positions dropdowns outside nav bounds */
    z-index: 100;
}

.nav::after {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #018A38, #01c44e, #018A38);
    background-size: 200% 100%;
    animation: nav-shine 4s linear infinite;
}

@keyframes nav-shine {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* Nav — nivel 1: la barra principal */
.nav > ul,
.nav__list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Nav items — nivel 1 */
.nav > ul > li,
.nav__item {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Nav links — nivel 1 */
.nav > ul > li > a,
.nav__link {
    display: block;
    color: rgba(255,255,255,0.78);
    padding: 1.1em 1.25em;
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 3px solid transparent;
    border-top: 3px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, border-bottom-color 0.2s ease, background-color 0.2s ease;
}

.nav > ul > li:hover > a,
.nav > ul > li.current > a,
.nav__item:hover > .nav__link,
.nav__item.current > .nav__link,
.nav__item--active > .nav__link {
    color: #fff;
    border-bottom-color: #018A38;
    background-color: rgba(255,255,255,0.07);
}

/* ============================================================
   DROPOTRON — dropdown menus managed by the jQuery plugin
   dropotron uses display:none/block, NOT opacity, so we must
   style the elements dropotron creates: .dropotron (the <ul>)
   ============================================================ */

/* The dropdown <ul> — dropotron adds class .dropotron and
   manages display. We only style appearance. */
.dropotron {
    background-color: #2c2870;
    border-top: 3px solid #018A38;
    border-radius: 0 0 10px 10px;
    list-style: none;
    margin: 0;
    padding: 0.5em 0;
    min-width: 200px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    z-index: 1000;
}

.dropotron li {
    border-top: 1px solid rgba(255,255,255,0.06);
}
.dropotron li:first-child { border-top: none; }

.dropotron li a,
.dropotron li span {
    display: block;
    padding: 0.75em 1.4em;
    color: rgba(255,255,255,0.82);
    font-size: 0.82rem;
    font-weight: 400;
    text-decoration: none;
    border: none;
    white-space: nowrap;
    letter-spacing: 0.04em;
    transition: color 0.18s ease, background-color 0.18s ease, padding-left 0.18s ease;
}

.dropotron li a:hover,
.dropotron li span:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
    padding-left: 1.8em;
    border: none;
}

/* Nested level-0 dropotron (immediate child of nav) */
.dropotron.level-0 {
    /* level-0 is the top-most dropdown — extra top offset to clear nav bar */
    margin-top: 1px;
}

/* Also keep plain CSS hover dropdowns as fallback (in case dropotron fails) */
.nav > ul > li > ul,
.nav__item > ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;          /* align to left edge of parent li */
    background-color: #2c2870;
    border-top: 3px solid #018A38;
    border-radius: 0 0 10px 10px;
    min-width: 200px;
    list-style: none;
    padding: 0.5em 0;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    z-index: 1000;
}

.nav > ul > li:hover > ul,
.nav__item:hover > ul { display: block; }

.nav > ul > li > ul > li > a,
.nav__item > ul > li > a {
    display: block;
    padding: 0.75em 1.4em;
    color: rgba(255,255,255,0.82);
    font-size: 0.82rem;
    text-decoration: none;
    border-bottom: none;
    border-top: none;
    white-space: nowrap;
    transition: color 0.18s ease, background-color 0.18s ease, padding-left 0.18s ease;
}

.nav > ul > li > ul > li > a:hover,
.nav__item > ul > li > a:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
    padding-left: 1.8em;
    border: none;
}



/* ============================================================
   10. SLIDER / BANNER
   ============================================================ */
.banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #26225B;
}

.slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.slider__track {
    display: flex;
    width: 300%;
    animation: slider-anim 26s infinite ease-in-out;
}
.slider__track:hover { animation-play-state: paused; }

.slider__slide {
    width: 33.3333%;
    flex-shrink: 0;
}
.slider__slide img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
}

.slider__timeline {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 0;
    background: linear-gradient(90deg, #018A38, #01c44e);
    animation: timeline-anim 26s infinite;
}
.slider__track:hover ~ .slider__timeline { animation-play-state: paused; }

@keyframes slider-anim {
    0%, 25%         { transform: translateX(0); }
    30%, 55%        { transform: translateX(-33.3333%); }
    60%, 85%,100%   { transform: translateX(-66.6666%); }
}
@keyframes timeline-anim {
    0%,30%,60%,100% { width: 0; }
    25%,55%,85%     { width: 100%; }
}

/* Banner overlay caption */
.banner__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25em 2em;
    background: linear-gradient(transparent, rgba(20,18,60,0.82));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5em;
    flex-wrap: wrap;
}

.banner__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    color: #fff;
}

/* ============================================================
   11. WRAPPER SECTIONS
   ============================================================ */
.wrapper {
    padding: 4em 0;
}

.wrapper--style1 {
    background: #fff;
}

.wrapper--style2 {
    background-color: #fff;
    background-image: url("images/bg02.png"), url("images/bg03.png"), url("images/bg01.png");
    background-position: top left, bottom left, top left;
    background-size: 100% 6em, 100% 6em, auto;
    background-repeat: no-repeat, no-repeat, repeat;
}

.wrapper--style3 {
    background-color: #018A38;
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(0,0,0,0.18)), url("images/bg01.png");
    color: #fff;
}
.wrapper--style3 h2 { color: #fff; }
.wrapper--style3 .button {
    background-color: #fff;
    color: #018A38;
    box-shadow: 0 2px 8px rgba(255,255,255,0.15);
}
.wrapper--style3 .button:hover {
    background-color: #f0fff5;
    color: #016e2e;
}

/* ============================================================
   12. CTA SECTION
   ============================================================ */
.cta {
    padding: 4em 0;
    text-align: center;
    background-color: #018A38;
    background-image: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(0,0,0,0.18)), url("images/bg01.png");
    color: #fff;
}

.cta header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5em;
    flex-wrap: wrap;
}

.cta h2 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
}

/* ============================================================
   13. ARTICLE / CONTENT AREA
   ============================================================ */
.content {
    min-width: 0; /* prevent grid blowout */
}

.content article header {
    margin-bottom: 1.5em;
}

.content article header h2 {
    font-size: 1.8rem;
    color: #26225B;
    margin-bottom: 0.2em;
}

.content article header p {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

.image--featured {
    display: block;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5em;
}
.image--featured img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ============================================================
   14. SIDEBAR
   ============================================================ */
.sidebar {
    min-width: 0;
}

.sidebar section {
    background: #fff;
    border-radius: 8px;
    padding: 1.5em;
    margin-bottom: 1.5em;
    box-shadow: 0 2px 12px rgba(38,34,91,0.07);
}

.sidebar section:last-child { margin-bottom: 0; }

.sidebar section h3 {
    font-size: 1rem;
    color: #26225B;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid #018A38;
}

.sidebar section a {
    color: #26225B;
}
.sidebar section a:hover { color: #018A38; }

/* ============================================================
   15. FOOTER
   ============================================================ */
.footer {
    background-color: #f0f0f0;
    border-top: 3px solid #26225B;
    padding: 3.5em 0 2em;
    margin-top: auto;
}

.footer h3 {
    font-size: 1rem;
    color: #26225B;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1em;
}

.footer a {
    color: #555;
    border-bottom-color: rgba(0,0,0,0.12);
}
.footer a:hover { color: #018A38; }

.footer__bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    flex-wrap: wrap;
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid #ddd;
    font-size: 0.82rem;
    color: #999;
}

.footer__bottom ul {
    list-style: none;
    display: flex;
    gap: 0.5em;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer__bottom li + li::before {
    content: '·';
    margin-right: 0.5em;
    color: #ccc;
}

/* copyright wrapper */
.copyright { text-align: center; }

/* ============================================================
   16. MOBILE NAV — Title Bar & Nav Panel
   (Elements created dynamically by main.js)
   ============================================================ */

/* Bar at top — hidden on desktop */
#titleBar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 44px;
    background-color: #26225B;
    z-index: 10001;
    cursor: default;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

#titleBar .toggle {
    position: absolute;
    left: 0;
    top: 0;
    width: 80px;
    height: 44px;
    text-decoration: none;
    outline: 0;
    /* hamburger icon via CSS */
}

/* Hamburger icon lines */
#titleBar .toggle::before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 2px;
    background: rgba(255,255,255,0.9);
    box-shadow:
        0 -7px 0 rgba(255,255,255,0.9),
        0  7px 0 rgba(255,255,255,0.9);
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.navPanel-visible #titleBar .toggle::before {
    background: rgba(255,255,255,0.5);
    box-shadow:
        0 -7px 0 rgba(255,255,255,0.5),
        0  7px 0 rgba(255,255,255,0.5);
}

#titleBar .title {
    display: block;
    text-align: center;
    line-height: 44px;
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

#titleBar .title img {
    height: 28px;
    width: auto;
    vertical-align: middle;
    margin-top: -3px;
}

/* Green underline accent */
#titleBar::after {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #018A38, #01c44e, #018A38);
}

/* Side panel — slide in from left */
#navPanel {
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-overflow-scrolling: touch;
    display: block;
    height: 100%;
    left: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    width: 80%;
    max-width: 320px;
    z-index: 10002;
    background-color: #26225B;
    transform: translateX(-110%);
    transition: transform 0.35s ease;
    padding: 44px 0 2em;
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
}

.navPanel-visible #navPanel {
    transform: translateX(0);
}

#navPanel .link {
    display: block;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.85em 1.5em;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

#navPanel .link:first-child { border-top: none; }

#navPanel .link:hover {
    background-color: rgba(255,255,255,0.07);
    color: #fff;
    padding-left: 1.8em;
}

/* Indent arrow for sub-items */
#navPanel .link.depth-1 {
    padding-left: 2.5em;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: none;
    color: rgba(255,255,255,0.6);
    border-color: rgba(255,255,255,0.05);
}

#navPanel .link.depth-1::before {
    content: '›';
    margin-right: 0.5em;
    color: #018A38;
    font-size: 1.1em;
}

/* Body push when panel open */
body.navPanel-visible {
    overflow-x: hidden;
}

body.navPanel-visible::before {
    content: '';
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
}

/* ============================================================
   17. MEDIA QUERIES
   ============================================================ */
@media screen and (max-width: 1680px) {
    html { font-size: 15px; }
    .container { width: min(1200px, 100%); }
}

@media screen and (max-width: 1280px) {
    html { font-size: 14px; }
    .container { width: min(960px, 100%); }
    .layout { grid-template-columns: 1fr 260px; }
}

@media screen and (max-width: 980px) {
    html { font-size: 13px; }
    .container { padding-inline: 1.5em; }
    .grid__col--6,
    .grid__col--8 { flex: 0 0 100%; }
    .grid__col--4 { flex: 0 0 calc(50% - 2.5em); }
    .layout { grid-template-columns: 1fr; }
    .sidebar { order: -1; }
}

@media screen and (max-width: 840px) {
    /* Hide desktop header, show mobile titleBar */
    .header { display: none; }
    .nav    { display: none; }

    /* Activate the titleBar (JS creates it and appends to body) */
    #titleBar { display: block; }

    /* Push page content below the fixed titleBar */
    body { padding-top: 44px; }

    /* Layout adjustments */
    .grid { gap: 1.5em; }
    .grid__col--4,
    .grid__col--3,
    .grid__col--6,
    .grid__col--8,
    .grid__col--9 { flex: 0 0 100%; }

    .banner__content { flex-direction: column; gap: 0.75em; }
    .cta header { flex-direction: column; }
    .wrapper { padding: 2.5em 0; }
}


@media screen and (max-width: 480px) {
    html { font-size: 12px; }
    .container { padding-inline: 1em; }
    .slider__slide img { max-height: 280px; }
    .banner__title { font-size: 1rem; }
    .footer { padding: 2.5em 0 1.5em; }
}
