/* ───────────────────────────────────────────────────────────────────────────
   pages.css — Home, About and custom pages (inc/page_render.php) and the
   links on them (inc/widgets.php). One stylesheet instead of style strings in
   the PHP, so every page shares the same header, panels, pills and tiles.
   Uses the site's theme variables (--primary, --secondary, --accent, …).
   ─────────────────────────────────────────────────────────────────────────── */

/* One radius and one shadow for every panel and tile, so they read as a set. */
:root {
    --pg-radius: 22px;
    --pg-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 10px 30px -12px rgba(0, 0, 0, 0.35);
    --pg-gap: 16px;
}

.page-section {
    position: relative;
}
.page-section.is-tall {
    min-height: 100vh;
    padding-bottom: 80px;
    box-sizing: border-box;
}
.page-background-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: var(--page-bg) !important;
    background-size: cover;
    background-position: center;
}
/* a photo background is darkened at the top only, where the title sits, so it stays sharp and bright below */
.page-has-photo .page-background-layer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.42),
        rgba(0, 0, 0, 0.08) 320px,
        rgba(0, 0, 0, 0) 560px
    );
}
.page-content-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px 15px;
    box-sizing: border-box;
}
.page-content-wrapper.is-narrow {
    max-width: 900px;
}
.page-content-wrapper.is-wide {
    max-width: 1100px;
}

/* ── Header: the same on every page. The site's icon as a badge, its name
      small over the page's title, then stats and link pills on the right.
      (A site without an icon shows its logo block instead.) ── */
.pg-head {
    --pg-title: clamp(2.3rem, 5vw, 3.5rem);
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px 18px;
    margin-bottom: 28px;
}
/* the badge is exactly as tall as the name and title beside it, whatever size they render at */
.pg-id {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}
/* name line + gap + title line, so the badge matches the text block */
.pg-badge {
    position: relative;
    width: calc(var(--pg-title) + 1.1rem + 8px);
    height: calc(var(--pg-title) + 1.1rem + 8px);
    flex-shrink: 0;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--pg-shadow);
}
.pg-badge img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
} /* out of flow, so the text decides the size */
.pg-titles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    text-align: left;
    color: var(--secondary);
}
.pg-site {
    font-size: 0.875rem;
    line-height: 1.1rem;
    font-weight: 600;
    opacity: 0.85;
}
.pg-head .pg-heading {
    margin: 0;
    font-size: var(--pg-title);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.035em;
    color: var(--secondary);
}
.page-has-photo .pg-titles,
.page-has-photo .pg-titles .pg-heading {
    color: #fff;
    text-shadow: 0 1px 16px rgba(0, 0, 0, 0.25);
}
.pg-logo {
    display: flex;
    background-color: var(--primary);
    border-radius: 16px;
    flex-shrink: 0;
    align-self: center;
}
.pg-logo img {
    display: block;
    height: 80px;
    width: auto;
    max-width: 90vw;
    border-radius: 8px;
}
.pg-head-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.pg-head-end:empty {
    display: none;
}
/* Phones: badge and title share a row, then the links as one row you can swipe. */
@media (max-width: 767px) {
    .pg-head {
        --pg-title: 2.1rem;
        align-items: center;
        gap: 12px 14px;
        margin-bottom: 18px;
    }
    .pg-badge {
        border-radius: 15px;
    }
    .pg-logo img {
        height: 52px;
    }
    .pg-head-end {
        align-items: flex-start;
        flex: none;
        width: 100%;
        gap: 8px;
    }
    .pg-head-end .nw-pills {
        flex-wrap: nowrap;
        justify-content: flex-start;
        max-width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .pg-head-end .nw-pills::-webkit-scrollbar {
        display: none;
    }
    .pg-head-end .nw-pill {
        flex: none;
    }
}

.analytics-pill {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--primary);
    color: var(--secondary);
    border-radius: 999px;
    padding: 4px 12px;
    line-height: 1;
}
.analytics-pill .ap-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}
.analytics-pill .ap-sep {
    opacity: 0.35;
}

/* ── Pills: header links and button rows ── */
.nw-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 10px;
}
.content-block-buttons .nw-pills {
    justify-content: center;
}
a.nw-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    box-sizing: border-box;
    background-color: var(--accent);
    color: var(--primary) !important;
    border-radius: 999px;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}
a.nw-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.35);
}
.nw-pill i {
    font-size: 0.9em;
    width: 1.1em;
    text-align: center;
}
.nw-pill img {
    width: 1em;
    height: 1em;
    object-fit: contain;
    border-radius: 3px;
}

/* ── Content blocks ── */
.content-grid.is-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--pg-gap);
    margin-bottom: var(--pg-gap);
}
@media (min-width: 768px) {
    .content-grid.is-columns {
        grid-template-columns: 1fr 1fr;
    }
}
/* each column's last block stretches, so both columns end on the same line */
.content-col {
    display: flex;
    flex-direction: column;
    gap: var(--pg-gap);
    min-width: 0;
}
.content-col > .pg-block {
    margin-bottom: 0;
}
.content-col > .pg-block:last-child {
    flex: 1 0 auto;
}
@media (min-width: 768px) {
    .content-col > .content-block-photo:last-child {
        position: relative;
        min-height: 320px;
    }
    .content-col > .content-block-photo:last-child img {
        position: absolute;
        inset: 0;
        height: 100%;
        object-fit: cover;
    }
}
.content-grid.is-single {
    display: flex;
    justify-content: center;
    gap: var(--pg-gap);
}
.content-row {
    margin-bottom: var(--pg-gap);
}
.content-row-full {
    width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    margin-bottom: 15px;
}
.pg-block {
    width: 100%;
    box-sizing: border-box;
    border-radius: var(--pg-radius);
    break-inside: avoid;
    margin-bottom: var(--pg-gap);
    overflow: hidden;
}
.content-grid.is-single .pg-block,
.content-row .pg-block,
.content-row-full .pg-block {
    margin-bottom: 0;
}
.pg-block.is-card {
    background-color: var(--primary);
    color: var(--secondary);
    box-shadow: var(--pg-shadow);
}
.pg-block.is-plain {
    color: var(--secondary);
}
.page-has-photo .pg-block.is-plain.content-block-text {
    text-shadow:
        0 1px 8px rgba(255, 255, 255, 0.8),
        0 0 2px rgba(255, 255, 255, 0.9);
}
.pg-block.is-full {
    background-color: var(--primary);
    color: var(--secondary);
    border-radius: 0;
}
.pg-block > h3 {
    margin: 0 0 10px;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.content-block-text {
    padding: 24px 28px 14px;
    text-align: left;
    line-height: 1.6;
}
.content-block-text p {
    margin: 0 0 12px;
}
/* a list in a text block reads as a tidy table of lines (e.g. a gear list) */
.content-block-text ul {
    list-style: none;
    margin: 4px 0 12px;
    padding: 0;
}
.content-block-text li {
    padding: 9px 0;
    border-top: 1px solid color-mix(in srgb, var(--secondary) 10%, transparent);
}
.content-block-text li:first-child {
    border-top: 0;
}
.content-block-text.is-full {
    padding: 20px;
}
.page-section.is-small-text .content-block-text {
    font-size: 0.8em;
}
.content-block-text.is-align-center {
    text-align: center;
}
.content-block-text.is-align-right {
    text-align: right;
}
.content-block-text.is-align-justify {
    text-align: justify;
}
.content-block-text.is-size-s {
    font-size: 0.85em;
}
.content-block-text.is-size-l {
    font-size: 1.2em;
}
.content-block-text.is-size-xl {
    font-size: 1.45em;
}
.content-block-photo {
    position: relative;
    padding: 0;
}
.content-block-photo img {
    width: 100%;
    height: auto;
    display: block;
}
.content-block-photo {
    box-shadow: var(--pg-shadow);
}
.photo-caption {
    position: absolute;
    left: 14px;
    bottom: 14px;
    max-width: calc(100% - 28px);
    box-sizing: border-box;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
}
.content-block-buttons.is-card,
.content-block-html.is-card {
    padding: 20px 28px;
}
.content-block-buttons.is-plain {
    padding: 5px 0;
}
.content-block-html.is-full {
    padding: 20px;
}
.content-block-embed.is-card {
    padding: 10px;
}
.content-block-embed .embed-video {
    position: relative;
    padding-top: 56.25%;
}
.content-block-embed .embed-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.content-block-embed iframe {
    width: 100%;
    border: 0;
    display: block;
}
.content-block-spacer {
    break-inside: avoid;
}

/* ── Albums list (rows scoped to the panel so they beat the site's a:visited colour) ── */
.photo-groups-section {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 1.5rem;
    background-color: var(--primary);
    border-radius: 16px;
    box-sizing: border-box;
}
.photo-groups-section h1 {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--secondary);
    text-align: center;
}
.pg-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}
.pg-filters,
.pg-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pg-controls button {
    font-family: inherit;
    font-size: 0.7em;
    font-weight: 600;
    padding: 4px 8px;
    border: 1px solid var(--primary_grey, #ccc);
    border-radius: 20px;
    background-color: var(--primary);
    color: var(--secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.pg-controls button:hover {
    border-color: #aaa;
    background-color: var(--accent_faded);
}
.pg-controls button.active {
    background-color: var(--accent, #007bff);
    color: var(--primary);
    border-color: var(--accent, #007bff);
}
.pg-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--primary);
    border: 1px solid var(--primary_grey, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}
.photo-groups-section .pg-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--secondary);
    border-bottom: 1px solid var(--primary_grey, #e0e0e0);
    transition: background-color 0.2s ease;
}
.photo-groups-section .pg-list li:last-child .pg-row {
    border-bottom: none;
}
.photo-groups-section .pg-row:hover {
    background-color: var(--accent_faded, #f0f0f0);
}
.pg-cover-photo {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #f0f0e0;
    flex-shrink: 0;
}
.pg-cover-placeholder {
    width: 80px;
    height: 50px;
    flex-shrink: 0;
    background-color: #f8f8f8;
    border-radius: 4px;
}
.pg-title-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-right: 10px;
    text-align: left;
}
.pg-name {
    font-weight: 600;
    font-size: 0.9em;
}
.pg-date {
    font-size: 0.7em;
    color: var(--secondary_grey);
}
.pg-views {
    font-size: 0.7em;
    color: var(--secondary_grey);
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.pg-views .fa-eye {
    opacity: 0.7;
}
.pg-tag {
    font-size: 0.7em;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    color: #fff;
    flex-shrink: 0;
}
.pg-tag.type-album {
    background-color: #7e57c2;
}
.pg-tag.type-trip {
    background-color: #3498db;
}
.pg-tag.type-blog {
    background-color: #2ecc71;
}
.pg-tag.type-group {
    background-color: #e67e22;
}

/* ── Tiles: a cards block. A photo tile shows the photo under a dark fade, a
      logo tile the logo whole on a light tile, a live tile (GitHub, BirdNET)
      its own drawing, and anything else a gradient of its colour (a known
      site's brand colour when none is set) with its icon drawn large. ── */
.nw-cards-title {
    margin: 10px 0 14px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--secondary);
    text-align: center;
}
/* Rows follow the window height so a short page of tiles fits a laptop screen without scrolling. */
.nw-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    grid-auto-rows: clamp(170px, calc((100vh - 300px) / 2), 280px);
    grid-auto-flow: dense;
    gap: var(--pg-gap);
}
.nw-card {
    --card-accent: var(--accent);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 20px;
    border-radius: var(--pg-radius);
    overflow: hidden;
    isolation: isolate;
    color: #fff !important;
    text-decoration: none !important;
    box-shadow: var(--pg-shadow);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}
.nw-card.is-wide {
    grid-column: span 2;
}
.nw-card.is-full {
    grid-column: 1 / -1;
}
.nw-card.is-big {
    grid-column: span 2;
    grid-row: span 2;
}
.nw-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.08),
        0 18px 36px -12px color-mix(in srgb, var(--card-accent) 70%, rgba(0, 0, 0, 0.5));
}
.nw-card.has-colour {
    background:
        radial-gradient(
            120% 90% at 100% 0%,
            color-mix(in srgb, var(--card-accent) 70%, #fff) 0%,
            transparent 55%
        ),
        linear-gradient(
            150deg,
            var(--card-accent),
            color-mix(in srgb, var(--card-accent) 55%, #000)
        );
}
/* YouTube: a dark tile with the red play badge in the middle, like a video waiting to start */
.nw-card.brand-youtube.has-colour {
    background: #181818;
}
.nw-card.brand-youtube .nw-card-art {
    inset: 0 0 28% 0;
    display: grid;
    place-items: center;
    font-size: 4.2rem;
    color: #ff0033;
    opacity: 1;
    transform: none;
}
.nw-card.brand-youtube.is-big .nw-card-art {
    font-size: 7rem;
}
.nw-card.brand-youtube:hover .nw-card-art {
    transform: scale(1.08);
}
/* YouTube with a newest video: its thumbnail, with a white play button in the middle */
.nw-card-play {
    position: absolute;
    top: 46%;
    left: 50%;
    z-index: 0;
    width: 58px;
    height: 58px;
    translate: -50% -50%;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.95);
    color: #1d1d1f;
    font-size: 1.1rem;
    padding-left: 3px;
    box-sizing: border-box;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transition: transform 0.3s ease;
}
.nw-card:hover .nw-card-play {
    transform: scale(1.08);
}
/* Instagram: the site's newest photos edge to edge, like a profile grid, under the usual dark fade */
.nw-card.has-instagram {
    background: #fff;
}
.nw-card-ig {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2px;
    overflow: hidden;
}
.nw-card.is-wide .nw-card-ig,
.nw-card.is-full .nw-card-ig {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
}
.nw-card-ig > span {
    overflow: hidden;
}
.nw-card-ig img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.nw-card:hover .nw-card-ig img {
    transform: scale(1.06);
}
.nw-card.has-instagram::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 50%);
    pointer-events: none;
}
.nw-card-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transition:
        transform 0.6s ease,
        opacity 0.6s ease;
}
.nw-cards.is-fading .nw-card-img:not(.is-loaded) {
    opacity: 0;
} /* pages.js: fade in once loaded */
/* a tile with a backdrop shows it straight away; its live image then fades in quicker over it */
.nw-card.has-backdrop {
    background-size: cover;
    background-position: center;
}
.nw-card.has-backdrop .nw-card-img {
    transition:
        transform 0.6s ease,
        opacity 0.35s ease;
}
.nw-card:hover .nw-card-img {
    transform: scale(1.06);
}
.nw-card.has-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(
            to top,
            rgba(0, 0, 0, 0.78) 0%,
            rgba(0, 0, 0, 0.35) 38%,
            rgba(0, 0, 0, 0) 62%
        ),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0) 30%);
}
.nw-card-art {
    position: absolute;
    right: -6%;
    bottom: -14%;
    z-index: -1;
    font-size: 9rem;
    line-height: 1;
    opacity: 0.16;
    transform: rotate(-12deg);
    transition: transform 0.5s ease;
}
.nw-card.is-big .nw-card-art {
    font-size: 16rem;
}
.nw-card:hover .nw-card-art {
    transform: rotate(-4deg) scale(1.05);
}
.nw-card.has-logo {
    background: radial-gradient(
        90% 70% at 50% 40%,
        color-mix(in srgb, var(--card-accent) 14%, var(--primary)),
        var(--primary)
    );
    color: var(--secondary) !important;
}
.nw-card-logo {
    position: absolute;
    inset: 0 0 36% 0;
    z-index: -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 32px 0;
    box-sizing: border-box;
}
.nw-card-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}
.nw-card:hover .nw-card-logo img {
    transform: scale(1.05);
}
.nw-card.has-logo .nw-card-text {
    text-shadow: none;
}
.nw-card.has-logo .nw-card-go {
    background: color-mix(in srgb, var(--secondary) 8%, transparent);
}
.nw-card.has-logo:hover .nw-card-go {
    background: var(--secondary);
    color: var(--primary);
}
.nw-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nw-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--card-accent);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.nw-card.has-colour .nw-card-icon {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}
.nw-card-go {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: 0.85rem;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}
.nw-card-go.is-ext i {
    transform: rotate(-45deg);
}
.nw-card:hover .nw-card-go {
    background: #fff;
    color: #111;
    transform: rotate(-8deg);
}
.nw-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}
.nw-card-text b {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.2;
}
/* the white label on a YouTube or Instagram tile */
.nw-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    background: #fff;
    color: #1d1d1f;
    font-size: 0.78rem;
    font-weight: 600;
    text-shadow: none;
}
.nw-card-chip .fa-youtube {
    color: #ff0033;
}
.nw-card-chip .fa-instagram {
    color: #d62976;
}
.nw-card.is-big .nw-card-text b {
    font-size: 1.9rem;
}
.nw-card-blurb {
    font-size: 0.86rem;
    line-height: 1.4;
    opacity: 0.88;
    max-width: 34em;
}
@media (max-width: 560px) {
    .nw-cards {
        grid-template-columns: 1fr;
        grid-auto-rows: 200px;
    }
    .nw-card.is-wide,
    .nw-card.is-big,
    .nw-card.is-full {
        grid-column: auto;
    }
    .nw-card.is-big {
        grid-row: auto;
        min-height: 280px;
    }
}

/* GitHub tile: handle and total top left, the contribution grid under them, newest week
   at the right and older weeks running off the left edge. Sizes follow the tile (cq units);
   the grid never takes much more than a third of the height, so the title stays clear. */
.nw-card-gh {
    position: absolute;
    inset: 0;
    z-index: -2;
    container-type: size;
    padding: 16px;
    box-sizing: border-box;
    background: #0d1117;
}
.nw-gh-in {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.nw-gh-head {
    display: flex;
    flex-direction: column;
}
.nw-gh-user {
    color: #39d353;
    font-weight: 700;
    font-size: clamp(0.78rem, 4.5cqw, 1.15rem);
    white-space: nowrap;
}
.nw-gh-total {
    color: #e6edf3;
    font-weight: 800;
    font-size: clamp(1.9rem, 15cqw, 4.6rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.nw-gh-label {
    color: #8b949e;
    font-size: clamp(0.72rem, 4cqw, 1.05rem);
    white-space: nowrap;
}
/* When the year fits, it lines up with the text on the left (the auto margin takes the spare
   room); when it doesn't, the auto margin drops to 0 and flex-end keeps the newest week in view,
   older weeks running off under the left padding to the tile's edge. */
.nw-gh-grid {
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
    margin: 12px 0 0 -16px;
    padding-left: 16px;
}
.nw-gh-grid > span {
    --c: min(calc((100cqw - 32px) / 34), calc(100cqh * 0.36 / 8.2));
    margin-right: auto;
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, var(--c));
    grid-auto-columns: var(--c);
    gap: calc(var(--c) * 0.2);
    transform-origin: right top;
    transition: transform 0.6s ease;
}
.nw-gh-grid i {
    border-radius: 22%;
}
.nw-gh-grid .l0 {
    background: #161b22;
}
.nw-gh-grid .l1 {
    background: #0e4429;
}
.nw-gh-grid .l2 {
    background: #006d32;
}
.nw-gh-grid .l3 {
    background: #26a641;
}
.nw-gh-grid .l4 {
    background: #39d353;
}
.nw-card:hover .nw-gh-grid > span {
    transform: scale(1.04);
}
/* wide, short tiles: the grid sits beside the numbers, centred in the height (clear of the
   arrow button and the title), and uses the width instead */
@container (min-aspect-ratio: 2 / 1) {
    .nw-gh-in {
        flex-direction: row;
        align-items: flex-start;
        gap: 24px;
    }
    .nw-gh-grid {
        flex: 1;
        min-width: 0;
        align-self: center;
        margin: 0;
        padding-left: 0;
    }
    .nw-gh-grid > span {
        --c: min(calc((100cqw - 220px) / 34), calc(100cqh * 0.5 / 8.2));
    }
}
/* short tiles (phones): drop the label so the grid stays above the title */
@container (max-height: 230px) {
    .nw-gh-label {
        display: none;
    }
    .nw-gh-total {
        font-size: clamp(1.6rem, 20cqh, 2.6rem);
    }
    .nw-gh-grid {
        margin-top: 8px;
    }
    .nw-gh-grid > span {
        --c: min(calc((100cqw - 32px) / 34), calc(100cqh * 0.3 / 8.2));
    }
}
/* a full-width GitHub tile shows the whole year across the row */
.nw-card.is-full .nw-gh-grid > span {
    --c: min(calc((100cqw - 220px) / 64), calc(100cqh * 0.55 / 8.2));
}
.nw-card.has-github::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        to top,
        rgba(13, 17, 23, 0.92) 0%,
        rgba(13, 17, 23, 0.5) 30%,
        rgba(13, 17, 23, 0) 50%
    );
}

/* BirdNET tile: sky and hills behind, today's top birds as bars on the left, a flock on the right. */
.nw-card-bn {
    position: absolute;
    inset: 0;
    z-index: -2;
    container-type: size;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 2cqh, 10px);
    padding: 16px;
    box-sizing: border-box;
    color: #163a26;
}
.nw-bn-scene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}
.nw-bn-flock {
    position: absolute;
    right: 7%;
    top: 24%;
    width: 22%;
    fill: none;
    stroke: #163a26;
    stroke-width: 5;
    stroke-linecap: round;
    transition: transform 0.8s ease;
}
.nw-card:hover .nw-bn-flock {
    transform: translate(-6%, -8%);
}
.nw-bn-head {
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.75;
    font-size: clamp(0.62rem, 3.6cqw, 0.95rem);
}
.nw-bn-rows {
    --row: clamp(18px, 8.5cqh, 34px);
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 1.4cqh, 8px);
    width: 58%;
}
.nw-bn-row {
    position: relative;
    isolation: isolate;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    height: var(--row);
    padding: 0 0.8em;
    box-sizing: border-box;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.33);
    font-size: clamp(0.64rem, 4cqw, 1rem);
    white-space: nowrap;
}
.nw-bn-row::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    z-index: -1;
    width: max(var(--share), var(--row));
    border-radius: inherit;
    background: var(--bar);
}
.nw-bn-row b {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nw-bn-row i {
    font-style: normal;
}
.nw-bn-row.is-full b {
    color: #f3efe6;
}
.nw-bn-row.r0 {
    --bar: #56804c;
}
.nw-bn-row.r1 {
    --bar: #769c5c;
}
.nw-bn-row.r2 {
    --bar: #8caa64;
}
.nw-bn-row.r3 {
    --bar: #a0b478;
}
.nw-card.has-birdnet::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.2) 30%,
        rgba(0, 0, 0, 0) 50%
    );
}
