/* ==============================
   VARIABLES
   ============================== */
:root {
    /* Fondos */
    --bg-color:       #f0ebe4;   /* antes: #faf8f5 — más crema, menos blanco */
    --card-bg-color:  #f7f2ec;   /* antes: #ffffff — adiós blanco puro       */

    /* Texto */
    --text-color:     #2e2318;   /* antes: #2a1f14 — mínimo ajuste, más cálido */
    --text-secondary-color: #7a6a58;

    /* Acento — ahora diferenciado del secundario */
    --accent-color:      #8b6f52;
    --accent-soft:       rgba(139, 111, 82, .09);

    /* Bordes y títulos */
    --border-color:      #e8e2da;
    --title-color:       #5c4530;

    /* Sombras */
    --hover-shadow:      0 12px 24px rgba(0, 0, 0, 0.06);

    /* Tipografía */
    --font-heading: system-ui, 'Lato', serif;
    --font-body:    system-ui, 'Lato', sans-serif;
}

html[data-theme='dark'] {
    /* Fondos — oscuro pero cálido, no neutro */
    --bg-color:          #1a1612;
    --card-bg-color:     #221e19;

    /* Texto — cálido, no gris frío */
    --text-color:        #e8ddd4;
    --text-secondary-color: #b09888;

    /* Acento */
    --accent-color:      #c9a882;
    --accent-soft:       rgba(201, 168, 130, .12);

    /* Bordes y títulos */
    --border-color:      #332d26;
    --title-color:       #e0cfc0;

    /* Sombras */
    --hover-shadow:      0 12px 28px rgba(0, 0, 0, 0.50);
}

/* ==============================
   RESET / BASE
   ============================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* scroll suave */
html {
    scroll-behavior: smooth;
}

/* ==============================
   ENLACES
   ============================== */

a {
    text-decoration: none;
    font-weight: 500;
    transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;

    padding: .2rem .6rem;
    margin: 0rem .2rem .5rem 0;
    color: var(--accent-color);
    text-transform: none;
}

a:hover {
    color: var(--title-color);
}

div {
    padding: 0rem .1rem .1rem .1rem;
}

/* tags tipo pill */

.tag {
    display: inline-block;
    padding: .2rem .6rem;
    margin: .15rem .3rem .15rem 0;
    font-size: .8rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-color);
    text-transform: none;
    letter-spacing: .3px;
}

.tag:hover {
    background: var(--accent-color);
    color: var(--card-bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .10);
}

.nav-link {
    display: inline-block;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-color);
    font-size: .88rem;       /* antes: 1rem */
    letter-spacing: .03em;   /* antes: .05em */
    text-transform: uppercase;
}

.nav-link:hover {
    color: var(--accent-color);
}

/* ==============================
   CONTENEDORES
   ============================== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.containerPost {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 1.5rem;  /* antes: 0rem 0rem */
}

/* ==============================
   HEADER / NAV
   ============================== */

header.container {
    padding: 4rem 1rem 0.5rem 1rem;
    border-bottom: 10px solid var(--border-color);
    text-align: center;
    position: relative;
    margin-bottom: 1rem;
}

.site-title {
    font-family: var(--font-heading);
    font-size: 2.4rem;
    margin: 0 0 .4rem 0;
    letter-spacing: -0.4px;
    color: var(--title-color);
}

.site-subtitle {
    margin: 0;
    font-size: .98rem;
    color: var(--text-secondary-color);
}

nav.main-nav {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: .75rem;        /* antes: 1.25rem */
    flex-wrap: wrap;
}

/* ==============================
   THEME TOGGLE
   ============================== */

.themeToggle {
    position: absolute;
    top: 2.6rem;
    right: 1.5rem;

    background: transparent;
    border: none;
    padding: 0;

    font-size: .9rem;
    letter-spacing: .08em;
    text-transform: uppercase;

    color: var(--text-secondary-color);
    cursor: pointer;
}

.themeToggle:hover {
    color: var(--accent-color);
}

.theme-label {
    opacity: .75;
}

html[data-theme='dark'] .theme-label::after {
    content: " oscuro";
}

html:not([data-theme='dark']) .theme-label::after {
    content: " claro";
}

/* ==============================
   TYPOGRAFÍA
   ============================== */

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--title-color);
}

h1 {
    font-size: 2.1rem;
    margin: 1.2rem 0 .8rem;
}

h2 {
    font-size: 1.8rem;
    margin: 1.5rem 0 .7rem;
}

h3 {
    font-size: 1.50rem;
    margin: 1.2rem 0 .6rem;
}

p {
    margin: 0 0 0rem;
    font-size: 1.05rem;
    line-height: 1.80;
}

/* listas en acerca / etc */
main ul {
    padding-left: 1.2rem;
}

main li {
    margin-bottom: .4rem;
    font-size: .98rem;
}

/* separadores suaves */
hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2.5rem 0;
}

/* ==============================
   BOTONES
   ============================== */

.btn {
    display: inline-block;
    border-radius: 999px;
    padding: .55rem 1.2rem;
    font-size: .9rem;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--accent-color);
    color: #fff;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.btn:hover {
    background: #594736;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.btn--ghost {
    background: transparent;
    color: var(--accent-color);
    border-color: var(--title-color);
}

.btn--ghost:hover {
    background: var(--accent-soft);
}

/* ==============================
   HOME: LISTA DE POSTS
   ============================== */

#post-list {
    margin: 0 auto 0.5rem;
    padding: 0;
}

/* grid responsiva */
.postGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .postGrid {
        grid-template-columns: 1fr 1fr;
    }
}

/* primera tarjeta tipo "destacado" */
.postFeatured {
    grid-column: 1 / -1;
}

/* tarjeta genérica */
.postCard {
    list-style: none;
    background: var(--card-bg-color);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1rem 1rem 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .02);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    opacity: 0;
    transform: translateY(18px);
}

.postCard.visible {
    opacity: 1;
    transform: translateY(0);
}

.postCard:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
    border-color: var(--title-color);
}

.postTitle {
    font-size: 1.45rem;
    margin: 0 0 .35rem;
    line-height: 1.35;
}

.postTitle a {
    color: var(--title-color);
}

.postTitle a:hover {
    color: var(--text-color);
}

.postMeta {
    font-size: .8rem;
    color: var(--text-secondary-color);
    margin-bottom: .5rem;
}

.postExcerpt {
    font-size: .95rem;
    color: var(--text-secondary-color);
    margin-bottom: .9rem;
}

/* contenedor de tags debajo de tarjetas / posts */
.post-card__tags,
.postTagsMeta {
    margin-top: 0rem;
}

/* ==============================
   PÁGINA DE POST
   ============================== */

/* Barra superior mínima */
.post-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 750px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem .5rem;
}

.post-back {
    font-size: .85rem;
    color: var(--text-secondary-color);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: .3rem .85rem;
    margin: 0;
    font-weight: 500;
}

.post-back:hover {
    color: var(--accent-color);
    background: var(--border-color);
}

/* themeToggle dentro del topbar — quitar posición absoluta */
.post-topbar .themeToggle {
    position: static;
}

/* Encabezado de lectura (título + meta dentro del artículo) */
.postReadingHeader {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 10px solid var(--border-color);
}

.postReadingTitle {
    font-size: 2rem;
    line-height: 1.25;
    margin: 0 0 .5rem;
    color: var(--title-color);
}

.postMeta {
    font-size: .8rem;
    color: var(--text-secondary-color);
    margin: 0;
}

/* Cuerpo del post */
#post-content {
    margin-bottom: 0.5rem;
}

#post-content .postBody p {
    white-space: pre-wrap;
}

#post-content .postBody h2 {
    margin-top: 1.8rem;
    font-size: 1.4rem;
}

#post-content .postBody h3 {
    margin-top: 1.4rem;
    font-size: 1.15rem;
}

#post-content .postBody ul,
#post-content .postBody ol {
    padding-left: 1.2rem;
    margin-bottom: 1.4rem;
}

#post-content .postBody li {
    margin-bottom: .25rem;
}

/* ==texto== → resaltado */
mark {
    background: rgba(139, 111, 82, .18);
    color: var(--text-color);
    padding: .05rem .25rem;
    border-radius: 3px;
}

html[data-theme='dark'] mark {
    background: rgba(201, 168, 130, .22);
}

/* Código inline */
#post-content .postBody code {
    font-family: 'Courier New', Courier, monospace;
    font-size: .87rem;
    background: var(--accent-soft);
    color: var(--title-color);
    padding: .15rem .45rem;
    border-radius: 4px;
}

/* Bloque de código ``` */
#post-content .postBody pre {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

#post-content .postBody pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: .88rem;
    color: var(--text-color);
}

/* Tags del post — separadas visualmente del cuerpo */
.postTagsMeta {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 10px solid var(--border-color);
}

/* Nota */
.postNote {
    margin: 1.5rem 0;
    padding: .75rem 1rem;
    border-radius: 8px;
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-color);
    color: var(--text-secondary-color);
    font-size: .97rem;
}

.postNote::before {
    content: "💡 Nota:";
    display: block;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: .35rem;
    font-size: .88rem;
}

/* Navegación entre posts */
.postNavigation {
    margin: 0rem 0 0.5rem;
    padding: 0.5rem 0 0;
    border-top: 10px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .9rem;
}

.postNavigation a {
    max-width: 48%;
}

/* ==============================
   TAGS PAGE
   ============================== */

.tagsCloud {
    margin: 1rem 0 2rem;
}

.tagsCloud .tag {
    margin-bottom: .35rem;
}

.tagTitle {
    margin-top: .5rem;
}

/* ==============================
   ACERCA
   ============================== */

.aboutSection {
    margin-top: 1.5rem;
}

.aboutSection p {
    font-size: 1rem;
}

/* ==============================
   404
   ============================== */

.notFound {
    text-align: center;
    margin: 2.5rem 0 3rem;
}

.notFound p {
    font-size: .98rem;
}

/* ==============================
   FOOTER
   ============================== */

footer.container {
    border-top: 10px solid var(--border-color);
    margin-top: 0.5rem;
    padding: 0.5rem 1rem 3rem 1rem;
    text-align: center;
    font-size: .85rem;
    color: var(--text-secondary-color);
}

footer .footer-links {
    margin-bottom: .8rem;
}

footer .footer-links a {
    display: inline-block;
    font-size: .85rem;
    margin: 0 .4rem;
}

/* ==============================
   RESPONSIVE AJUSTES
   ============================== */

@media (max-width: 480px) {
    header.container {
        padding-top: 4rem;
        padding-bottom: 0.5rem;
    }

    .themeToggle {
        top: 1.6rem;
        right: 1.2rem;
    }

    .site-title {
        font-size: 2rem;
    }

    .container,
    .containerPost {
        padding: 0 1.1rem;
    }

    .postCard {
        padding: 1.2rem 1.1rem 1rem;
    }

    #post-header h1 {
        font-size: 1.7rem;
    }
}

/* ==============================
   STATUS / NOTIFICACIONES
   ============================== */

#status {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    padding: .6rem 1.4rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    opacity: 0;
    transition: transform .35s ease, opacity .35s ease;
    white-space: nowrap;
}

#status.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

#status.is-online {
    background: #2ea44f;
}

#status.is-offline {
    background: #d73a49;
}

#status.is-update {
    background: var(--accent-color);
}