/* ───────────────────────────────────────────────────────────────────────────
   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, …).
   ─────────────────────────────────────────────────────────────────────────── */

.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; }
.page-content-wrapper { position: relative; z-index: 2; width: 100%; margin: 0 auto; padding: 30px 15px 15px; box-sizing: border-box; }
.page-content-wrapper.is-narrow { max-width: 900px; }
.page-content-wrapper.is-wide { max-width: 1200px; }

/* ── Header: the same on every page. Logo, an optional heading, then the
      stats and link pills on the right; stacked and centred on phones. ── */
.pg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin-bottom: 20px; }
.pg-logo { display: flex; background-color: var(--primary); border-radius: 16px; flex-shrink: 0; }
.pg-logo img { display: block; height: 80px; width: auto; max-width: 90vw; border-radius: 8px; }
.pg-heading { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: -.02em; color: var(--secondary); }
.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: logo and heading share a row, then the links as one row you can swipe. */
@media (max-width: 767px) {
    .pg-head { justify-content: center; gap: 10px 14px; margin-bottom: 14px; }
    .pg-logo img { height: 52px; }
    .pg-heading { font-size: 1.35rem; }
    .pg-head-end { align-items: center; 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: .8rem; white-space: nowrap; }
.analytics-pill .ap-sep { opacity: .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: 6px; background-color: var(--accent); color: var(--primary) !important; padding: 6px 12px; border-radius: 20px; text-decoration: none !important; font-size: .9rem; font-weight: 500; line-height: 1.2; box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .2s ease, box-shadow .2s ease; }
a.nw-pill:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.1); }
.nw-pill i { font-size: .9em; width: 1.1em; text-align: center; }
.nw-pill img { width: 1em; height: 1em; object-fit: contain; border-radius: 3px; }

/* ── Content blocks ── */
.content-grid { margin: 0 auto; column-gap: 15px; column-count: 1; }
@media (min-width: 768px) { .content-grid.is-columns { column-count: 2; } }
.content-grid.is-single { display: flex; justify-content: center; gap: 15px; }
.content-row { margin-bottom: 15px; }
.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: 16px; break-inside: avoid; margin-bottom: 15px; 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); }
.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,.8), 0 0 2px rgba(255,255,255,.9); }
.pg-block.is-full { background-color: var(--primary); color: var(--secondary); border-radius: 0; }
.pg-block > h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; }
.content-block-text { padding: 10px 20px 5px; }
.content-block-text.is-full { padding: 20px; }
.page-section.is-small-text .content-block-text { font-size: .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: .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; }
.photo-caption { position: absolute; bottom: 0; left: 0; width: 100%; box-sizing: border-box; padding: 10px 15px; background-color: var(--primary-alpha-80, rgba(30,30,30,.8)); color: #fff; font-size: .8rem; font-weight: 500; }
.content-block-buttons.is-card, .content-block-html.is-card { padding: 15px 20px; }
.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: .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 .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 .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: .9em; }
.pg-date { font-size: .7em; color: var(--secondary_grey); }
.pg-views { font-size: .7em; color: var(--secondary_grey); flex-shrink: 0; margin-right: 12px; display: flex; align-items: center; gap: 4px; }
.pg-views .fa-eye { opacity: .7; }
.pg-tag { font-size: .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: 14px; }
.nw-card { --card-accent: var(--accent); position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; border-radius: 20px; overflow: hidden; isolation: isolate; color: #fff !important; text-decoration: none !important; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 18px -8px rgba(0,0,0,.25); transition: transform .25s ease, box-shadow .25s ease; }
.nw-card.is-wide { grid-column: span 2; }
.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,.08), 0 18px 36px -12px color-mix(in srgb, var(--card-accent) 70%, rgba(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 the play badge in the middle */
.nw-card-play { position: absolute; inset: 0 0 30% 0; z-index: 0; display: grid; place-items: center; font-size: 3.4rem; color: #ff0033; pointer-events: none; transition: transform .3s ease; }
.nw-card-play i { background: radial-gradient(circle, #fff 34%, transparent 35%); }
.nw-card:hover .nw-card-play { transform: scale(1.1); }
/* Instagram: a light tile with the site's newest photos as a little profile grid */
.nw-card.has-instagram { background: var(--primary); color: var(--secondary) !important; }
.nw-card-ig { position: absolute; inset: 8px 8px 32% 8px; z-index: -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 3px; overflow: hidden; }
.nw-card.is-wide .nw-card-ig { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.nw-card-ig > span { overflow: hidden; border-radius: 6px; }
.nw-card-ig img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.nw-card:hover .nw-card-ig img { transform: scale(1.08); }
.nw-card.has-instagram .nw-card-text { text-shadow: none; }
.nw-card.has-instagram .nw-card-go { background: color-mix(in srgb, var(--secondary) 8%, transparent); }
.nw-card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .6s ease, opacity .6s ease; }
.nw-cards.is-fading .nw-card-img:not(.is-loaded) { opacity: 0; }   /* pages.js: fade in once loaded */
.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,.78) 0%, rgba(0,0,0,.35) 38%, rgba(0,0,0,0) 62%), linear-gradient(to bottom, rgba(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: .16; transform: rotate(-12deg); transition: transform .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 .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,.25); }
.nw-card.has-colour .nw-card-icon { background: rgba(255,255,255,.2); box-shadow: none; }
.nw-card-go { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: .85rem; transition: background .25s ease, color .25s ease, transform .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,.35); }
.nw-card-text b { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.nw-card.is-big .nw-card-text b { font-size: 1.9rem; }
.nw-card-blurb { font-size: .86rem; line-height: 1.4; opacity: .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 { 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(.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: -.02em; }
.nw-gh-label { color: #8b949e; font-size: clamp(.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 * .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) * .2); transform-origin: right top; transition: transform .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 * .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 * .3 / 8.2)); } }
.nw-card.has-github::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(13,17,23,.92) 0%, rgba(13,17,23,.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 .8s ease; }
.nw-card:hover .nw-bn-flock { transform: translate(-6%, -8%); }
.nw-bn-head { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .75; font-size: clamp(.62rem, 3.6cqw, .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 .8em; box-sizing: border-box; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.33); font-size: clamp(.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,.6) 0%, rgba(0,0,0,.2) 30%, rgba(0,0,0,0) 50%); }
