/* Blog: the index (body.blog-page) and every article (body.blog-article),
   in the homepage's style. The tiles and the takeaways panel style their
   own shadow DOM (components/blog-post-tile.js, components/ai-summary.js).

   After changing this file, bump its ?v= on the English blog pages, then
   run scripts/build-i18n.js for the localized ones. */

body.blog-page,
body.blog-article {
    --ink: #1d1d1f;
    --ink-soft: #424245;
    --muted: #6e6e73;
    --surface: #f5f5f7;
    --line: #e5e5ea;
    --lime: #A4FF00;
    --lime-deep: #4f7d00;

    background: #fff;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Index ---------- */

.blog-page .blog-header {
    max-width: 1168px;
    margin: 0 auto;
    padding: 148px 24px 48px;
    text-align: left;
}

.blog-page .blog-header h1 {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--ink);
    text-wrap: balance;
}

.blog-page .blog-eyebrow {
    display: block;
    margin-bottom: 16px;
    font-size: 1.1875rem;
    font-style: normal;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--lime-deep);
}

.blog-page .blog-header p {
    max-width: 38ch;
    margin: 20px 0 0;
    font-size: clamp(1.1875rem, 1.6vw, 1.5rem);
    line-height: 1.42;
    color: var(--muted);
    text-wrap: pretty;
}

/* Search and topics share one quiet row; topics scroll sideways. */
.blog-page #filter-container {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1168px;
    margin: 0 auto 56px;
    padding: 0 24px;
    box-sizing: border-box;
    overflow: visible !important;
}

.blog-page .search-section {
    flex: 0 0 300px;
    width: auto;
    margin: 0;
    text-align: left;
}

.blog-page .search-field {
    width: 100%;
    max-width: none;
    height: 48px;
    padding: 0 18px 0 46px;
    border: 0;
    border-radius: 999px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 18px center;
    color: var(--ink);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-page .search-field::placeholder {
    color: #8e8e93;
    font-style: normal;
}

.blog-page .search-field:focus {
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 0 2px #8fd400, 0 0 0 6px rgba(164, 255, 0, 0.3);
}

.blog-page .filter-section {
    flex: 1;
    min-width: 0;
    margin: 0;
    text-align: left;
    overflow: visible;
}

.blog-page .filter-label {
    display: none;
}

.blog-page .filter-tags-inline {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
    mask-image: linear-gradient(90deg, #000 90%, transparent);
}

.blog-page .filter-tags-inline::-webkit-scrollbar {
    display: none;
}

.blog-page .filter-tag {
    flex: none;
    padding: 11px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
}

.blog-page .filter-tag:hover {
    background: #ececf0;
    opacity: 1;
}

.blog-page .filter-tag.active {
    border: 0;
    background: var(--ink);
    color: #fff;
    font-weight: 600;
}

/* Grid: the newest post leads full width, the rest in three columns. */
.blog-page .blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 56px 28px;
    justify-items: stretch;
    max-width: 1168px;
    margin: 0 auto 64px;
    padding: 0 24px;
    box-sizing: border-box;
    overflow: visible !important;
}

.blog-page .blog-grid > blog-post-tile:first-child {
    grid-column: 1 / -1;
    margin-bottom: 24px;
}

.blog-page .blog-grid .loading {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
}

.blog-page .load-more-container {
    margin: 0 0 128px;
    text-align: center;
}

.blog-page .load-more-btn {
    height: 52px;
    padding: 0 32px;
    border: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.blog-page .load-more-btn:hover {
    background: #ececf0;
    opacity: 1;
}

@media (max-width: 1000px) {
    .blog-page .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .blog-page .blog-header {
        padding-top: 112px;
    }

    .blog-page #filter-container {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 40px;
    }

    .blog-page .search-section {
        flex: none;
    }

    .blog-page .blog-grid {
        grid-template-columns: 1fr;
        gap: 44px;
    }
}

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

.blog-article .blog-post-full {
    max-width: 720px;
    margin: 0 auto;
    padding: 148px 24px 24px;
    background: none;
    box-sizing: border-box;
}

.blog-article .blog-post-header {
    margin: 0 0 44px;
    padding: 0;
    text-align: left;
}

.blog-article .blog-post-header h1 {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: clamp(2.375rem, 5.4vw, 3.875rem);
    line-height: 1.04;
    letter-spacing: -0.028em;
    color: var(--ink);
    text-wrap: balance;
}

.blog-article .blog-post-meta {
    margin-top: 20px;
    font-size: 1rem;
    color: var(--muted);
    text-align: left;
}

.blog-article .blog-post-meta time {
    color: var(--muted);
}

/* The cover breaks out wider than the text column. */
.blog-article .blog-post-featured-image {
    display: block;
    width: min(1080px, calc(100vw - 48px));
    max-width: none;
    height: auto;
    margin: 0 0 56px 50%;
    transform: translateX(-50%);
    border-radius: 28px;
}

.blog-article .blog-post-content-full {
    max-width: none;
    padding: 0;
    background: none;
    font-size: 1.1875rem;
    line-height: 1.68;
    color: var(--ink-soft);
}

.blog-article .blog-post-content-full p {
    margin: 0 0 1.35em;
    font-size: inherit;
    line-height: inherit;
    color: var(--ink-soft);
}

.blog-article .blog-post-content-full h2 {
    margin: 2.3em 0 0.6em;
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: clamp(1.75rem, 3.2vw, 2.375rem);
    line-height: 1.1;
    letter-spacing: -0.022em;
    color: var(--ink);
    text-wrap: balance;
}

.blog-article .blog-post-content-full h3 {
    margin: 1.9em 0 0.5em;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.blog-article .blog-post-content-full h4 {
    margin: 1.6em 0 0.4em;
    font-size: 1.1875rem;
    font-weight: 700;
    color: var(--ink);
}

/* Lists draw their own markers, centred on the first line (line-height
   1.68): a dot, a numbered circle, or for <li class="yes"> / <li class="no">
   a check or a cross. */
.blog-article .blog-post-content-full ul,
.blog-article .blog-post-content-full ol {
    margin: 0 0 1.6em;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.blog-article .blog-post-content-full li {
    position: relative;
    margin: 0 0 0.6em;
    padding-left: 1.5em;
    font-size: inherit;
    line-height: inherit;
    color: var(--ink-soft);
}

.blog-article .blog-post-content-full li > ul,
.blog-article .blog-post-content-full li > ol {
    margin: 0.6em 0 0;
}

.blog-article .blog-post-content-full ul > li::before {
    content: "";
    position: absolute;
    left: 0.3em;
    top: 0.66em;
    width: 0.36em;
    height: 0.36em;
    border-radius: 50%;
    background: var(--lime-deep);
}

.blog-article .blog-post-content-full ol > li {
    padding-left: 2.1em;
    counter-increment: step;
}

.blog-article .blog-post-content-full ol > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.325em;
    width: 1.75em;
    height: 1.75em;
    border-radius: 50%;
    background: var(--surface);
    font-size: 0.7em;
    font-weight: 700;
    line-height: 1.75em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.blog-article .blog-post-content-full li.yes,
.blog-article .blog-post-content-full li.no {
    padding-left: 2.05em;
}

.blog-article .blog-post-content-full li.yes::before,
.blog-article .blog-post-content-full li.no::before {
    left: 0;
    top: 0.24em;
    width: 1.2em;
    height: 1.2em;
    background: var(--lime) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d1d1f' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.2 12.4l3.2 3.2 6.4-6.6'/%3E%3C/svg%3E") center / 100% no-repeat;
}

.blog-article .blog-post-content-full li.no::before {
    background-color: #ffe5e3;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d70015' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M8.6 8.6l6.8 6.8M15.4 8.6l-6.8 6.8'/%3E%3C/svg%3E");
}

.blog-article .blog-post-content-full strong {
    color: var(--ink);
}

.blog-article .blog-post-content-full a {
    color: var(--ink);
    text-decoration-color: var(--lime);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.blog-article .blog-post-content-full table {
    width: 100%;
    margin: 0 0 1.8em;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--line);
    font-size: 1rem;
}

.blog-article .blog-post-content-full th {
    padding: 12px 16px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.blog-article .blog-post-content-full td {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
}

.blog-article .blog-post-content-full .source-link {
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Related articles, set like the index tiles. */
.blog-article related-posts {
    display: block;
    margin-top: 96px;
}

.blog-article .related-posts-container {
    margin: 0;
    padding: 0;
    background: none;
}

.blog-article .related-posts-heading {
    margin: 0 0 28px;
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: clamp(1.75rem, 3.2vw, 2.25rem);
    line-height: 1.1;
    letter-spacing: -0.022em;
    color: var(--ink);
    text-align: left;
}

.blog-article .related-posts-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.blog-article .related-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--ink);
    text-decoration: none;
}

.blog-article .related-card:hover {
    transform: none;
    box-shadow: none;
}

/* Covers are shown whole (they have their headline drawn in); a blurred
   copy fills the frame around 16:9 ones. */
.blog-article .related-card-image {
    position: relative;
    aspect-ratio: 3 / 2;
    height: auto;
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
}

.blog-article .related-card-image img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.blog-article .related-card-image .related-card-backdrop {
    position: absolute;
    inset: 0;
    object-fit: cover;
    filter: blur(20px) saturate(1.15);
    transform: scale(1.2);
}

.blog-article .related-card:hover .related-card-image img:not(.related-card-backdrop) {
    transform: scale(1.04);
}

.blog-article .related-card-title {
    margin: 0;
    padding: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    text-align: left;
}

@media (max-width: 700px) {
    .blog-article .blog-post-full {
        padding-top: 112px;
    }

    /* Full column width; viewport units are unreliable under nav.js's phone zoom. */
    .blog-article .blog-post-featured-image {
        width: 100%;
        margin: 0 0 44px;
        transform: none;
        border-radius: 22px;
    }

    .blog-article .blog-post-content-full {
        font-size: 1.125rem;
    }

    .blog-article .related-posts-cards {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}
