/* ==========================================================================
   B DE BLOG — editorial / cinematic design system
   Mobile (loaded when viewport <= 767px) — self-contained, mirrors styles.css
   Tuned as a fluid scale for 390px-767px, not a single shrunk breakpoint.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300..900&family=Space+Grotesk:wght@400;500;600&family=Literata:ital,opsz,wght@0,18..144,400;0,18..144,500;1,18..144,400&display=swap');

:root {
    --void: #0b0a08;
    --charcoal: #161410;
    --panel: #1b1815;
    --panel-hi: #262219;

    --line: rgba(236, 230, 216, 0.09);
    --line-strong: rgba(236, 230, 216, 0.20);

    --paper: #ece6d8;
    --paper-dim: #a49c88;
    --paper-faint: #6b6558;

    --red: #7c2530;
    --red-soft: #9c3540;

    --gold: #b4915a;
    --gold-soft: #cdae7c;

    --f-display: 'Fraunces', Georgia, serif;
    --f-ui: 'Space Grotesk', 'Segoe UI', sans-serif;
    --f-body: 'Literata', Georgia, serif;

    /* -- Fluid type scale tuned for 390px-767px -- */
    --fs-2xs: clamp(0.75rem, 0.71rem + 0.2vw, 0.8125rem);    /* 12   -> 13   */
    --fs-xs:  clamp(0.8125rem, 0.77rem + 0.25vw, 0.9375rem); /* 13   -> 15   */
    --fs-sm:  clamp(0.9375rem, 0.89rem + 0.28vw, 1rem);      /* 15   -> 16   */
    --fs-base:clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);    /* 17   -> 19   */
    --fs-md:  clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);        /* 20   -> 24   */
    --fs-lg:  clamp(1.375rem, 1.2rem + 0.9vw, 1.625rem);     /* 22   -> 26   */
    --fs-xl:  clamp(1.75rem, 1.5rem + 1.4vw, 2.125rem);      /* 28   -> 34   */
    --fs-2xl: clamp(2.125rem, 1.75rem + 2.2vw, 2.75rem);     /* 34   -> 44   */
    --fs-3xl: clamp(2.5rem, 1.9rem + 3.5vw, 3.375rem);       /* 40   -> 54   */

    --sp-gutter: clamp(1.25rem, 1rem + 2.5vw, 1.75rem);
    --sp-section: clamp(2.75rem, 2rem + 4vw, 4rem);

    --nav-h: 128px;
    --radius: 3px;
    --radius-lg: 6px;
    --ease: cubic-bezier(.25, .7, .15, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--void);
    color: var(--paper);
    font-family: var(--f-body);
    font-size: var(--fs-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    background-image:
        radial-gradient(ellipse 100% 40% at 50% -5%, rgba(124, 37, 48, 0.12), transparent 60%),
        radial-gradient(ellipse 140% 70% at 50% 115%, rgba(0, 0, 0, 0.9), transparent 55%);
    background-attachment: fixed;
}

h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--red); color: var(--paper); }

/* ---------------------------------------------------------------------- */
/* Banner / navigation                                                    */
/* ---------------------------------------------------------------------- */

.banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.125rem var(--sp-gutter) 0.875rem;
    background: rgba(9, 8, 7, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.banner-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-style: italic;
    font-size: var(--fs-md);
    color: var(--paper);
}

.banner-image {
    height: 2.5rem;
    width: auto;
    margin-top: 0.5rem;
    opacity: 0.92;
    filter: sepia(0.15) saturate(1.1);
}

.banner-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.menu-button {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.625rem 0.125rem;
    background: none;
    color: var(--paper-dim);
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    /* comfortable tap target even though the visual style stays a text link */
    min-height: 2.25rem;
    display: inline-flex;
    align-items: center;
}

.menu-button:active,
.menu-button.active {
    color: var(--paper);
    border-bottom-color: var(--red-soft);
}

/* ---------------------------------------------------------------------- */
/* Hero                                                                   */
/* ---------------------------------------------------------------------- */

.hero {
    width: 100%;
    margin-top: calc(var(--nav-h) + clamp(1.5rem, 1rem + 2vw, 2.5rem));
    padding: 0 var(--sp-gutter) var(--sp-section);
    display: flex;
    flex-direction: column-reverse;
    gap: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
}

.hero-copy { text-align: center; }

.hero-kicker {
    display: block;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--red-soft);
    margin-bottom: 1.125rem;
}

.hero-title {
    font-family: var(--f-display);
    font-weight: 340;
    font-style: italic;
    font-size: var(--fs-3xl);
    line-height: 1.02;
    color: var(--paper);
}

.hero-title em { font-style: normal; font-weight: 600; color: var(--gold-soft); }

.hero-subtitle {
    margin: 1.25rem auto 0;
    max-width: 26rem;
    font-family: var(--f-body);
    font-size: var(--fs-base);
    line-height: 1.8;
    color: var(--paper-dim);
}

.hero-divider { width: 2.5rem; height: 1px; margin: 1.875rem auto; background: var(--line-strong); }

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
    align-items: center;
}

.hero-cta {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-cta.primary {
    padding: 0.9rem 1.875rem;
    background: var(--paper);
    color: var(--void);
    border-radius: var(--radius);
    width: 100%;
    max-width: 20rem;
}

.hero-cta.ghost {
    color: var(--paper-dim);
    border-bottom: 1px solid var(--line-strong);
    padding: 0.4rem 0.5rem;
}

.hero-portrait {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line-strong);
}

.hero-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.5) contrast(1.08) brightness(0.8) sepia(0.12);
}

/* ---------------------------------------------------------------------- */
/* Page header                                                            */
/* ---------------------------------------------------------------------- */

.page-header {
    width: 100%;
    margin-top: calc(var(--nav-h) + clamp(1.25rem, 1rem + 1.5vw, 1.75rem));
    padding: 0 var(--sp-gutter) clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
    text-align: center;
    border-bottom: 1px solid var(--line);
}

.page-kicker {
    display: block;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--red-soft);
    margin-bottom: 0.75rem;
}

.page-title {
    font-family: var(--f-display);
    font-weight: 340;
    font-style: italic;
    font-size: var(--fs-2xl);
    color: var(--paper);
    line-height: 1.05;
}

.page-subtitle {
    margin: 0.875rem auto 0;
    color: var(--paper-dim);
    font-family: var(--f-body);
    font-size: var(--fs-sm);
    line-height: 1.65;
    text-align: center;
    max-width: 30rem;
}

/* ---------------------------------------------------------------------- */
/* Category tabs                                                          */
/* ---------------------------------------------------------------------- */

.category-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem 1.75rem;
    width: 100%;
    margin: 1.5rem 0 0;
    padding: 0 var(--sp-gutter);
}

.category-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.25rem 0 0.6rem;
    min-height: 2.25rem;
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--paper-faint);
    cursor: pointer;
}

.category-tab.is-active {
    color: var(--paper);
    border-bottom-color: var(--gold-soft);
}

/* ---------------------------------------------------------------------- */
/* Card grid                                                              */
/* ---------------------------------------------------------------------- */

.card-grid {
    width: 100%;
    margin: clamp(2rem, 1.6rem + 1.5vw, 2.5rem) 0 var(--sp-section);
    padding: 0 var(--sp-gutter);
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
}

/* !important is deliberate — see styles.css for why (competes with the
   scroll-reveal .reveal/.in-view classes on the same elements). */
.story-card.is-category-hidden {
    opacity: 0 !important;
    transform: translateY(8px) !important;
    transition-duration: .2s !important;
    transition-timing-function: var(--ease) !important;
    pointer-events: none;
}

/* !important for consistency with styles.css — guarantees a hidden card
   never stays visible regardless of any other display rule (e.g. .featured). */
.story-card.is-category-removed {
    display: none !important;
}

.story-card {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--panel);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.story-card-media-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: var(--radius);
}

.story-card-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.4) contrast(1.08) brightness(0.68) sepia(0.08);
}

.story-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11,10,8,0) 40%, rgba(11,10,8,0.7) 100%);
}

.story-card-index {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.12em;
    color: var(--paper-dim);
}

.story-card-body { padding-top: 1rem; }

.story-card-author {
    display: block;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-soft);
    margin-bottom: 0.375rem;
}

.story-card-title {
    font-family: var(--f-display);
    font-weight: 480;
    font-size: var(--fs-lg);
    line-height: 1.22;
    color: var(--paper);
    overflow-wrap: break-word;
}

.story-card-rating {
    display: block;
    margin-top: 0.375rem;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.04em;
    color: var(--gold-soft);
    opacity: 0.85;
}

.story-card-arrow { display: none; }

.story-card.featured {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.25rem;
}

.story-card.featured .story-card-title { font-size: var(--fs-xl); }

/* ---------------------------------------------------------------------- */
/* Article layout                                                         */
/* ---------------------------------------------------------------------- */

.container {
    width: 94%;
    margin: 0 auto;
    padding: 0 0.25rem;
    margin-top: calc(var(--nav-h) + clamp(1.5rem, 1.2rem + 1.5vw, 2rem));
    text-align: left;
}

.story-title {
    font-family: var(--f-display);
    font-weight: 360;
    font-style: italic;
    font-size: var(--fs-2xl);
    line-height: 1.08;
    color: var(--paper);
    text-align: center;
    overflow-wrap: break-word;
}

.container::before {
    content: '';
    display: block;
    width: 2.25rem;
    height: 1px;
    margin: 1.25rem auto 1.875rem;
    background: var(--line-strong);
}

.story-text {
    text-align: justify;
    hyphens: auto;
    font-family: var(--f-body);
    font-size: var(--fs-base);
    line-height: 1.85;
    color: var(--paper-dim);
}

.story-text p { margin: 0 0 1.5em; }

.story-text p:first-of-type::first-letter {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(2.75rem, 2.3rem + 1.5vw, 3.25rem);
    line-height: 0.7;
    float: left;
    padding: 0.3rem 0.5rem 0 0;
    color: var(--red-soft);
}

.story-author {
    display: block;
    margin-top: 2.25rem;
    padding-top: 1.125rem;
    border-top: 1px solid var(--line);
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-align: right;
    color: var(--gold-soft);
}

.image-container {
    width: 100%;
    margin: 2rem auto 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
}

.story-image {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ---------------------------------------------------------------------- */
/* Series navigation                                                      */
/* ---------------------------------------------------------------------- */

.series-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin: 2rem auto 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    text-align: center;
}

.series-nav-link {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--paper-dim);
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 0.2rem;
}

.series-nav-label {
    font-family: var(--f-display);
    font-style: italic;
    font-size: var(--fs-sm);
    color: var(--paper-faint);
    order: -1;
}

/* ---------------------------------------------------------------------- */
/* Rating widget                                                          */
/* ---------------------------------------------------------------------- */

.rating-container {
    width: 100%;
    margin: 2.5rem auto 0;
    padding: 1.625rem 1.125rem;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.rating-container h3 {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--paper-dim);
    margin-bottom: 1rem;
}

.stars-average { display: flex; justify-content: center; gap: 0.625rem; }

.star {
    --star-shape: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    position: relative;
    width: 2.375rem;
    height: 2.375rem;
    clip-path: var(--star-shape);
    background: var(--panel-hi);
    box-shadow: 0 0 0 1px var(--line) inset;
}

.star::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: var(--star-shape);
    background: linear-gradient(160deg, var(--gold-soft), var(--gold));
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 var(--fill, 0%), transparent var(--fill, 0%));
    mask-image: linear-gradient(90deg, #000 0, #000 var(--fill, 0%), transparent var(--fill, 0%));
}

.rating-count {
    margin: 0.625rem 0 0;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.06em;
    color: var(--paper-faint);
}

#rating-msg {
    margin: 0.875rem 0 0;
    min-height: 1.4em;
    font-family: var(--f-ui);
    font-size: var(--fs-xs);
    color: var(--gold-soft);
}

/* ---------------------------------------------------------------------- */
/* Comments                                                                */
/* ---------------------------------------------------------------------- */

.comments-section {
    width: 100%;
    margin: 2.5rem auto 0;
    text-align: left;
}

.comments-section h3 {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-dim);
    margin-bottom: 1rem;
}

.comment-form {
    padding: 1.25rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.comment-field { margin-bottom: 1rem; }

.comment-field label {
    display: block;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--paper-faint);
    margin-bottom: 0.4rem;
}

.comment-apodo-field,
.comment-texto-field {
    width: 100%;
    background: var(--void);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--paper);
    font-family: var(--f-body);
    font-size: var(--fs-sm);
    padding: 0.7rem 0.8rem;
}

.comment-texto-field {
    resize: vertical;
    min-height: 5.5rem;
    line-height: 1.55;
    font-family: inherit;
}

.comment-apodo-field:focus,
.comment-texto-field:focus {
    outline: none;
    border-color: var(--gold-soft);
}

.comment-counter {
    display: block;
    margin-top: 0.4rem;
    text-align: right;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    color: var(--paper-faint);
}

.comment-counter.over-limit { color: var(--red-soft); }

.comment-submit {
    width: 100%;
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.8rem 1.5rem;
    background: var(--paper);
    color: var(--void);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.comment-feedback {
    margin: 0.875rem 0 0;
    min-height: 1.4em;
    font-family: var(--f-ui);
    font-size: var(--fs-xs);
    color: var(--gold-soft);
}

.comment-feedback.is-error { color: var(--red-soft); }

.comments-list {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comments-empty {
    margin-top: 1.25rem;
    font-family: var(--f-ui);
    font-size: var(--fs-xs);
    color: var(--paper-faint);
}

.comment-item {
    padding: 1rem 1.125rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.comment-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin-bottom: 0.4rem;
}

.comment-author {
    font-family: var(--f-ui);
    font-weight: 500;
    font-size: var(--fs-xs);
    color: var(--gold-soft);
}

.comment-fecha {
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    color: var(--paper-faint);
    white-space: nowrap;
}

.comment-body {
    margin: 0;
    font-family: var(--f-body);
    font-size: var(--fs-sm);
    line-height: 1.65;
    color: var(--paper-dim);
    overflow-wrap: break-word;
}

/* ---------------------------------------------------------------------- */
/* Classified dossier insert — scoped entirely to .expediente*            */
/* ---------------------------------------------------------------------- */

.expediente {
    width: 100%;
    max-width: 100%;
    margin: 2rem auto;
    padding: 1.25rem 1.25rem 1.5rem;
    background: #e7e0cb;
    color: #2b2620;
    border: 1px solid #b9ae8f;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    font-family: "Courier New", Courier, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: left;
    box-sizing: border-box;
}

.expediente-header {
    text-align: center;
    margin-bottom: 0.875rem;
}

.expediente-header p {
    margin: 0 0 0.375rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.expediente-reservado {
    display: inline-block;
    margin-top: 0.5rem !important;
    padding: 0.2rem 0.6rem;
    border: 2px solid #7a1f22;
    color: #7a1f22;
    letter-spacing: 0.08em;
    transform: rotate(-2deg);
    font-size: 0.6875rem !important;
}

.expediente hr {
    border: none;
    border-top: 1px dashed #a89c7a;
    margin: 0.875rem 0 1rem;
}

.expediente p {
    margin: 0 0 0.4rem;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
    text-align: left;
}

.expediente p:last-child { margin-bottom: 0; }

.expediente strong {
    font-weight: 700;
    color: #1b1712;
}

/* Same fix as styles.css: the story's drop-cap rule matches any <p> that
   is first-of-type within its own parent, which reaches into the
   dossier's nested paragraphs. Reset it there only. */
.expediente p::first-letter,
.expediente-header p::first-letter {
    font-size: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    color: inherit !important;
    float: none !important;
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ---------------------------------------------------------------------- */
/* Scroll-reveal — transition only on the revealed state, never on hidden */
/* ---------------------------------------------------------------------- */

.reveal { opacity: 0; transform: translateY(14px); }

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .8s var(--ease), transform .8s var(--ease);
}

/* ---------------------------------------------------------------------- */
/* Site footer                                                            */
/* ---------------------------------------------------------------------- */

.site-footer {
    width: 100%;
    margin-top: var(--sp-section);
    padding: 2.25rem var(--sp-gutter) 2rem;
    text-align: center;
    border-top: 1px solid var(--line);
}

.site-footer img {
    width: 1.75rem;
    margin: 0 auto 0.75rem;
    opacity: 0.7;
    filter: grayscale(0.4) sepia(0.15);
}

.site-footer p {
    margin: 0.2rem 0;
    font-family: var(--f-ui);
    font-size: var(--fs-2xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--paper-faint);
}

.site-footer strong { color: var(--paper-dim); }

/* ---------------------------------------------------------------------- */
/* Small phones: tighten gutters slightly, scale never drops below        */
/* comfortable reading size thanks to the clamp() floors above.           */
/* ---------------------------------------------------------------------- */

@media (max-width: 400px) {
    .card-grid { gap: 1.5rem; }
    .story-card.featured { padding-bottom: 1.5rem; }
}
