/* Catalog style "demo19" — the album as pages that drop over each other: every post a rounded card with its slot label, stacking as you scroll, on home3 green and grey. Mirrors /demo19/. */
@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;700;900&display=swap");

:root {
    --ground: #e8ebe4;
    --paper: #f4f6f1;
    --ink: #121612;
    --soft: #4a524b;
    --deep: #0f2a1a;
    --green: #2f7d43;
    --yellow: #ffb500;
    --on-deep: #c9d3cb;
    --font: "Schibsted Grotesk", system-ui, sans-serif;
    --edge: clamp(16px, 3vw, 48px);
    --radius: 28px;
    --ease: cubic-bezier(.3, .9, .2, 1);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--ground); color: var(--ink); font: 400 17px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
code { font: 500 0.86em/1.4 ui-monospace, "SF Mono", Menlo, monospace; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
:where(.masthead, .stylebar, .post--even, .post__nav, .colophon, .zoom, .post--full .post__header) :focus-visible { outline-color: var(--yellow); }

.skip { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 16px; border-radius: 6px; background: var(--yellow); color: var(--ink); transform: translateY(-200%); }
.skip:focus { transform: none; }
.deco { display: none; }

.page { max-width: 1560px; margin: 0 auto; padding: 0 var(--edge); }

/* ── masthead: a deep green card, the first page of the deck ──────────────────────────────── */
.masthead { margin: var(--edge) 0 0; padding: clamp(28px, 5vw, 64px); border-radius: var(--radius); background: var(--deep); color: #f1f3ee; }
.masthead__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand count" "tag tag"; align-items: end; gap: 24px 32px; }
.brand { grid-area: brand; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 20px; text-decoration: none; }
.brand__mark { font: 900 clamp(72px, 12vw, 180px)/0.8 var(--font); letter-spacing: -0.06em; }
.brand__name { padding-bottom: 0.4em; font: 700 clamp(20px, 2.2vw, 30px)/1 var(--font); letter-spacing: -0.02em; color: var(--yellow); }
.masthead__tagline { grid-area: tag; max-width: 46ch; margin: 0; color: var(--on-deep); font-size: 19px; }
.masthead__count { grid-area: count; margin: 0; color: var(--on-deep); font-size: 15px; text-align: right; }
.masthead__num { display: block; font: 900 clamp(48px, 5vw, 72px)/0.9 var(--font); letter-spacing: -0.04em; color: #f1f3ee; }

/* ── style bar: the switch pill ───────────────────────────────────────────────────────────── */
.stylebar { margin: 14px 0 0; }
.stylebar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px; border-radius: 22px; background: rgb(15 42 26 / 0.92); color: #f1f3ee; }
.stylebar__label { padding: 0 8px 0 10px; font: 700 14px/1 var(--font); color: var(--yellow); }
.stylebar__value { flex: 1 1 240px; min-width: 0; padding: 10px 14px; overflow-x: auto; white-space: nowrap; border-radius: 14px; background: rgb(255 255 255 / 0.08); }
.stylebar__copy { min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: #f1f3ee; color: var(--ink); font: 700 15px/1 var(--font); cursor: pointer; transition: background 250ms ease; }
.stylebar__copy:hover { background: var(--yellow); }
.stylebar__copy.is-done { background: var(--yellow); }
.stylebar__list { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; padding: 2px 4px 4px; }
.stylebar__item { padding: 7px 12px; border-radius: 999px; font: 500 13px/1 var(--font); color: var(--on-deep); text-decoration: none; }
.stylebar__item:hover { color: #fff; }
.stylebar__item.is-active { background: #f1f3ee; color: var(--ink); }

/* ── categories: slot labels, numbered ────────────────────────────────────────────────────── */
.categories { margin: 40px 0 0; counter-reset: cat; }
.categories__list { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0; padding: 0; list-style: none; }
.categories__item { counter-increment: cat; }
.categories__link { display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 10px 0; font: 700 18px/1.2 var(--font); text-decoration: none; border-bottom: 3px solid transparent; }
.categories__link::before { content: counter(cat, decimal-leading-zero); font-variant-numeric: tabular-nums; color: var(--green); }
.categories__link:hover { border-bottom-color: #c3cbbf; }
.categories__link.is-active { border-bottom-color: var(--yellow); }
.categories__count { font: 500 13px/1 var(--font); color: var(--soft); }

/* ── listing header ───────────────────────────────────────────────────────────────────────── */
.content { padding: 28px 0 0; }
.listing__header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px 32px; margin-bottom: 36px; padding-top: 24px; border-top: 2px solid var(--ink); }
.listing__title { margin: 0; font: 900 clamp(44px, 6vw, 96px)/0.88 var(--font); letter-spacing: -0.055em; }
.listing__intro { grid-column: 1; max-width: 50ch; margin: 0; color: var(--soft); font-size: 18px; }
.toolbar { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; color: var(--soft); font-size: 15px; }
.toolbar p { margin: 0; }
.toolbar__view { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: var(--paper); }
.toolbar__label { padding: 0 8px; }
.toolbar__opt { min-width: 40px; padding: 8px 10px; border-radius: 999px; font-weight: 700; text-align: center; text-decoration: none; }
.toolbar__opt:hover { background: var(--ground); }
.toolbar__opt.is-active { background: var(--ink); color: #fff; }

/* ── the stack: each post drops over the one before ───────────────────────────────────────── */
.listing { display: flex; flex-direction: column; gap: 36px; counter-reset: slot; }
.post--card {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); grid-template-rows: auto 1fr;
    padding: 18px; border-radius: var(--radius); background: var(--paper); counter-increment: slot;
    box-shadow: 0 -18px 50px -30px rgb(15 42 26 / 0.5);
}
.post--even { background: var(--deep); color: #f1f3ee; }
@media (min-width: 900px) and (min-height: 720px) {
    .post--card { position: sticky; top: 24px; max-height: calc(100vh - 48px); }
    .listing { padding-bottom: 12vh; }
}
/* the slot label above the card, as in the deck transition: "01 Site decks" */
.post--card .post__meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0; padding: 4px 8px 16px; font: 700 14px/1.2 var(--font); }
.post--card .post__num { font-size: 0; }
.post--card .post__num::before { content: counter(slot, decimal-leading-zero); font: 900 15px/1 var(--font); font-variant-numeric: tabular-nums; color: var(--green); }
.post--even .post__num::before { color: var(--yellow); }
.post__cat { text-decoration: none; }
.post__cat:hover { text-decoration: underline; text-underline-offset: 3px; }
.post__date { margin-left: auto; font-weight: 500; color: var(--soft); }
.post--even .post__date { color: #a9b8ad; }

.post__body { grid-row: 2; grid-column: 1; display: flex; flex-direction: column; padding: clamp(8px, 2vw, 28px) clamp(10px, 2.4vw, 36px) clamp(10px, 2vw, 24px) 8px; }
.post__media { grid-row: 2; grid-column: 2; display: block; overflow: hidden; border-radius: calc(var(--radius) - 10px); background: #d5dbd2; }
.post__thumb { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; transition: transform 1100ms var(--ease); }
.post--card:hover .post__thumb { transform: scale(1.03) translateY(-1%); }
.post__title { margin: 0 0 16px; font: 900 clamp(36px, 4.4vw, 76px)/0.9 var(--font); letter-spacing: -0.05em; text-wrap: balance; }
.post__title a { text-decoration: none; }
.post__title a:hover { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }
.post__excerpt { max-width: 44ch; margin: 0 0 24px; color: var(--soft); font-size: 18px; text-wrap: pretty; }
.post--even .post__excerpt { color: var(--on-deep); }
.post__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: auto 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border-radius: 999px; font: 700 15px/1 var(--font); text-decoration: none; transition: background 250ms ease, color 250ms ease; }
.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: var(--ink); color: #fff; }
.post--even .btn--primary:hover { background: #fff; color: var(--ink); }
.post__more { padding: 0 22px; box-shadow: inset 0 0 0 2px currentColor; }
.post__more:hover { background: var(--ink); color: #fff; box-shadow: none; }
.post--even .post__more:hover { background: #fff; color: var(--ink); }

/* ── pager ────────────────────────────────────────────────────────────────────────────────── */
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; width: fit-content; max-width: 100%; margin: 48px auto 0; padding: 4px; border-radius: 999px; background: rgb(15 42 26 / 0.92); }
.pager__link { min-width: 44px; padding: 12px 14px; border-radius: 999px; font: 700 15px/1 var(--font); color: var(--on-deep); text-align: center; text-decoration: none; }
.pager__link:hover { color: #fff; }
.pager__link.is-active { background: #f1f3ee; color: var(--ink); }
.pager__link:focus-visible { outline-color: var(--yellow); outline-offset: -3px; }

/* ── one post: a page that fell out from under the header ─────────────────────────────────── */
.post--full { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.post--full .post__header { padding: clamp(28px, 5vw, 64px); border-radius: var(--radius); background: var(--paper); }
.post--full .post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 18px; font: 700 14px/1.2 var(--font); }
.post--full .post__num { color: var(--green); }
.post--full .post__date { margin-left: 0; }
.post--full .post__title { max-width: 15ch; margin-bottom: 20px; font-size: clamp(54px, 8vw, 128px); line-height: 0.86; letter-spacing: -0.06em; }
.post--full .post__excerpt { max-width: 58ch; font-size: 20px; }
.post--full .post__back { box-shadow: inset 0 0 0 2px var(--ink); }
.post--full .post__back:hover { background: var(--ink); color: #fff; }

.post__shot { margin: 0; padding: 18px 18px 14px; border-radius: var(--radius); background: var(--deep); }
.post__zoom { display: block; max-height: 760px; overflow: hidden; border-radius: calc(var(--radius) - 10px); cursor: zoom-in; }
.post__zoom img { width: 100%; }
.post__caption { margin: 12px 6px 0; color: var(--on-deep); font-size: 14px; }

.doc { padding: clamp(28px, 5vw, 64px) clamp(20px, 6vw, 96px); border-radius: var(--radius); background: var(--paper); font-size: 18px; }
.doc > * { max-width: 860px; }
/* docs write "## Section", which the renderer prints as <h3>: h2 and h3 are both section heads */
.doc { counter-reset: sec; }
.doc h2, .doc h3 { counter-increment: sec; display: flex; align-items: baseline; gap: 14px; margin: 56px 0 14px; padding-top: 16px; border-top: 2px solid var(--ink); font: 900 clamp(30px, 3.4vw, 48px)/0.95 var(--font); letter-spacing: -0.045em; }
.doc h2::before, .doc h3::before { content: counter(sec, decimal-leading-zero); font-size: 0.4em; letter-spacing: 0; color: var(--green); }
.doc h2:first-child, .doc h3:first-child { margin-top: 0; }
.doc h4 { margin: 30px 0 8px; font: 700 21px/1.2 var(--font); }
.doc h5, .doc h6 { margin: 22px 0 6px; font: 700 17px/1.3 var(--font); }
.doc p, .doc ul, .doc ol { margin: 0 0 16px; }
.doc li { margin-bottom: 6px; }
.doc li::marker { color: var(--green); }
.doc a { color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.doc a:hover { color: var(--ink); }
.doc code { padding: 2px 6px; border-radius: 6px; background: #e1e6dd; overflow-wrap: anywhere; }
.doc pre { margin: 0 0 20px; padding: 18px 20px; overflow-x: auto; border-radius: 18px; background: var(--deep); color: #e8efe9; }
.doc pre code { padding: 0; background: none; overflow-wrap: normal; }
.doc blockquote { margin: 0 0 20px; padding: 18px 22px; border-radius: 18px; background: var(--deep); color: #eef2ec; }
.doc blockquote p:last-child { margin-bottom: 0; }
.doc blockquote code { background: rgb(255 255 255 / 0.12); }
.doc hr { margin: 40px 0; border: 0; border-top: 2px solid #d3d9d0; }
.doc-table { margin: 0 0 20px; overflow-x: auto; border-radius: 18px; box-shadow: inset 0 0 0 2px #dfe4dc; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc th, .doc td { padding: 11px 14px; border-bottom: 1px solid #dfe4dc; text-align: left; vertical-align: top; }
.doc th { font-weight: 700; background: #e1e6dd; }
.doc tbody tr:last-child td { border-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags__item { padding: 7px 14px; border-radius: 999px; background: var(--paper); font: 700 14px/1.2 var(--font); }

.post__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.post__nav-link { display: block; padding: 24px 28px; border-radius: var(--radius); background: var(--deep); color: #f1f3ee; font: 900 clamp(24px, 2.6vw, 36px)/1 var(--font); letter-spacing: -0.04em; text-decoration: none; transition: background 250ms ease; }
.post__nav-link:hover { background: var(--green); }
.post__nav-link--older { grid-column: 2; text-align: right; }
.post__nav-label { display: block; margin-bottom: 8px; color: var(--yellow); font: 700 14px/1 var(--font); letter-spacing: 0; }

/* ── notice, colophon ─────────────────────────────────────────────────────────────────────── */
.notice { padding: 28px 32px; border-radius: var(--radius); background: var(--paper); font-size: 19px; }
.notice p { margin: 0; }
.notice a { color: var(--green); }
.notice--error { background: #fbe9e7; color: #8e2a1f; }

.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; margin: 64px 0 var(--edge); padding: 22px 28px; border-radius: var(--radius); background: var(--deep); color: var(--on-deep); font-size: 14px; }
.colophon p { margin: 0; }
.colophon code { color: #fff; }
.colophon a { color: var(--yellow); }

/* ── screenshot dialog ────────────────────────────────────────────────────────────────────── */
.zoom { width: min(1480px, 96vw); max-width: none; height: 94vh; max-height: none; padding: 0; border: 0; border-radius: var(--radius); background: var(--deep); color: #fff; }
.zoom[open] { animation: drop 640ms var(--ease) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-40px) scale(0.96); } to { opacity: 1; transform: none; } }
.zoom::backdrop { background: rgb(15 42 26 / 0.72); }
.zoom__bar { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 12px; background: var(--deep); }
.zoom__close { min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--yellow); color: var(--ink); font: 700 15px/1 var(--font); cursor: pointer; }
.zoom__scroll { height: calc(94vh - 68px); overflow: auto; }
.zoom__img { width: 100%; }

@media (max-width: 899px) {
    .post--card { grid-template-columns: 1fr; grid-template-rows: auto auto auto; padding: 12px; }
    .post__media { grid-row: 2; grid-column: 1; }
    .post__body { grid-row: 3; padding: 20px 8px 8px; }
    .post__date { margin-left: 0; }
}
@media (max-width: 640px) {
    :root { --radius: 22px; }
    .masthead__inner { grid-template-columns: 1fr; grid-template-areas: "brand" "tag" "count"; }
    .masthead__count { text-align: left; }
    .listing__header { grid-template-columns: 1fr; }
    .toolbar { grid-column: 1; grid-row: auto; align-items: flex-start; }
    .post__nav { grid-template-columns: 1fr; }
    .post__nav-link--older { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* long words and URLs in the doc and comments wrap instead of widening the page */
.doc p, .doc li, .doc blockquote, .doc td, .doc th, .comment__body { overflow-wrap: anywhere; }
.doc pre, .doc-table { max-width: 100%; }
