/* ═══════════════════════════════════════════════════════════════════════════
   "More for {City}" cards — each styled like the chart it links to
   (BRIEF SITE-LAYOUT-M). Markup: cct_related_charts_print() in
   includes/related-charts.php. The base grid and the plain card (a type with
   no declared header) stay in single-citizen-chart.css.

   Restraint: the chart's header colour is a short title bar; the body stays
   light; the teaser is small and quiet. Colours arrive inline from the type's
   own header declaration, so there are no per-type rules here.
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-link--styled {
    padding: 0;
    gap: 0;
    overflow: hidden;
    background: var(--color-surface, #fff);
}

.cct-related-charts .cct-related-link--styled:hover,
.cct-related-charts .cct-related-link--styled:focus-visible {
    border-color: var(--cct-card-accent, var(--color-accent, #2563eb));
}

.cct-related-charts .cct-related-bar {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 14px;
    box-sizing: border-box;
}

.cct-related-charts .cct-related-bar .cct-related-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

/* Strip mode: no text colour reaches 4.5:1 on this background, so the colour
   is a thin band and the title sits on the light body. */
.cct-related-charts .cct-related-link--strip .cct-related-bar {
    min-height: 6px;
    padding: 0;
}
.cct-related-charts .cct-related-link--strip > .cct-related-title {
    padding: 10px 14px 0;
}

.cct-related-charts .cct-related-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 3px;
    padding: 9px 14px 12px;
}

.cct-related-charts .cct-related-fact {
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--color-text, #111827);
}

/* W #17: a BARE card, a styled card whose type added no fact, teaser or hero
   for this place. N3 put the link's title in the white body under the bar,
   which on a phone read as a title over an empty box. Now the colour fills
   the card: the bar grows, the title centres in it, and the link's own
   title and the type label (each only when it adds something) sit under it
   in the bar's colours. A strip card keeps its band; the same lines centre
   in the light body instead. */
.cct-related-charts .cct-related-link--bare:not(.cct-related-link--strip) > .cct-related-bar,
.cct-related-charts .cct-related-link--bare.cct-related-link--strip > .cct-related-body {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
}

.cct-related-charts .cct-related-link--bare:not(.cct-related-link--strip) > .cct-related-bar .cct-related-title {
    font-size: 1.05rem;
    line-height: 1.3;
}

.cct-related-charts .cct-related-link--bare.cct-related-link--strip .cct-related-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
}

.cct-related-charts .cct-related-link--bare .cct-related-fact--fallback {
    font-size: 0.8rem;
    line-height: 1.3;
    color: inherit;
    opacity: 0.85;
}

.cct-related-charts .cct-related-link--bare > .cct-related-bar .cct-related-kind {
    opacity: 0.75;
}

.cct-related-charts .cct-related-teaser {
    display: block;
    position: relative;
    margin-top: auto;
    padding-top: 8px;
    opacity: 0.9;
}

.cct-related-charts .cct-related-spark {
    display: block;
    position: relative;
    height: 28px;
}

.cct-related-charts .cct-related-teaser--spark svg {
    display: block;
    width: 100%;
    height: 28px;
    overflow: visible;
}

.cct-related-charts .cct-related-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    border-radius: 50%;
}

.cct-related-charts .cct-related-teaser--image {
    height: 80px;
    overflow: hidden;
}

.cct-related-charts .cct-related-teaser--image img {
    display: block;
    height: 80px;
    width: auto;
    max-width: 100%;
    margin-left: auto;
    object-fit: contain;
    object-position: right top;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE WIDGET BODY (brief N, 09-27) — a card is a WIDGET, not a shrunken
   chart: one hero (a number or a picture, never two), one supporting line
   that is a stat the chart already shows, a quiet footer. Only used when a
   type's `cct_related_card` answer sets `hero`; the classic fact+teaser body
   above is untouched for every type that has not adopted this shape.
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-body--widget {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 2px;
}

.cct-related-charts .cct-related-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 64px;
}

.cct-related-charts .cct-related-hero--number {
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text, #111827);
    justify-content: flex-start;
}

.cct-related-charts .cct-related-hero-unit {
    font-size: 1.1rem;
    font-weight: 500;
    margin-left: 2px;
    opacity: 0.75;
}

.cct-related-charts .cct-related-hero--image {
    width: 100%;
    overflow: hidden;
}

.cct-related-charts .cct-related-hero--image img {
    display: block;
    height: 100%;
    max-height: 118px;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.cct-related-charts .cct-related-hero--svg {
    width: 100%;
    min-height: 84px;
    border-radius: 4px;
    overflow: hidden;
}

.cct-related-charts .cct-related-hero--svg svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE DRAWN HERO (brief N4, 09-28) — a FEW ELEMENTS of the chart (the sun
   behind the place's landmark, one champion tree, one blooming plant), drawn
   by the chart type's own card function (window.cctCardRenderers[type]) once
   js/related-tile-loader.js sees the row near the viewport. Replaces N3's
   whole-tile hero and the PM's 09-28 stopgap clamp: the card sizes the
   picture, the chart never sizes the card.
   Fixed height so the row never reflows when a picture arrives; a picture,
   not a control (the whole card stays one link).
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-hero--draw {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    height: 118px;
    min-height: 0;
    /* Pinned under the bar in every card, however many text lines follow
       (the body is flex-end, which would drop a one-line card's picture). */
    margin-bottom: auto;
    overflow: hidden;
    border-radius: 4px;
    pointer-events: none;
    position: relative;
}

.cct-related-charts .cct-related-hero--draw > svg,
.cct-related-charts .cct-related-hero--draw > canvas {
    display: block;
    margin: 0 auto;
}

.cct-related-charts .cct-related-hero--draw.cct-draw-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: cctDrawShimmer 1.5s infinite;
}

/* The draw declined or failed: no picture; the server-rendered line and
   footer carry the card. */
.cct-related-charts .cct-related-hero--draw.cct-draw-failed {
    display: none;
}

@keyframes cctDrawShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cct-related-charts .cct-related-hero--draw.cct-draw-loading {
        animation: none;
    }
}

.cct-related-charts .cct-related-line {
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--color-text, #111827);
}

.cct-related-charts .cct-related-footer {
    font-size: 0.72rem;
    line-height: 1.3;
    opacity: 0.62;
}

.cct-related-charts .cct-related-sub {
    font-size: 0.8rem;
    line-height: 1.3;
    font-style: italic;
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE SIDE CARD (brief N5, 09-28) — Justin: tree on one side, text on the
   other, on the chart's own background. The drawn hero fills the WHOLE body
   (the chart's parchment + feet lines, the garden's sky + soil) and keeps
   its picture left of the padding; the server text sits centred in the
   rest. The body's inline `surface` style is that background before (and
   without) the draw. The type's draw function reads the split from this
   padding, so change it here only.
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-body--side {
    position: relative;
    min-height: 150px;
    padding: 10px 10px 10px 44%;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 4px;
    color: var(--color-text, #111827);
}

.cct-related-charts .cct-related-body--side > .cct-related-hero--draw {
    position: absolute;
    inset: 0;
    height: auto;
    margin: 0;
    border-radius: 0;
}

.cct-related-charts .cct-related-body--side > :not(.cct-related-hero) {
    position: relative;
    z-index: 1;
    color: inherit;
}

.cct-related-charts .cct-related-body--side .cct-related-line {
    font-size: 0.88rem;
    font-weight: 600;
}

.cct-related-charts .cct-related-body--side .cct-related-footer {
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE OVERLAY CARD (brief N6, 09-28) — Justin on the Sky Almanac: *"zoom to
   fill the white space... the text should be white."* The hero (a drawn scene
   or a photo) fills the WHOLE body and the text sits over its bottom edge in
   white on a dark fade: the bird chart's own photo caption
   (birds-component.js renderBirdCard: linear-gradient(transparent,
   rgba(0,0,0,0.8)), white bold name, italic second line, text-shadow
   0 1px 3px rgba(0,0,0,0.5)). A draw function may read where the text
   starts from the layout; never hard-code it.
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-body--overlay {
    position: relative;
    min-height: 150px;
    padding: 10px 12px 9px;
    justify-content: flex-end;
    gap: 1px;
    overflow: hidden;
    background: #111;
    color: #fff;
}

.cct-related-charts .cct-related-body--overlay > .cct-related-hero {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    border-radius: 0;
}

.cct-related-charts .cct-related-body--overlay > .cct-related-hero--image img {
    width: 100%;
    height: 100%;
    max-height: none;
    max-width: none;
    object-fit: cover;
}

/* The fade under the text, between the picture and the words. */
.cct-related-charts .cct-related-body--overlay::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 55%;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    pointer-events: none;
}

.cct-related-charts .cct-related-body--overlay > :not(.cct-related-hero) {
    position: relative;
    z-index: 1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.cct-related-charts .cct-related-body--overlay .cct-related-line {
    font-size: 0.86rem;
    font-weight: 700;
}

.cct-related-charts .cct-related-body--overlay .cct-related-sub {
    font-size: 0.74rem;
    opacity: 0.9;
}

.cct-related-charts .cct-related-body--overlay .cct-related-footer {
    font-size: 0.7rem;
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THE METRICS HERO (brief N5) — the station chart's own current-reading
   boxes. Justin: *"borrow more of the chart's background/styling for the
   current temp part. Humidity should be in a box similar to what it does on
   the chart."* The chart styles these inline in JS, so its tokens are
   COPIED here — source: citizen-dashboard-core/chart-types/weather/assets/js/
   modern-weather-dashboard.js, createMetricCardStyle() (#f8f9fa box, 6px
   radius, centred column), createMetricLabelStyle() (bold uppercase #666),
   the 'temp-reading' / 'metric-value' spans (bold #333) and their units
   (#666), and the main-temp panel's tint wash (inline, from the PHP).
   Change them there, then here.
   ═══════════════════════════════════════════════════════════════════════════ */

.cct-related-charts .cct-related-hero--metrics {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    gap: 6px;
    min-height: 96px;
    margin-bottom: auto;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.cct-related-charts .cct-related-metric {
    flex: 2 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* N6: label and number sit together in the middle of the box (Justin:
       the humidity pair "should be closer together like the temperature"),
       not pushed to its top and bottom edges. */
    justify-content: center;
    gap: 6px;
    align-items: center;
    padding: 5px 4px;
    border-radius: 6px;
    background-color: #f8f9fa;
    text-align: center;
    overflow: hidden;
}

.cct-related-charts .cct-related-metric--main {
    flex: 3 1 0;
}

.cct-related-charts .cct-related-metric-label {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #666;
}

.cct-related-charts .cct-related-metric-reading {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    line-height: 1;
}

.cct-related-charts .cct-related-metric-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #333;
}

.cct-related-charts .cct-related-metric--main .cct-related-metric-value {
    font-size: 2.1rem;
}

.cct-related-charts .cct-related-metric-unit {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 2px 1px;
}

/* The unit rides the number's baseline, tight to it (N6). */
.cct-related-charts .cct-related-metric-reading {
    align-items: baseline;
}
.cct-related-charts .cct-related-metric-reading .cct-related-metric-unit {
    margin: 0 0 0 1px;
}

.cct-related-charts .cct-related-metric-sub {
    font-size: 0.7rem;
    color: #666;
}

@media (max-width: 480px) {
    .cct-related-charts .cct-related-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cct-related-charts .cct-related-bar {
        padding: 8px 10px;
    }
    .cct-related-charts .cct-related-body {
        padding: 8px 10px 10px;
    }
    .cct-related-charts .cct-related-hero--number {
        font-size: 1.7rem;
    }
    .cct-related-charts .cct-related-hero--image img {
        max-height: 90px;
    }
    .cct-related-charts .cct-related-hero--draw {
        height: 100px;
    }
    .cct-related-charts .cct-related-body--side {
        min-height: 132px;
        padding: 8px 6px 8px 40%;
    }
    .cct-related-charts .cct-related-body--side .cct-related-line {
        font-size: 0.8rem;
    }
    .cct-related-charts .cct-related-body--overlay {
        min-height: 132px;
        padding: 8px 8px 7px;
    }
    .cct-related-charts .cct-related-body--overlay .cct-related-line {
        font-size: 0.78rem;
    }
    .cct-related-charts .cct-related-sub {
        font-size: 0.74rem;
    }
    .cct-related-charts .cct-related-hero--metrics {
        gap: 4px;
        min-height: 84px;
    }
    .cct-related-charts .cct-related-metric-label {
        font-size: 0.58rem;
    }
    .cct-related-charts .cct-related-metric-value {
        font-size: 1.15rem;
    }
    .cct-related-charts .cct-related-metric--main .cct-related-metric-value {
        font-size: 1.6rem;
    }
}
