/*
 * The look of a blog entry's text when it was written with format in the panel (posts_latd/blog_text.py),
 * and of the title of each part. Loaded by the page of the entry and by the form of the panel, so what is
 * written looks the same in both.
 *
 * .blog-text            a block's text: paragraphs, subtitles, lists; with the marks data-size and data-align
 * .blog-title           the title of a part, with data-size / data-weight / data-align / data-line
 * .blog-article         the page (and the preview of the panel): there the colours of the site apply
 *
 * A text written before the editor existed is plain and keeps the classes of its own template: nothing here touches it.
 */

/* ---------- Structure: the same in the page and in the editor ---------- */
.blog-text p { margin: 0 0 1.25rem; }
.blog-text p:last-child, .blog-text ul:last-child, .blog-text ol:last-child { margin-bottom: 1.25rem; }
.blog-text [data-size="big"] { font-size: 1.25rem; line-height: 2rem; }
.blog-text [data-size="note"] { font-size: 0.875rem; line-height: 1.5rem; }
.blog-text [data-align="center"] { text-align: center; }
.blog-text [data-align="right"] { text-align: right; }
.blog-text [data-align="justify"] { text-align: justify; }
.blog-text strong, .blog-text b { font-weight: 700; }
.blog-text em, .blog-text i { font-style: italic; }
.blog-text ul, .blog-text ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.blog-text ul { list-style: disc; }
.blog-text ol { list-style: decimal; }
.blog-text li { margin: 0.25rem 0; padding-left: 0.25rem; }
.blog-text h3 { margin: 1.75rem 0 0.5rem; font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; scroll-margin-top: 9rem; }
.blog-text h3:first-child { margin-top: 0; }
.blog-text a { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

/* ---------- Colours of the site: the page of the entry and the preview of the panel ---------- */
.blog-article .blog-text strong, .blog-article .blog-text b, .blog-article .blog-text h3 { color: #111827; }
.blog-article .blog-text [data-size="note"] { color: #6b7280; }
.blog-article .blog-text a { color: var(--color-primary-50, #0c5678); }
.blog-article .blog-text a:hover { text-decoration-thickness: 2px; }
.blog-article .blog-text a:focus-visible { outline: 2px solid var(--color-primary-50, #0c5678); outline-offset: 2px; border-radius: 2px; }
.blog-article .blog-text li::marker { color: #6b7280; }
/* As before the editor: the text that opens the entry reads a little larger, and the one that closes it, heavier. */
.blog-article .blog-text[data-block="introduction"][data-opening] p:not([data-size]) { font-size: 1.25rem; line-height: 2rem; color: #1f2937; }
.blog-article .blog-text[data-block="conclusion"] p { font-weight: 500; color: #111827; }

/* ---------- The title of each part ---------- */
.blog-title[data-size="medium"] { font-size: 1.3rem; line-height: 1.75rem; }
.blog-title[data-weight="normal"] { font-weight: 500; }
.blog-title[data-align="center"] { text-align: center; }
.blog-title[data-align="right"] { text-align: right; }
.blog-title[data-line]::after { content: ""; display: block; width: 3.5rem; height: 3px; margin-top: 0.5rem; border-radius: 2px; background: var(--color-primary-50, #0c5678); }
.blog-title[data-line][data-align="center"]::after { margin-left: auto; margin-right: auto; }
.blog-title[data-line][data-align="right"]::after { margin-left: auto; }

/* ---------- The blocks that are not a text (posts_latd/blog_blocks.py) ---------- */
/* A phrase that stands out */
.blog-quote { margin: 2rem 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 4px solid var(--color-primary-50, #0c5678); }
.blog-quote blockquote { margin: 0; font-size: 1.5rem; line-height: 2.1rem; font-weight: 600; color: #111827; text-wrap: balance; }
.blog-quote figcaption { margin-top: 0.5rem; font-size: 0.9375rem; line-height: 1.5rem; color: #4b5563; }
.blog-quote figcaption::before { content: "— "; }

/* A tip, something important, a fact */
.blog-tip { margin: 1.75rem 0; padding: 1rem 1.25rem; border-radius: 0.75rem; border-left: 4px solid var(--color-primary-50, #0c5678); background: #eef4f7; color: #1f2937; }
.blog-tip-label { margin: 0 0 0.25rem; font-size: 0.8125rem; line-height: 1.25rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-primary-50, #0c5678); }
.blog-tip[data-label="important"] { border-left-color: #b45309; background: #fdf3e2; }
.blog-tip[data-label="important"] .blog-tip-label { color: #92400e; }
.blog-tip p { margin: 0 0 0.75rem; }
.blog-tip > p:last-child, .blog-tip .blog-text > :last-child { margin-bottom: 0; }

/* A button */
.blog-cta { margin: 1.75rem 0; }
.blog-cta[data-align="center"] { text-align: center; }
.blog-cta a { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0.5rem 1.5rem; border-radius: 0.5rem; background: var(--color-primary-50, #0c5678); color: #fff; font-size: 1rem; line-height: 1.5rem; font-weight: 700; text-decoration: none; }
.blog-cta a:hover { filter: brightness(1.12); }
.blog-cta a:focus-visible { outline: 3px solid var(--color-primary-50, #0c5678); outline-offset: 3px; }

/* The card of a product */
.blog-product { display: grid; grid-template-columns: 10rem minmax(0, 1fr) auto; align-items: center; gap: 1rem; margin: 1.75rem 0; padding: 0.75rem; border: 1px solid #d1d5db; border-radius: 0.75rem; background: #fff; color: #111827; text-decoration: none; }
.blog-product:hover { border-color: var(--color-primary-50, #0c5678); }
.blog-product:focus-visible { outline: 3px solid var(--color-primary-50, #0c5678); outline-offset: 2px; }
.blog-product-photo { display: block; aspect-ratio: 16 / 11; border-radius: 0.5rem; overflow: hidden; background: #e5e7eb; }
.blog-product-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.blog-product-words { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.blog-product-name { font-size: 1.125rem; line-height: 1.5rem; font-weight: 700; }
.blog-product-days { font-size: 0.9375rem; line-height: 1.5rem; color: #4b5563; }
.blog-product-price { font-size: 0.9375rem; line-height: 1.5rem; color: #374151; }
.blog-product-price strong { font-size: 1.0625rem; color: #111827; }
.blog-product-go { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1rem; border-radius: 0.5rem; background: var(--color-primary-50, #0c5678); color: #fff; font-size: 0.9375rem; font-weight: 700; white-space: nowrap; }
/* Narrow: the photo and the words side by side, the button under them. It follows the width of the column the
   text is in, not that of the screen, so the «Celular» preview of the panel shows what a phone shows. */
.blog-article { container-type: inline-size; }
@container (max-width: 34rem) {
    .blog-product { grid-template-columns: 6.5rem minmax(0, 1fr); }
    .blog-product-go { grid-column: 1 / -1; justify-content: center; }
    .blog-quote blockquote { font-size: 1.3rem; line-height: 1.9rem; }
}
/* For a browser that does not know the rule above. */
@supports not (container-type: inline-size) {
    @media (max-width: 560px) {
        .blog-product { grid-template-columns: 6.5rem minmax(0, 1fr); }
        .blog-product-go { grid-column: 1 / -1; justify-content: center; }
    }
}

/* A table: on a narrow screen it slides sideways inside its own box */
.blog-table { margin: 1.75rem 0; overflow-x: auto; border: 1px solid #d1d5db; border-radius: 0.75rem; }
.blog-table:focus-visible { outline: 3px solid var(--color-primary-50, #0c5678); outline-offset: 2px; }
.blog-table table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.5rem; }
.blog-table th, .blog-table td { padding: 0.625rem 0.875rem; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; min-width: 7rem; color: #1f2937; }
.blog-table th { background: #f3f4f6; font-weight: 700; color: #111827; }
.blog-table tbody tr:last-child td { border-bottom: 0; }

/* In the preview of the panel: what readers will not see */
.blog-skipped { margin: 1.25rem 0; padding: 0.625rem 0.875rem; border: 1px dashed #b45309; border-radius: 0.5rem; background: #fdf3e2; color: #92400e; font-size: 0.875rem; line-height: 1.375rem; font-weight: 600; }

/* ---------- Reading an entry: how much has been read, and the way back up on a phone ---------- */
.blog-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 10000; height: 3px; pointer-events: none; }
.blog-progress span { display: block; width: 0; height: 100%; background: var(--color-primary-50, #0c5678); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.7); }
.blog-top {
    position: fixed; left: 1rem; bottom: 4.5rem; z-index: 40; display: inline-flex; align-items: center; gap: 0.375rem;
    min-height: 2.75rem; padding: 0 0.875rem; border: 1px solid #d1d5db; border-radius: 999px; background: #fff; color: #111827;
    font-size: 0.875rem; font-weight: 700; box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
}
.blog-top[hidden] { display: none; }
.blog-top svg { width: 1rem; height: 1rem; }
.blog-top:focus-visible { outline: 3px solid var(--color-primary-50, #0c5678); outline-offset: 2px; }
/* On a computer the index stays in sight at the side: the button is for the phone. */
@media (min-width: 1024px) { .blog-top { display: none; } }

/* ---------- Photos inside the text ---------- */
.blog-photo { margin: 2rem 0; }
.blog-photo-row { display: grid; gap: 0.5rem; }
.blog-photo[data-count="2"] .blog-photo-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.blog-photo[data-count="3"] .blog-photo-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.blog-photo img { display: block; width: 100%; height: auto; border-radius: 0.75rem; background: #e5e7eb; }
.blog-photo:not([data-count="1"]) img { aspect-ratio: 4 / 3; object-fit: cover; }
.blog-photo[data-width="small"] { max-width: 28rem; margin-left: auto; margin-right: auto; }
.blog-photo figcaption { margin-top: 0.5rem; font-size: 0.9375rem; line-height: 1.5rem; color: #4b5563; text-align: center; }
@container (max-width: 34rem) {
    /* Three in a row are too small on a phone: the first one on top, the other two under it. */
    .blog-photo[data-count="3"] .blog-photo-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .blog-photo[data-count="3"] .blog-photo-row img:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
}

/* ---------- Who wrote the entry ---------- */
.blog-author { display: flex; align-items: center; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; }
.blog-author img { flex-shrink: 0; width: 4rem; height: 4rem; border-radius: 999px; object-fit: cover; background: #e5e7eb; }
.blog-author p { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.blog-author-label { font-size: 0.8125rem; line-height: 1.25rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #4b5563; }
.blog-author-name { font-size: 1.125rem; line-height: 1.625rem; font-weight: 700; color: #111827; }
.blog-author-words { font-size: 0.9375rem; line-height: 1.5rem; color: #374151; }

/* ---------- The three ways an entry is presented (BlogsModels.Layout). «Revista» is everything above. ---------- */
/* Only the sections count: the introduction and the conclusion are not a step nor an item of the list. */
.blog-article[data-layout="guide"], .blog-article[data-layout="list"] { counter-reset: blog-part; }
.blog-article[data-layout="guide"] .blog-title[data-block="section"],
.blog-article[data-layout="list"] .blog-title[data-block="section"] { counter-increment: blog-part; }

/* «Guía paso a paso»: each section is a step, with its number in a circle beside the title. */
.blog-article[data-layout="guide"] .blog-title[data-block="section"] { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: 0.75rem; align-items: start; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; }
.blog-article[data-layout="guide"] .blog-title[data-block="section"]::before {
    content: counter(blog-part); grid-row: 1 / span 2; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 999px;
    background: var(--color-primary-50, #0c5678); color: #fff; font-size: 1.125rem; line-height: 1; font-weight: 700;
}
.blog-article[data-layout="guide"] .blog-title[data-block="section"][data-line]::after { grid-column: 2; }

/* «Lista»: a large number over each section, for «10 lugares que…». */
.blog-article[data-layout="list"] .blog-title[data-block="section"] { padding-top: 1.5rem; border-top: 1px solid #e5e7eb; }
.blog-article[data-layout="list"] .blog-title[data-block="section"]::before {
    content: counter(blog-part, decimal-leading-zero); display: block; margin-bottom: 0.25rem;
    color: var(--color-primary-50, #0c5678); font-size: 2.75rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums;
}

/* ---------- A video or a map inside the text ---------- */
.blog-embed { margin: 2rem 0; }
.blog-embed-frame { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 0.75rem; overflow: hidden; background: #111827; aspect-ratio: 16 / 9; }
.blog-embed[data-provider="map"] .blog-embed-frame { aspect-ratio: 4 / 3; background: #e5e7eb; }
.blog-embed-frame img, .blog-embed-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
button.blog-embed-frame { cursor: pointer; }
button.blog-embed-frame:focus-visible { outline: 3px solid var(--color-primary-50, #0c5678); outline-offset: 3px; }
.blog-embed-play { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 4rem; height: 4rem; margin: -2rem 0 0 -2rem; border-radius: 999px; background: rgb(0 0 0 / 0.65); color: #fff; }
.blog-embed-play svg { width: 2rem; height: 2rem; }
button.blog-embed-frame:hover .blog-embed-play { background: var(--color-primary-50, #0c5678); }
.blog-embed figcaption { margin-top: 0.5rem; font-size: 0.9375rem; line-height: 1.5rem; color: #4b5563; text-align: center; }
