/* Card frames and opacity (reader package 6, 2026-11-22). Record and state table: Server/docs/Reader_Frames_Opacity_2026-11-22.md. Loaded as the LAST stylesheet.
   One visual channel per piece of information:
     content type  -> frame style (data-frame: strong | solid | long-dash | short-dash | none) + type colour on the badge/icons (content-tokens.css)
     special post  -> frame colour (game, digital human interaction, shared); every other frame has the same colour (--frame-line)
     seen / read   -> opacity of the content (data-seen / data-read, values from the seen settings: --seen-opacity, --read-opacity)
     evidence      -> the evidence badge and the sources; no opacity any more
   The frame of a card never disappears because it was seen, and opening a card always shows its own frame at 100 %.
   The frame rules are !important on purpose: older rules of single features (wide cards, hover, opened card, spoken edition, shared, game, own posts) gave the frame
   other colours and widths; this file is the one place that decides them. Glows and shadows stay with the styles and features. */

/* ---- 1. Frame colour: one colour for all, special posts in their own colour ---- */
.news-card{--frame-color:var(--frame-line,var(--card-line,var(--line)))}
.news-card[data-game=ready]{--frame-color:var(--frame-game)}
.news-card:is([data-interaction=ready],[data-formats~="interaction"]){--frame-color:var(--frame-interaction)}
.news-card:is(.shared-article,[data-shared=in]){--frame-color:var(--frame-shared-in,var(--frame-shared))}
.news-card[data-shared=out]{--frame-color:var(--frame-shared-out)}
/* Package 78: opened from the newsletter (wins over the generic frame of a post opened by link). */
.news-card.news-card:is([data-shared=news],[data-shared=mail]){--frame-color:var(--frame-newsletter,#e6b800)}
/* Package 98: a newsletter card that is also a presenter post, a game or an interaction keeps that colour; the yellow stays for ordinary posts only. */
.news-card.news-card.news-card:is([data-shared=news],[data-shared=mail])[data-speech=ready]{--frame-color:var(--frame-presenter)}
.news-card.news-card.news-card:is([data-shared=news],[data-shared=mail])[data-game=ready]{--frame-color:var(--frame-game)}
.news-card.news-card.news-card:is([data-shared=news],[data-shared=mail]):is([data-interaction=ready],[data-formats~="interaction"]){--frame-color:var(--frame-interaction)}
/* Glows follow the frame of special posts; the spoken edition no longer has a frame colour of its own. */
.news-card[data-speech=ready]{--frame-glow:initial}
.news-card:is([data-game=ready],[data-interaction=ready],[data-formats~="interaction"],.shared-article,[data-shared]){--frame-glow:var(--frame-color)}

/* ---- 2. Frame style per content type ---- */
.news-card>.card-surface{border-style:solid!important;border-color:var(--frame-color)!important;border-width:var(--frame-solid,2px)!important}
.news-card[data-frame=strong]>.card-surface{border-width:var(--frame-strong,3px)!important}
.news-card:is([data-frame=short-dash],[data-frame=long-dash],[data-frame=none])>.card-surface{border-color:transparent!important}
.news-card>.card-outline{display:none!important;color:var(--frame-color)!important}
.news-card:is([data-frame=short-dash],[data-frame=long-dash])>.card-outline{display:block!important}
.news-card.shared-article>.card-surface{box-shadow:0 0 0 1px var(--frame-color),var(--shadow)}
.news-card[data-frame=none].shared-article>.card-surface{box-shadow:var(--shadow)}
@media(forced-colors:active){
 .news-card>.card-surface{border-color:CanvasText!important}
 .news-card:is([data-frame=short-dash],[data-frame=long-dash])>.card-surface{border-color:transparent!important}
 .news-card[data-frame=none]>.card-surface{border-style:none!important}
 .news-card>.card-outline{color:CanvasText!important}
}

/* ---- 3. Seen and read: opacity of text, media and background. Hover, keyboard focus, a tapped card and an opened card show 100 %. ---- */
.news-card{--card-opacity:1}
.news-card[data-seen=true]{--card-opacity:var(--seen-opacity,.5)}
.news-card[data-read=true]{--card-opacity:var(--read-opacity,.2)}
.news-grid[data-history=true] .news-card,.news-grid[data-full-opacity=true] .news-card{--card-opacity:1}
@media(hover:hover){.news-card:hover{--card-opacity:1!important}}
.news-card:has(:focus-visible),.news-card.tap-focused,.news-card.expanded{--card-opacity:1!important}
/* While a touch screen scrolls, a card that only kept the keyboard focus returns to its resting opacity. */
@media(hover:none){
 .news-grid.touch-scrolling .news-card:has(:focus-visible):not(.tap-focused):not(.expanded){--card-opacity:1!important}
 .news-grid.touch-scrolling:not([data-history=true]):not([data-full-opacity=true]) .news-card[data-seen=true]:has(:focus-visible):not(.tap-focused):not(.expanded){--card-opacity:var(--seen-opacity,.5)!important}
 .news-grid.touch-scrolling:not([data-history=true]):not([data-full-opacity=true]) .news-card[data-read=true]:has(:focus-visible):not(.tap-focused):not(.expanded){--card-opacity:var(--read-opacity,.2)!important}
}

/* ---- 4. Type colours on the card and in the content menu (icons darkened on light themes, see content-tokens.css) ---- */
:root[data-theme=light] .content-kind-badge:before{background:color-mix(in oklab,var(--kind-color) var(--type-ink-mix,100%),#000)}
:root[data-theme=light][data-kind-colors=true] :is(.meta-kind svg,.kind-symbol svg){color:color-mix(in oklab,var(--content-icon-color) var(--type-ink-mix,100%),#000)}

/* ---- 5. Special posts in "Which posts?" and the shared banner: text in the colour of their frame ---- */
.format-choice:has(input[data-format=game]) label{color:var(--frame-game-ink)}
.format-choice:has(input[data-format=interaction]) label{color:var(--frame-interaction-ink)}
.format-choice:has(input[data-format=shared]) label{color:var(--frame-shared-ink)}
.shared-banner{color:var(--frame-shared-ink);background:color-mix(in srgb,var(--frame-shared) 12%,var(--surface));border-bottom-color:color-mix(in srgb,var(--frame-shared) 40%,var(--line))}
.shared-banner button:focus-visible{outline-color:var(--frame-shared-ink)}

/* ---- 6. Seen settings: the two opacity fields ---- */
.seen-settings .opacity-percent input{width:62px}
