/* Subject-shaped editorial illustrations share the surrounding paper and text column. */
.editorial-cutout, .article-body figure.editorial-cutout {
    position: relative;
    float: right;
    width: min(42%, 20rem);
    clear: right;
    margin: .65rem 0 .9rem 1rem !important;
    shape-outside: var(--measured-cutout, var(--cutout-shape)) border-box;
    shape-margin: 1rem;
}
.editorial-cutout picture, .editorial-cutout img, .article-body .editorial-cutout picture img {
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    background: none;
    mask: none;
    filter: none;
}
/* 30/11/2026 (pedido do dono): as ilustrações do time de artigos não levam mais a fita de papel.
   O desenho fica solto no papel; editorial-cutouts.js já não reserva lugar para a fita quando ela não existe. */
.editorial-cutout::before, .paper-card-subject::before { content: none; }
.cutout-caption, .article-body figure .cutout-caption {
    position: absolute;
    bottom: 0;
    right: 0;
    margin: 0 !important;
    z-index: 4;
    font: 500 .85rem/1.45 var(--cy-sans);
    color: var(--cy-ink) !important;
}
.cutout-caption summary {
    display: grid;
    place-items: center;
    min-width: 32px;
    min-height: 32px;
    cursor: pointer;
    list-style: none;
}
.cutout-caption summary::-webkit-details-marker { display: none; }
.cutout-caption summary .cutout-badge {
    display: grid; place-items: center; width: 1.25rem; height: 1.25rem;
    border: 1px solid #584535; border-radius: 50%; background: #f7e9ca;
    color: #34271e; font: italic bold .88rem/1 Georgia, serif;
}
.cutout-caption summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.cutout-note {
    width: 100%; padding: .85rem 1rem;
    text-align: left; overflow-wrap: anywhere; color: #33271e; background: #fff5e3;
    border: 1px solid #bda98d; box-shadow: 0 .25rem .75rem #38271e29; z-index: 5;
}
.cutout-note p, .article-body .cutout-note p { margin: 0 0 .4em !important; font: inherit !important; color: inherit; }
.cutout-note p:last-child { margin-bottom: 0 !important; }
.cutout-note a { color: inherit; text-decoration: underline; }
.cutout-caption:has(details[open]), .article-body figure .cutout-caption:has(details[open]) { position: static; }
.cutout-caption details[open] summary { width: fit-content; margin-left: auto; }
.editorial-cutout:has(details[open]) { shape-outside: margin-box; }
@media (max-width: 599px) {
    .editorial-cutout.cutout-lead:has(details[open]) {
        float: none; width: min(100%, 24rem); margin-inline: auto !important;
    }
}
#pageArticle .article-header.has-cutout { display: block !important; max-width: 62rem; margin-inline: auto; }
#pageArticle .article-header.has-cutout::before { content: none; }
#pageArticle .article-header.has-cutout > .pp-card, .hero.has-cutout .pp-card { display: flow-root; }
#pageArticle .article-header.has-cutout .article-actions-top { margin: 1.4rem 0 0; }
.has-cutout .cutout-lead { width: min(38%, 28rem); }
/* Clipping the deck establishes a formatting context that reserves the float's entire column. */
.hero.has-cutout .pp-card > p {
    display: block;
    overflow: visible;
    max-width: none;
    -webkit-line-clamp: unset;
    text-wrap: wrap;
}
.article-body figure.cutout-inline {
    margin: 1.1rem 0 1.1rem 1.2rem !important;
    shape-margin: 1rem;
}
/* A heading immediately after a cutout belongs to the text wrapping around it. */
.article-body:has(.cutout-inline) > :is(h2, h3):not(.cutout-inline + *) { clear: right; }
.article-body > .cutout-inline + :is(h2, h3) { margin-top: 0 !important; overflow-wrap: anywhere; }
.article-body figure.cutout-scene { width: min(51%, 26rem); }
.has-cutout .cutout-lead.cutout-scene { width: min(45%, 28rem); }
.hero.paper.has-cutout { min-height: 0 !important; }
.hero.has-cutout .hero-copy { width: min(100%, 68rem) !important; margin-inline: auto; }
.hero.has-cutout .pp-card { margin-left: 0; }
.article-body:has(.cutout-inline)::after { content: ""; display: block; clear: both; }
@media (max-width: 899px) {
    #pageArticle .article-header.has-cutout { padding: 0; }
    #pageArticle .article-header.has-cutout > .pp-card { margin: 0; padding: 1.4rem 1rem 1rem; }
    #pageArticle .article-header.has-cutout h1 { margin-top: 0 !important; }
    .hero.paper.has-cutout { display: flex !important; }
    .has-cutout .cutout-lead { width: clamp(94px, 36%, 15rem); }
    .has-cutout .cutout-lead.cutout-scene { width: clamp(108px, 41%, 17rem); }
    .cutout-lead { margin-left: .75rem !important; shape-margin: .65rem; }
}
@media (max-width: 599px) {
    .editorial-cutout { shape-outside: var(--measured-cutout, var(--cutout-small-shape)) border-box; }
    /* Keep a readable measure beside the silhouette even on the narrowest phones. */
    .article-body figure.cutout-inline {
        width: min(40%, max(24%, calc(100% - 10.5rem)), 14rem);
        margin: .3rem 0 .8rem .65rem !important;
        shape-margin: .6rem;
    }
    .article-body figure.cutout-inline:has(details[open]) {
        float: none;
        width: min(100%, 20rem);
        margin: 1rem auto !important;
    }
}

/* List cards keep the original subject and the same attachment point as the article. */
.paper-card-art:has(> .paper-card-subject) {
    display: grid;
    place-items: center;
    filter: none;
}
.paper-card-art:has(> .paper-card-subject)::before,
#discoverResultArt.paper-card-art:has(> .paper-card-subject)::before,
.niche-page .niche-feature .paper-card-art:has(> .paper-card-subject)::before { content: none; }
.paper-card-subject { position: relative; display: inline-block; max-width: 94%; }
.paper-card-subject > .paper-card-cover { display: block; width: auto; height: auto; max-width: 100%; max-height: clamp(9rem, 27vw, 20rem); mask: none; }

/* In article lists the cover sets the row height, including while the image is loading. */
.article-art.paper-card-art:has(> .paper-card-subject) {
    aspect-ratio: auto;
    grid-template-columns: minmax(0, 1fr);
}
.article-art > .paper-card-subject {
    width: min(96%, calc(24rem * var(--cover-ratio, 16 / 9)));
    max-width: none;
}
.article-art > .paper-card-subject > .paper-card-cover {
    width: 100%;
    max-height: none;
    aspect-ratio: auto var(--cover-ratio, 16 / 9);
}
.article-art:has(> .paper-card-subject) + .card-body {
    padding-block-start: clamp(.625rem, 1vw, .875rem) !important;
}
/* The save control sits above the linked artwork and has its own tap target. */
.article:has(> .card-actions) > a > .article-art:has(> .paper-card-subject) {
    padding-block-start: 3.5rem;
}

.cutout-sr-label {
    position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}
#pageArticle .has-cutout h1, .hero.has-cutout h1 { text-wrap: wrap !important; }
@media (max-width: 600px) {
    #pageArticle .article-header.has-cutout .article-actions-top {
        display: grid !important; grid-template-columns: minmax(max-content, .72fr) minmax(max-content, 1fr) minmax(max-content, 1.45fr);
        gap: clamp(8px, 2.6vw, 14px) !important;
    }
    #pageArticle .article-header.has-cutout .article-actions-top .article-action-btn {
        min-width: 0; width: 100%; padding-inline: 3px !important; gap: .3em;
        font-size: clamp(13px, 3.8vw, 16px) !important;
    }
}

.cutout-callout-paragraph { position: relative; }
.cutout-callout-term {
    text-decoration: underline;
    text-decoration-color: var(--cy-wine);
    text-underline-offset: .16em;
}
.cutout-callout {
    position: absolute; top: 0; left: 0; width: 1px; height: 1px;
    overflow: visible; pointer-events: none;
    fill: none; stroke: var(--cy-wine); stroke-width: 1.65;
    stroke-linecap: round; stroke-linejoin: round;
}
body.dark .cutout-callout { stroke: var(--cy-rose); }
body.dark .cutout-callout-term { text-decoration-color: var(--cy-rose); }
.cutout-callout-expanded .cutout-callout { display: none; }
.cutout-callout-expanded .cutout-callout-term { text-decoration: none; }

.cutout-callout-outline { stroke: var(--cy-card); stroke-width: 3.5; }
.cutout-callout-source { display: none; }
/* Keep the image and its text connector aligned while the article reveals figures on scroll. */
.article-body figure.cutout-inline:has(> .cutout-callout-source) { translate: none; transition-property: opacity; }

/* ===== D09 — CAPAS ENQUADRADAS: o cartão abraça o desenho, não a tela transparente em volta =====
   The page sets --frame-l/t/w/h (share of the canvas that is drawn) and --cover-ratio (shape of the drawn part).
   The image is laid out larger than the frame and shifted, so only the drawing fills the card; the transparent
   rest overflows invisibly and never takes space. */
.paper-card-subject.is-framed {
    --frame-max-h: 17rem;
    display: block;
    width: min(96%, calc(var(--frame-max-h) * var(--cover-ratio)));
    max-width: none;
    max-height: none;
    height: auto;
    aspect-ratio: var(--cover-ratio);
}
.paper-card-subject.is-framed::before { z-index: 1; }
.paper-card-subject.is-framed > .paper-card-cover {
    position: absolute;
    top: calc(var(--frame-t) / var(--frame-h) * -100%);
    left: calc(var(--frame-l) / var(--frame-w) * -100%);
    width: calc(100% / var(--frame-w));
    height: calc(100% / var(--frame-h));
    max-width: none;
    max-height: none;
    min-height: 0;
    aspect-ratio: auto;
    object-fit: fill;
    mask: none;
    pointer-events: none;
}
/* Descobrir: the square box gives way to the drawing's own shape. */
#discoverResultArt.paper-card-art:has(> .paper-card-subject.is-framed) {
    aspect-ratio: auto !important;
    min-height: 0;
    padding-block: clamp(.75rem, 2.4vw, 1.5rem);
}
#discoverResultArt > .paper-card-subject.is-framed { --frame-max-h: 20rem; }
/* Nicho (destaque) and Início (minileituras) use the same frame inside their own boxes. */
.niche-feature .feature-art:has(> .paper-card-subject.is-framed) { aspect-ratio: auto !important; height: auto; }
.mini-visual .paper-card-subject.is-framed {
    --frame-max-h: clamp(106px, 17vw, 138px);
    width: min(100%, calc(var(--frame-max-h) * var(--cover-ratio)));
}
/* ===== FIM D09 CAPAS ENQUADRADAS ===== */

/* ===== D12 — FEED: PAPEL NA COR DO NICHO ATRÁS DA IMAGEM =====
   Só no feed do Início (#feed), nos dois sites. A cor vem do data-button-tone do artigo (a cor do nicho),
   com o mesmo papel rasgado do cartão da minileitura. Sem cor conhecida: papel creme.
   O papel fica atrás do desenho e o botão Salvar fica preso por cima da borda de cima. */
#feed .article { --feed-paper: url(/images/papel/rasgo-creme.webp); --feed-paper-slice: 96; }
#feed .article[data-button-tone="#b58263" i] { --feed-paper: url(/images/papel/cartao-nicho-b58263.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#59677a" i] { --feed-paper: url(/images/papel/cartao-nicho-59677a.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#879083" i] { --feed-paper: url(/images/papel/cartao-nicho-879083.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#75677a" i] { --feed-paper: url(/images/papel/cartao-nicho-75677a.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#b79a5a" i] { --feed-paper: url(/images/papel/cartao-nicho-b79a5a.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#a96860" i] { --feed-paper: url(/images/papel/cartao-nicho-a96860.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#6c8a8d" i] { --feed-paper: url(/images/papel/cartao-nicho-6c8a8d.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#3e7d32" i] { --feed-paper: url(/images/papel/cartao-nicho-3e7d32.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#e8a9bc" i] { --feed-paper: url(/images/papel/cartao-nicho-e8a9bc.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#4f5fc7" i] { --feed-paper: url(/images/papel/cartao-nicho-4f5fc7.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#5e9c8f" i] { --feed-paper: url(/images/papel/cartao-nicho-5e9c8f.webp); --feed-paper-slice: 64; }
#feed .article[data-button-tone="#7a5aa6" i] { --feed-paper: url(/images/papel/cartao-nicho-7a5aa6.webp); --feed-paper-slice: 64; }
#feed .article .article-art.paper-card-art:has(> .paper-card-subject) {
    padding: 3.5rem clamp(.95rem, 4.2vw, 1.4rem) clamp(1.05rem, 4vw, 1.45rem);
}
#feed .article .article-art.paper-card-art:has(> .paper-card-subject)::before {
    content: "";
    position: absolute;
    inset: 1.75rem 0 0;
    z-index: 0;
    width: auto;
    height: auto;
    border: 0 solid transparent;
    border-radius: 0;
    border-image: var(--feed-paper) var(--feed-paper-slice) fill / 32px / 6px round;
    background: none;
    mask: none;
    transform: none;
    opacity: 1;
    filter: drop-shadow(0 10px 14px rgba(60, 30, 15, .22));
    pointer-events: none;
}
#feed .article .article-art > .paper-card-subject { z-index: 1; width: min(100%, calc(var(--frame-max-h, 17rem) * var(--cover-ratio, 16 / 9))); }
@media print { #feed .article .article-art.paper-card-art::before { content: none; } }
/* ===== FIM D12 ===== */

/* =========================================================
   H5 — FEED NO ALTO (29/11/2026)
   O feed do Início subiu para logo depois das minileituras; "Explore por nicho" desceu para depois dele.
   Em cima do feed: uma fileira de botões dos nichos que têm artigo ali (filtram sem sair da página).
   Em cada cartão: curtir e compartilhar, na linha do "Cutyssey Editorial · data". O Salvar continua na imagem.
   No celular, "Não sabe o que ler?" vira uma faixa curta (a pergunta e o botão).
   ========================================================= */
#feed .article[hidden] { display: none !important; }

.feed-niches {
    display: flex; align-items: center; gap: .55rem;
    max-width: 100%; margin: 0 0 1.25rem; padding: .25rem .15rem .55rem;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.feed-niches::-webkit-scrollbar { display: none; }
/* As cores vêm do mesmo sistema dos botões de papel (--cy-act-*): creme parado, cor forte do nicho quando ligado. */
.feed-niches .feed-niche {
    all: unset; box-sizing: border-box; flex: 0 0 auto;
    display: inline-flex !important; align-items: center; gap: .45rem;
    min-height: 44px; padding: .3rem .95rem; white-space: nowrap; cursor: pointer; scroll-snap-align: start;
    --cy-act-face: var(--cy-paper-face); --cy-act-ink: var(--cy-paper-ink); --cy-act-slice: 10px; --cy-act-outset: 0;
    border: 0 solid transparent;
    border-image: var(--cy-act-face) 48 fill / var(--cy-act-slice) / var(--cy-act-outset) stretch;
    color: var(--cy-act-ink); font: 600 .9375rem/1.2 var(--cy-sans); text-decoration: none;
    transition: scale .3s var(--cy-spring);
    -webkit-tap-highlight-color: transparent;
}
.feed-niches .feed-niche > i {
    flex: none; width: .7rem; height: .7rem; border-radius: 50%;
    background: var(--niche-real-color, #b58263); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14);
}
.feed-niches .feed-niche:active { scale: .94; }
.feed-niches .feed-niche.is-on {
    --cy-act-face: var(--cy-topic-primary, url("/images/papel/control-paper-dark-v3.webp"));
    --cy-act-ink: var(--cy-primary-ink, #f8eddf);
    font-weight: 700; text-decoration: underline; text-underline-offset: .17em;
}
:where(body.dark, html.is-dark) .feed-niches .feed-niche.is-on:not([data-button-tone]) {
    --cy-act-face: url("/images/papel/control-paper-light-v3.webp"); --cy-act-ink: #261e18;
}
.feed-niches .feed-niche.is-on > i { box-shadow: 0 0 0 2px rgba(255, 249, 239, .8); }
.feed-niches .feed-niche-more { --cy-act-face: none; border-image: none; padding-inline: .5rem .25rem; color: var(--cy-muted); }
.feed-niches .feed-niche-more .cy-ic { width: 1em; height: 1em; }

#feed .article .publisher {
    display: flex; flex-wrap: wrap; align-items: center; column-gap: .35em;
    min-height: 44px; padding-inline-end: 7.2rem;
}
#feed .article .card-social {
    position: relative; z-index: 2;
    display: flex; justify-content: flex-end; align-items: center; gap: .45rem;
    min-height: 44px; margin: -44px 0 0; pointer-events: none;
}
#feed .article .card-social form { display: contents; }
#feed .article .card-social .card-social-btn {
    all: unset; box-sizing: border-box; position: relative; pointer-events: auto;
    display: inline-flex !important; align-items: center; justify-content: center; gap: .3rem;
    min-width: 44px; min-height: 44px; padding: 0 .6rem; cursor: pointer;
    --cy-act-face: var(--cy-topic-secondary, var(--cy-paper-face)); --cy-act-ink: var(--cy-secondary-ink, var(--cy-paper-ink));
    --cy-act-slice: 10px; --cy-act-outset: 0;
    border: 0 solid transparent;
    border-image: var(--cy-act-face) 48 fill / var(--cy-act-slice) / var(--cy-act-outset) stretch;
    color: var(--cy-act-ink); font: 700 .8125rem/1 var(--cy-sans); text-decoration: none;
    transition: scale .3s var(--cy-spring);
    -webkit-tap-highlight-color: transparent;
}
#feed .article .card-social .card-social-btn > .cy-ic { flex: none; width: 1.3rem; height: 1.3rem; filter: drop-shadow(0 0 1px #fff1df); }
#feed .article .card-social .card-social-btn:active { scale: .88; }
#feed .article .card-social .card-social-btn.active {
    --cy-act-face: var(--cy-topic-primary, var(--cy-paper-face)); --cy-act-ink: var(--cy-primary-ink, var(--cy-paper-ink));
    color: var(--cy-act-ink) !important;
}
#feed .article .card-social .article-like-count[hidden] { display: none; }
#feed .article .card-social .card-social-label {
    position: absolute; right: 0; top: calc(100% + 2px); z-index: 4;
    padding: .35rem .65rem; border-radius: 6px; white-space: nowrap;
    background: var(--cy-ink); color: #fbf3e9; font: 600 .75rem/1.2 var(--cy-sans);
}
#feed .article .card-social .card-social-label:empty { display: none; }

@media (max-width: 650px) {
    #feed > .section-title { margin-bottom: 12px !important; }
    #feed > .section-title p { display: none; }
    .hero-grid > .discover.paper {
        display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; align-items: center;
        gap: 10px 12px !important; min-height: 0 !important;
    }
    .hero-grid > .discover.paper > div:first-child,
    .hero-grid > .discover.paper > p,
    .hero-grid > .discover.paper .discover-card > strong,
    .hero-grid > .discover.paper .discover-card > small { display: none !important; }
    .hero-grid > .discover.paper h2 { grid-column: 1 !important; font-size: 1.375rem !important; line-height: 1.12 !important; }
    .hero-grid > .discover.paper .discover-card {
        grid-column: 2 !important; grid-row: 1 !important; margin: 0 !important; padding: 0 !important;
        border-image: none !important; rotate: 0deg; transform: none;
    }
    .hero-grid > .discover.paper .discover-card .btn { margin: 0 !important; width: auto !important; white-space: nowrap; }
}
@media print { .feed-niches, #feed .article .card-social { display: none !important; } }
