/* Page v3 of the project and lender page (page rethink, section 11; 1 Dec 2026): templates/v2/projects/detail_v3.html.
   Colours, type and spacing from tokens.css only. The banner keeps 16:9 and stays short (about 200px on a 390px phone)
   so the verdict and the Invest button reach the first screen; images carry width and height (no layout shift). */

/* Phones: answer first, so the right column comes after the main column (it came first on today's page) */
@media (max-width: 960px) { .ci-v3 .ci-rail { order: 0; } }

/* Scenario B: the banner photo or video poster */
.ci-v3media { position: relative; margin: 0 0 var(--ci-s4); border-radius: var(--ci-r-panel); overflow: hidden; background: var(--ci-moss); aspect-ratio: 16 / 9; max-height: 320px; }
.ci-v3media__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ci-v3media__all { position: absolute; right: var(--ci-s3); bottom: var(--ci-s3); display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--ci-s3); border-radius: var(--ci-r-pill); background: var(--ci-surface); color: var(--ci-deep-forest); font: var(--ci-small); font-weight: 600; text-decoration: none; box-shadow: var(--ci-shadow-float); }
.ci-v3media__all:focus-visible { outline: none; box-shadow: var(--ci-focus-ring); }
@media (max-width: 640px) { .ci-v3media { max-height: 220px; margin-bottom: var(--ci-s3); border-radius: var(--ci-r-card); } }

/* A video: a poster and a play button; the player replaces them on the click (detail.js, v3Video) */
.ci-v3video { position: relative; width: 100%; height: 100%; min-height: 100%; background: var(--ci-deep-forest); }
.ci-v3gallery .ci-v3video { aspect-ratio: 16 / 9; height: auto; border-radius: var(--ci-r-card); overflow: hidden; }
.ci-v3video__poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.ci-v3video__plain { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: var(--ci-s4); box-sizing: border-box; color: var(--ci-white); font: var(--ci-h3); text-align: center; }
.ci-v3video__play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--ci-s2); color: var(--ci-white); text-decoration: none; }
.ci-v3video__icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ci-deep-forest); color: var(--ci-white); font-size: 24px; box-shadow: var(--ci-shadow-float); }
.ci-v3video__label { padding: 2px var(--ci-s3); border-radius: var(--ci-r-pill); background: var(--ci-deep-forest); font: var(--ci-small); font-weight: 600; }
.ci-v3video__play:hover .ci-v3video__icon { background: var(--ci-forest); }
.ci-v3video__play:focus-visible { outline: none; }
.ci-v3video__play:focus-visible .ci-v3video__icon { box-shadow: var(--ci-focus-ring), var(--ci-shadow-float); outline: 3px solid var(--ci-white); }
.ci-v3video__note { position: absolute; left: var(--ci-s3); top: var(--ci-s3); max-width: calc(100% - 2 * var(--ci-s3)); margin: 0; padding: 2px var(--ci-s2); border-radius: var(--ci-r-pill); background: var(--ci-deep-forest); color: var(--ci-white); font: var(--ci-caption); }
.ci-v3video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 640px) { .ci-v3video__icon { width: 52px; height: 52px; font-size: 20px; } .ci-v3media .ci-v3video__note { display: none; } }

/* The first-screen card */
.ci-v3card { margin: 0 0 var(--ci-s5); padding: var(--ci-s5); border: 1px solid var(--ci-line); border-radius: var(--ci-r-panel); background: var(--ci-surface); }
.ci-v3card__head { display: flex; gap: var(--ci-s3); align-items: flex-start; }
.ci-v3card__name { min-width: 0; }
.ci-v3card .ci-jhero__tags { margin-bottom: var(--ci-s2); }
.ci-v3card .ci-phero__name { font: var(--ci-h2); color: var(--ci-ink); }
.ci-v3card__logo { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--ci-r-card); background: var(--ci-logo-tile); color: var(--ci-forest); font: var(--ci-small); font-weight: 700; overflow: hidden; }
.ci-v3card__logo img { width: 48px; height: 48px; object-fit: contain; }
.ci-v3card__verdict { margin: var(--ci-s3) 0 0; font: var(--ci-h3); color: var(--ci-ink); max-width: 64ch; }
.ci-v3card__h { margin: 0 0 var(--ci-s2); font: var(--ci-overline); text-transform: uppercase; letter-spacing: .08em; color: var(--ci-muted); }

/* Score and risk side by side */
.ci-v3pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ci-s3); margin: var(--ci-s4) 0 0; }
.ci-v3pair__tile { display: grid; gap: 2px; align-content: start; justify-items: start; padding: var(--ci-s3); border-radius: var(--ci-r-card); background: var(--ci-paper); }
.ci-v3pair__k { margin: 0; font: var(--ci-caption); font-weight: 600; color: var(--ci-muted); text-transform: uppercase; letter-spacing: .04em; }
.ci-v3pair__big { margin: 0; font: var(--ci-h3); color: var(--ci-ink); }
.ci-v3pair__big b { font-size: 26px; }
.ci-v3pair__big span { color: var(--ci-muted); font: var(--ci-small); }
.ci-v3pair__note { font: var(--ci-caption); color: var(--ci-muted); }
.ci-v3pair__grade { display: inline-block; padding: 2px var(--ci-s2); border-radius: var(--ci-r-small); background: var(--ci-surface); font: var(--ci-caption); font-weight: 700; color: var(--ci-ink); }
.ci-v3pair__grade--1 { background: var(--ci-level-1-tint); color: var(--ci-level-1-text); }
.ci-v3pair__grade--2 { background: var(--ci-level-2-tint); color: var(--ci-level-2-text); }
.ci-v3pair__grade--3 { background: var(--ci-level-3-tint); color: var(--ci-level-3-text); }
.ci-v3pair__grade--4 { background: var(--ci-level-4-tint); color: var(--ci-level-4-text); }
.ci-v3pair__grade--5 { background: var(--ci-level-5-tint); color: var(--ci-level-5-text); }

/* Key numbers with their basis: a compact grid, two columns on a phone */
.ci-v3nums { margin: var(--ci-s4) 0 0; }
.ci-v3nums__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--ci-s2); margin: 0; }
.ci-v3nums__item { min-width: 0; margin: 0; padding: var(--ci-s2) var(--ci-s3); border-radius: var(--ci-r-field); background: var(--ci-paper); }
.ci-v3nums__item dt { font: var(--ci-caption); font-weight: 600; color: var(--ci-muted); }
.ci-v3nums__item dd { margin: 0; }
.ci-v3nums__value { font: var(--ci-body); font-weight: 700; color: var(--ci-ink); overflow-wrap: anywhere; }
.ci-v3nums__basis { font: var(--ci-caption); color: var(--ci-muted); }
.ci-v3nums .ci-risk-line { margin-top: var(--ci-s2); }
.ci-v3card__flags { margin: var(--ci-s3) 0 0; font: var(--ci-small); color: var(--ci-ink); }

/* The offers: Invest with its referral and capital-at-risk line, then Follow and the Deep Risk Review */
.ci-v3offers { display: flex; flex-wrap: wrap; gap: var(--ci-s3); align-items: flex-start; margin: var(--ci-s4) 0 0; }
.ci-v3nums { padding-top: var(--ci-s4); border-top: 1px solid var(--ci-line); }
.ci-v3offers__invest { display: grid; gap: var(--ci-s1); justify-items: start; }
.ci-v3offers__invest .ci-card__ref { margin: 0; }
.ci-v3offers__more { display: flex; flex-wrap: wrap; gap: var(--ci-s2); align-items: center; }
.ci-v3offers__more .ci-btn { white-space: normal; height: auto; min-height: var(--ci-tap); text-align: left; }
.ci-v3offers__closed { margin: 0; font: var(--ci-small); color: var(--ci-muted); }
.ci-v3offers__closed strong { color: var(--ci-ink); }
@media (max-width: 640px) {
    .ci-v3card { padding: var(--ci-s4); }
    .ci-v3card__verdict { font-size: 17px; }
    .ci-v3nums__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ci-v3offers, .ci-v3offers__more { flex-direction: column; align-items: stretch; }
    .ci-v3offers__invest { justify-items: stretch; }
    .ci-v3offers .ci-btn { width: 100%; justify-content: center; text-align: center; }
    .ci-v3offers__invest .ci-card__ref { text-align: center; }
}

/* Eugene, 2 Dec 2026: the memo's own score box shows no grade word of its own (old lender memos say "Watch", "By veto"):
   the site's word is on the first screen. The free part is marked hidden (design/page_v3.py own_word_off); this hides
   it in the full memo too, once loaded */
.ci-v3 .ci-memo .score .grade, .ci-v3 [data-ci-own-word] { display: none; }

/* The 3 main risks */
.ci-v3risks__list { margin: 0; padding: 0 0 0 var(--ci-s5); display: grid; gap: var(--ci-s2); font: var(--ci-body); color: var(--ci-ink); }

/* The deep dive */
.ci-v3deep { margin: var(--ci-s6) 0 0; }
.ci-v3deep__kicker { margin: 0 0 var(--ci-s3); font: var(--ci-overline); text-transform: uppercase; letter-spacing: .1em; color: var(--ci-forest); }
.ci-v3topic .ci-answers { margin-top: var(--ci-s4); }
.ci-v3topic .ci-richtext + .ci-richtext { margin-top: var(--ci-s3); }
.ci-v3topic__memo { margin: var(--ci-s4) 0 var(--ci-s2); padding: 0; list-style: none; display: grid; gap: var(--ci-s2); }
.ci-v3topic__memo li { padding: var(--ci-s3); border-left: 3px solid var(--ci-clay-light); background: var(--ci-paper); border-radius: var(--ci-r-small); font: var(--ci-body); }
.ci-v3topic__memo strong { display: block; color: var(--ci-ink); }
.ci-v3topic__memo span { color: var(--ci-ink); }

/* The full gallery */
.ci-v3gallery__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--ci-s3); margin: 0; padding: 0; list-style: none; }
.ci-v3gallery__grid img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--ci-r-card); }
.ci-v3gallery__grid a:focus-visible { outline: none; box-shadow: var(--ci-focus-ring); border-radius: var(--ci-r-card); }
@media (max-width: 640px) { .ci-v3gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ci-s2); } .ci-v3gallery__video { grid-column: 1 / -1; } }

/* Decision 6: on a phone the Invest bar waits until the risks are reached (detail.js, v3Bar) */
@media (max-width: 960px) {
    .ci-v3 .ci-visitbar { transition: transform .2s ease-out; }
    .ci-v3 .ci-visitbar[data-ci-bar-wait] { visibility: hidden; transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) { .ci-v3 .ci-visitbar { transition: none; } }

/* Page v3 of the platform page, step A (templates/v2/platforms/detail_v3.html, 2 Dec 2026): the same card, pair, offers
   and key numbers; the logo beside the H1 (width and height set, no layout shift), the score tile's link to its block,
   the red flags box inside the card and "Our view" folded after its first part */
.ci-v3--platform .ci-v3card .ci-phero__name { font: var(--ci-h1); }
.ci-v3card__by { flex-wrap: wrap; }
.ci-v3pair__why { margin-top: var(--ci-s1); font: var(--ci-caption); font-weight: 600; color: var(--ci-forest); }
.ci-v3pair__why:focus-visible { outline: none; box-shadow: var(--ci-focus-ring); border-radius: var(--ci-r-small); }
.ci-v3card .ci-fflag-box { margin-bottom: 0; }
.ci-v3card .ci-phero__alerts { margin-top: var(--ci-s3); }
.ci-v3view .ci-richtext { max-width: 72ch; }
.ci-v3view__more { margin: var(--ci-s2) 0 0; }
.ci-v3view__more > summary { display: inline-flex; align-items: center; min-height: var(--ci-tap); cursor: pointer; color: var(--ci-forest); font: var(--ci-body); font-weight: 600; }
.ci-v3view__more > summary:focus-visible { outline: none; box-shadow: var(--ci-focus-ring); border-radius: var(--ci-r-small); }
.ci-v3view__more[open] > summary { margin-bottom: var(--ci-s2); }
@media (max-width: 640px) { .ci-v3--platform .ci-v3card .ci-phero__name { font: var(--ci-h2); } }
