/* Catalog style "demo39" — the album as a dark bento: one 12 px gap, 18 px tiles, glass panels over #18171a with a green glow, Poppins + Lato, big serif numerals. Mirrors /demo39/. */
/*
 * Layout: the masthead is a bento row (a 2×2 text tile with the brand, a tagline tile and a
 * numeral tile with the demo count). The style bar and categories are glass tiles. The list is a
 * dense four-column bento: the newest post as a 2×2 feature, every fourth one wide (2×1), the rest
 * square-ish tiles with the screenshot on top and a glass caption below. One post = a stack of
 * glass tiles: header, screenshot, doc, rating, tags, comments.
 */
@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Poppins:wght@500;600&family=DM+Serif+Display&display=swap");

:root {
    --bg: #18171a;
    --tile: rgb(34 33 38 / 0.62);
    --tile-2: rgb(44 43 50 / 0.7);
    --line: rgb(255 255 255 / 0.12);
    --line-2: rgb(255 255 255 / 0.24);
    --ink: #fff;
    --ink-2: rgb(255 255 255 / 0.72);
    --ink-3: rgb(255 255 255 / 0.56);
    --yellow: #ffb500;
    --green: #469a58;
    --green-2: #53b167;
    --spot: #53f57e;
    --r: 18px;
    --gap: 12px;
    --head: "Poppins", "Lato", system-ui, sans-serif;
    --text: "Lato", system-ui, sans-serif;
    --num: "DM Serif Display", Georgia, serif;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    overflow-x: clip;
    background:
        radial-gradient(circle 40vmax at 82% 12%, rgb(83 245 126 / 0.13), transparent 70%),
        radial-gradient(circle 46vmax at 10% 70%, rgb(83 245 126 / 0.09), transparent 70%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    font: 400 16px/1.6 var(--text);
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
code { font: 500 0.88em/1.45 ui-monospace, "SF Mono", Menlo, monospace; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
::selection { background: rgb(255 181 0 / 0.35); }

.skip { position: absolute; left: -9999px; top: 10px; z-index: 50; padding: 10px 18px; border-radius: 999px; background: var(--yellow); color: #18171a; font-weight: 700; text-decoration: none; }
.skip:focus { left: 16px; }
.deco { display: none; }

.page { max-width: 1400px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 40px) 0; }

/* glass tile, shared look */
.masthead__inner > *, .stylebar, .categories, .tagcloud, .post--card, .post__header, .post__shot, .post__doc, .notice, .post__nav-link, .comment, .comment-form {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--tile);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
}

/* ── masthead: a bento row ─────────────────────────────────────────────────────────────────── */
.masthead__inner { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: auto; gap: var(--gap); }
.brand { display: flex; flex-direction: column; justify-content: flex-end; min-height: 240px; padding: 28px 30px; text-decoration: none; }
.brand__name { order: -1; margin-bottom: auto; display: flex; align-items: center; gap: 10px; font: 700 11px/1 var(--text); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2); }
.brand__name::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--spot); box-shadow: 0 0 12px rgb(83 245 126 / 0.8); }
.brand__mark { font: 600 clamp(64px, 9vw, 128px)/0.86 var(--head); letter-spacing: -0.055em; }
.masthead__tagline { display: flex; align-items: flex-end; margin: 0; padding: 24px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.masthead__count { display: flex; flex-direction: column; justify-content: space-between; margin: 0; padding: 24px; color: var(--ink-3); font: 700 11px/1.3 var(--text); letter-spacing: 0.2em; text-transform: uppercase; }
.masthead__num { order: -1; font: 400 clamp(64px, 7vw, 104px)/0.85 var(--num); letter-spacing: -0.02em; color: var(--yellow); text-transform: none; }

/* ── style bar ─────────────────────────────────────────────────────────────────────────────── */
.stylebar { margin-top: var(--gap); padding: 16px 18px; }
.stylebar__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.stylebar__label { font: 700 11px/1 var(--text); letter-spacing: 0.22em; text-transform: uppercase; color: var(--yellow); }
.stylebar__value { flex: 1 1 280px; min-width: 0; padding: 9px 14px; overflow-x: auto; white-space: nowrap; border: 1px solid var(--line); border-radius: 12px; background: rgb(0 0 0 / 0.25); color: var(--ink); }
.stylebar__copy { min-height: 40px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--green); color: #fff; font: 500 14px/1 var(--head); cursor: pointer; }
.stylebar__copy:hover { background: var(--green-2); }
.stylebar__copy.is-done { background: var(--yellow); color: #18171a; }
.stylebar__list { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.stylebar__item { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.stylebar__item:hover { border-color: var(--line-2); color: #fff; }
.stylebar__item.is-active { border-color: var(--yellow); background: var(--yellow); color: #18171a; font-weight: 700; }
.stylebar__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; width: 100%; font-size: 13px; color: var(--ink-2); }
.stylebar__guide, .stylebar__download { color: var(--ink-2); text-underline-offset: 3px; }
.stylebar__guide:hover, .stylebar__download:hover { color: #fff; }

/* ── categories ────────────────────────────────────────────────────────────────────────────── */
.categories { margin-top: var(--gap); padding: 10px; }
.categories__list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.categories__link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 12px; font: 500 14px/1 var(--head); color: var(--ink-2); text-decoration: none; }
.categories__link:hover { background: rgb(255 255 255 / 0.06); color: #fff; }
.categories__link.is-active { background: #fff; color: #18171a; }
.categories__count { font: 700 11px/1 var(--text); opacity: 0.65; }

/* ── listing ───────────────────────────────────────────────────────────────────────────────── */
.content { padding: clamp(48px, 6vw, 88px) 0 64px; }
.listing__header { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 24px; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2); }
.listing__title { margin: 0; font: 600 clamp(32px, 4vw, 52px)/1 var(--head); letter-spacing: -0.035em; }
.listing__intro { grid-column: 1 / -1; max-width: 62ch; margin: 0; color: var(--ink-2); }
.toolbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; }
.toolbar p { margin: 0; }
.toolbar__view { display: flex; align-items: center; gap: 4px; }
.toolbar__label { margin-right: 6px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 11px; }
.toolbar__opt { min-width: 34px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2); text-align: center; text-decoration: none; }
.toolbar__opt.is-active { border-color: #fff; background: #fff; color: #18171a; }

.listing { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: var(--gap); }
.post--card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; transition: border-color 0.4s ease, background-color 0.4s ease; }
.post--card:hover { border-color: var(--line-2); background: var(--tile-2); }
.post__media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; margin: 6px 6px 0; border-radius: calc(var(--r) - 6px); background: rgb(255 255 255 / 0.04); }
.post__thumb { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); }
.post--card:hover .post__thumb { transform: scale(1.045); }
.post__body { display: flex; flex: 1; flex-direction: column; padding: 16px 18px 18px; }
.post__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; color: var(--ink-3); font: 700 10.5px/1.3 var(--text); letter-spacing: 0.16em; text-transform: uppercase; }
.post__num { color: var(--yellow); }
.post__cat { text-decoration: none; }
.post__cat:hover { color: #fff; }
.post__title { margin: 0 0 8px; font: 600 21px/1.15 var(--head); letter-spacing: -0.015em; }
.post__title a { text-decoration: none; }
.post__title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.post__excerpt { margin: 0 0 16px; color: var(--ink-2); font-size: 14.5px; line-height: 1.5; }
.post__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: auto 0 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; background: none; color: #fff; font: 500 13.5px/1 var(--head); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: rgb(255 255 255 / 0.5); background: rgb(255 255 255 / 0.05); }
.btn--primary { border-color: var(--green); background: var(--green); }
.btn--primary:hover { border-color: var(--green-2); background: var(--green-2); }

/* the bento: the newest post 2×2, every sixth from the fourth wide */
.post--card:first-child { grid-column: span 2; grid-row: span 2; }
.post--card:first-child .post__media { flex: 1; aspect-ratio: auto; min-height: 320px; }
.post--card:first-child .post__title { font-size: clamp(28px, 2.8vw, 40px); line-height: 1.02; letter-spacing: -0.03em; }
.post--card:first-child .post__excerpt { font-size: 16px; max-width: 56ch; }
.post--card:nth-child(6n+4) { grid-column: span 2; }
.post--card:nth-child(6n+4) .post__media { aspect-ratio: 2 / 1; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 36px; }
.pager__link { min-width: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); color: var(--ink-2); text-align: center; text-decoration: none; }
.pager__link:hover { border-color: var(--line-2); color: #fff; }
.pager__link.is-active { border-color: #fff; background: #fff; color: #18171a; }

/* ── one post: a stack of tiles ────────────────────────────────────────────────────────────── */
.post--full { max-width: 1080px; margin: 0 auto; }
.post__header { padding: clamp(24px, 3vw, 40px); margin-bottom: var(--gap); }
.post--full .post__title { font-size: clamp(40px, 6vw, 80px); line-height: 0.95; letter-spacing: -0.045em; margin-bottom: 14px; }
.post--full .post__excerpt { max-width: 62ch; font-size: 18px; }
.post__shot { margin: 0 0 var(--gap); padding: 6px; }
.post__zoom { display: block; max-height: 720px; overflow: hidden; border-radius: calc(var(--r) - 6px); cursor: zoom-in; }
.post__zoom img { width: 100%; }
.post__caption { padding: 10px 10px 6px; color: var(--ink-3); font-size: 13px; }
.post__doc { padding: clamp(22px, 3vw, 40px); }
.doc { font-size: 16.5px; color: rgb(255 255 255 / 0.86); }
.doc h2 { margin: 40px 0 12px; font: 600 26px/1.15 var(--head); letter-spacing: -0.02em; color: #fff; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { margin: 28px 0 8px; font: 600 19px/1.2 var(--head); color: #fff; }
.doc h4, .doc h5, .doc h6 { margin: 22px 0 6px; font: 600 16px/1.3 var(--head); }
.doc p, .doc ul, .doc ol { margin: 0 0 14px; }
.doc a { color: var(--yellow); text-underline-offset: 3px; }
.doc code { padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / 0.08); }
.doc pre { margin: 0 0 18px; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgb(0 0 0 / 0.35); color: #e8eee9; }
.doc pre code { padding: 0; background: none; }
.doc blockquote { margin: 0 0 18px; padding: 4px 0 4px 18px; border-left: 2px solid var(--yellow); color: var(--ink-2); }
.doc hr { margin: 30px 0; border: 0; border-top: 1px solid var(--line); }
.doc-table { margin: 0 0 18px; overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th, .doc td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { font: 700 11px/1.3 var(--text); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 0; padding: 0; list-style: none; }
.tags__item { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--ink-2); }
.post__nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-top: var(--gap); }
.post__nav-link { padding: 18px 20px; font: 600 17px/1.25 var(--head); text-decoration: none; }
.post__nav-link:hover { border-color: var(--line-2); }
.post__nav-link--older { grid-column: 2; text-align: right; }
.post__nav-label { display: block; margin-bottom: 4px; color: var(--yellow); font: 700 10.5px/1 var(--text); letter-spacing: 0.18em; text-transform: uppercase; }
.post__back { display: inline-block; margin-top: 18px; color: var(--ink-2); }

.notice { padding: 20px 24px; }
.notice--error { border-color: rgb(239 68 68 / 0.6); color: #fecaca; }

.colophon { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.colophon p { margin: 0; }
.colophon a:hover { color: #fff; }

/* screenshot dialog */
.zoom { width: min(1480px, 96vw); max-width: none; height: 94vh; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: #111013; color: #fff; }
.zoom::backdrop { background: rgb(10 10 12 / 0.84); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.zoom__bar { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 10px; background: #111013; }
.zoom__close { min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: #fff; color: #18171a; font: 500 14px/1 var(--head); cursor: pointer; }
.zoom__scroll { height: calc(94vh - 62px); overflow: auto; }
.zoom__img { width: 100%; }

@media (max-width: 1100px) {
    .listing { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .post--card:nth-child(6n+4) { grid-column: span 1; }
    .post--card:nth-child(6n+4) .post__media { aspect-ratio: 4 / 3; }
}
@media (max-width: 860px) {
    .masthead__inner { grid-template-columns: 1fr 1fr; }
    .brand { grid-column: 1 / -1; min-height: 200px; }
    .listing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .post--card:first-child .post__media { min-height: 260px; }
}
@media (max-width: 560px) {
    .page { padding-inline: 16px; }
    .masthead__inner { grid-template-columns: 1fr; }
    .listing { grid-template-columns: 1fr; }
    .post--card:first-child { grid-column: auto; grid-row: auto; }
    .post--card:first-child .post__media { flex: none; aspect-ratio: 4 / 3; min-height: 0; }
    .post__nav { grid-template-columns: 1fr; }
    .post__nav-link--older { grid-column: auto; text-align: left; }
    .listing__header { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* long words and URLs 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%; }
