:root {
    --paper: #fdfaf5;
    --ink: #111;
    --ink-muted: #555;
    --rule: #222;
    --rule-light: #ccc;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Lora", Georgia, "Times New Roman", serif;
    margin: 0;
    padding: 0;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ——— Cabecera ——— */
.site-header {
    position: relative;
    background: var(--paper);
    padding: 2rem 1rem 0;
    text-align: center;
}

.masthead-title {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

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

.masthead-title a:hover {
    text-decoration: none;
    opacity: 0.85;
}

.masthead-tagline {
    margin: 0.65rem 0 0;
    font-size: 1rem;
    font-style: italic;
    font-weight: 400;
    color: var(--ink-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-search-input {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid var(--rule-light);
    background: #fff;
    color: var(--ink);
    padding: 0.52rem 0.65rem;
    font-family: inherit;
    font-size: 0.9rem;
}

.site-search-input:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
}

.site-search-disclosure {
    position: absolute;
    top: 0.65rem;
    left: max(1rem, calc((100% - 1200px) / 2));
    z-index: 4;
    text-align: left;
}

.site-search-toggle {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--ink-muted);
    cursor: pointer;
}

.site-search-toggle::-webkit-details-marker {
    display: none;
}

.site-search-toggle:hover {
    color: var(--ink);
    border-color: var(--rule-light);
}

.site-search-toggle:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.site-search-toggle-icon {
    font-size: 3rem;
    line-height: 1;
}

.site-search-panel {
    margin-top: 0.35rem;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.4rem;
    border: 1px solid var(--rule-light);
    background: var(--paper);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.site-search-submit {
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    padding: 0.52rem 0.7rem;
    font-family: inherit;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
}

.site-search-submit:hover {
    opacity: 0.92;
}

.site-nav {
    margin-top: 1.75rem;
}

.site-nav-lines {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 0.65rem 0.5rem;
}

.site-nav-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
}

.site-nav-link {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
    padding: 0.15rem 0;
}

.site-nav-link:hover {
    text-decoration: underline;
}

.site-nav-link.active {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nav-sep {
    color: var(--ink-muted);
    font-size: 0.75rem;
    user-select: none;
}

/* ——— Contenido ——— */
main {
    margin: 0;
    background: var(--paper);
    padding: 2rem 1rem 3rem;
}

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem 2rem;
    align-items: start;
}

.main .main-column {
    min-width: 0;
}

.main .secondary-column {
    min-width: 0;
    padding-left: 0;
    border-left: none;
}

/* Home: feed móvil lineal (oculto en escritorio) */
.main.home .home-mobile-feed {
    display: none;
}

.search-empty-state {
    grid-column: 1 / -1;
    border: 1px dashed var(--rule-light);
    padding: 0.85rem 0.9rem;
    color: var(--ink-muted);
    background: rgba(255, 255, 255, 0.35);
}

/* Home: bloque pleno — móvil: tras el destacado; escritorio: primera tarjeta de la columna derecha */
.home-pleno-spotlight {
    padding: 1rem 1.1rem 1.2rem;
    border: 1px solid var(--rule-light);
    background: rgba(255, 255, 255, 0.55);
}

.home-pleno-spotlight--desktop {
    display: none;
}

.main.home .home-mobile-feed .home-pleno-spotlight--mobile {
    margin: 0 0 1.25rem;
}

.main.home .secondary-column .home-pleno-spotlight--desktop {
    margin: 0 0 1.25rem;
}

@media screen and (min-width: 901px) {
    .home-pleno-spotlight--mobile {
        display: none;
    }

    .home-pleno-spotlight--desktop {
        display: block;
    }
}

.home-pleno-spotlight-title {
    margin: 0;
    font-size: clamp(1.15rem, 2.8vw, 1.45rem);
    font-weight: 700;
    line-height: 1.2;
}

.home-pleno-spotlight-kicker {
    margin: 0.35rem 0 0.85rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.home-pleno-spotlight-headline {
    margin: 0;
    font-size: clamp(1.05rem, 2.4vw, 1.35rem);
    font-weight: 700;
    line-height: 1.25;
}

.home-pleno-spotlight-card .home-pleno-spotlight-lead {
    margin: 0.75rem 0 0;
    font-size: 1.02rem;
}

@media screen and (max-width: 900px) {
    /* el layout responsive de `.main` ya apila sidebar debajo */
}

@media screen and (max-width: 900px) {
    .site-search-disclosure {
        top: 0.45rem;
        left: 1rem;
    }

    .site-search-panel {
        width: min(20rem, calc(100vw - 1.5rem));
    }

    .main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Home: en móvil mostramos sólo el feed lineal para mantener el orden */
    .main.home .home-mobile-feed {
        display: block;
    }

    .main.home > .main-column,
    .main.home > .secondary-column {
        display: none;
    }

    .secondary-column {
        border-top: 1px solid var(--rule-light);
        padding-top: 1.5rem;
    }

    .sidebar-article.has-divider {
        border-top: 1px solid var(--rule-light);
        padding-top: 1.25rem;
        margin-top: 1.25rem;
    }
}

@media screen and (min-width: 901px) {
    .secondary-column {
        border-left: 1px solid var(--rule-light);
        /* El espaciado entre columnas lo marca el `gap` del grid, no el padding */
        padding-left: 0;
    }
}

/* Destacado y listados */
.new {
    padding: 0;
    max-width: none;
}

.featured-article {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule-light);
}

.featured-article h2 {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
}

.featured-article .lead {
    margin: 0.85rem 0 0;
    font-size: 1.05rem;
}

.new-metadata {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sub-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
}

@media screen and (max-width: 700px) {
    .sub-columns {
        grid-template-columns: 1fr;
    }
}

.sub-article {
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top: 1px solid var(--rule-light);
}

.sub-article:first-child {
    padding-top: 0;
    border-top: none;
}

.sub-column .sub-article:first-child {
    padding-top: 0;
    border-top: none;
}

/* En el listado móvil, el primer item no debería llevar separador */
.main.home .home-mobile-list .sub-article:first-child {
    padding-top: 0;
    border-top: none;
}

.sub-article h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.25;
}

.sub-article p:not(.new-metadata) {
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
}

.sidebar-article h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.sidebar-article p:not(.new-metadata) {
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
}

.sidebar-article.has-divider {
    border-top: 1px solid var(--rule-light);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.new-summary h2 a:hover,
.new-summary h3 a:hover {
    text-decoration: underline;
}

.new-summary p a {
    color: var(--ink);
}

.search-snippet mark {
    background: #fff3a0;
    color: var(--ink);
}

/* Contexto de impacto en tarjetas de listado (home / categoría) */
.list-card-context {
    margin: 0.4rem 0 0.35rem;
}

.list-card-context-deadline {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
}

.list-card-context-preview {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--ink-muted);
}

.sidebar-article .list-card-context-preview,
.sidebar-article .list-card-context-deadline {
    font-size: 0.8rem;
}

.sidebar-article .list-card-context-chips .article-chip {
    font-size: 0.68rem;
}

/* Páginas legales: una columna estrecha */
.main.legal-page {
    grid-template-columns: 1fr;
    max-width: 48rem;
}

.main.legal-page .main-column {
    max-width: none;
}

/* Ficha de artículo: mismo grid 2fr / 1fr que la home en escritorio */
.main.article-page {
    max-width: 1200px;
    grid-template-columns: 1fr;
    /* Menos hueco vertical que la home: el título ya no lleva metadatos debajo */
    gap: 1rem 3rem;
}

@media screen and (max-width: 900px) {
    .main.article-page .article-page-sidebar.secondary-column {
        border-top: 1px solid var(--rule-light);
        padding-top: 1.25rem;
        margin-top: 0;
    }
}

@media screen and (min-width: 901px) {
    .main.article-page {
        grid-template-columns: 2fr 1fr;
    }

    .main.article-page .article-page-grid-title {
        grid-column: 1;
        grid-row: 1;
    }

    .main.article-page .article-page-sidebar {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: start;
        position: sticky;
        top: 1rem;
    }

    .main.article-page .article-page-main {
        grid-column: 1;
        grid-row: 2;
        min-width: 0;
    }
}

.main.article-page .article-page-main {
    min-width: 0;
}

.article-title {
    margin: 0;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    line-height: 1.2;
}

.article-page .article-page-main .article-body {
    margin-top: 0;
}

.article-page .article-body > :first-child {
    margin-top: 0;
}

@media screen and (max-width: 900px) {
    .article-page .article-page-main .article-body {
        margin-top: 0.35rem;
    }
}

.article-impact-details {
    border: 1px solid var(--rule-light);
    background: rgba(255, 255, 255, 0.45);
}

.article-impact-summary {
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.article-impact-summary::-webkit-details-marker {
    display: none;
}

.article-impact-inner {
    padding: 0 0.85rem 0.85rem;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ink);
}

@media screen and (min-width: 901px) {
    .article-impact-details {
        border: none;
        background: transparent;
    }

    .article-impact-summary {
        display: none;
    }

    .article-impact-inner {
        padding: 0;
    }
}

.article-impact-publine {
    margin: 0 0 0.65rem;
}

.article-impact-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.85rem;
}

.list-card-context .article-impact-chips {
    margin-bottom: 0.35rem;
}

.article-chip {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--rule-light);
    color: var(--ink-muted);
}

.article-chip:hover {
    text-decoration: none;
    border-color: var(--ink);
    color: var(--ink);
}

.article-chip:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.article-chip--stage {
    border-color: var(--ink);
    color: var(--ink);
}

.article-impact-row {
    margin-top: 0.75rem;
}

.article-impact-row:first-of-type {
    margin-top: 0;
}

.article-impact-label {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}

.article-impact-value {
    margin: 0;
    white-space: pre-wrap;
}

.article-body :is(p, ul, ol, blockquote) {
    margin: 0.85rem 0;
}

.article-body h1,
.article-body h2,
.article-body h3 {
    margin: 1.25rem 0 0.5rem;
    line-height: 1.25;
}

.article-related-pleno {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule-light);
}

.article-related-pleno-title {
    margin: 0 0 0.85rem;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.25;
}

.article-related-pleno-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-related-pleno-item {
    margin: 0 0 1rem;
}

.article-related-pleno-item:last-child {
    margin-bottom: 0;
}

.article-related-pleno-link {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-related-pleno-meta {
    margin: 0.35rem 0 0;
}

.article-original {
    display: inline-block;
    margin-top: 2rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--ink);
    padding-bottom: 2px;
}

.article-original:hover {
    text-decoration: none;
    opacity: 0.8;
}

.legal-page h1 {
    font-size: 1.75rem;
    margin: 0 0 1rem;
}

.legal-page h2 {
    font-size: 1.2rem;
    margin: 1.75rem 0 0.5rem;
}

.legal-page ul {
    padding-left: 1.25rem;
}

/* Cookie banner */
#cookie-banner {
    position: fixed;
    bottom: 12px;
    left: 12px;
    right: 12px;
    max-width: 520px;
    margin: 0 auto;
    background: var(--ink);
    color: var(--paper);
    padding: 14px 16px;
    text-align: center;
    display: none;
    border: 1px solid var(--rule-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    font-size: 0.9rem;
    line-height: 1.45;
}

#cookie-banner a {
    color: var(--paper);
    text-decoration: underline;
}

#cookie-banner a:hover {
    opacity: 0.9;
}

#cookie-banner button {
    cursor: pointer;
    margin: 8px 6px 0;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--paper);
    background: transparent;
    color: var(--paper);
}

#cookie-banner button.accept {
    background: var(--paper);
    color: var(--ink);
}

#cookie-banner button:hover {
    opacity: 0.92;
}
