:root {
  --bg: #f2efe8; --ink: #151412; --muted: #6f6a60; --line: #d9d4c8; --card: #faf8f3; --accent: #e4572e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: inherit; }

.gallery { max-width: 1240px; margin: 0 auto; padding: 72px 32px 40px; }
.masthead h1 { font: 400 clamp(48px, 9vw, 104px)/0.95 var(--serif); letter-spacing: -0.03em; margin: 0 0 20px; }
.masthead h1 span { font-style: italic; color: var(--accent); }
.masthead p { max-width: 46ch; margin: 0 0 24px; color: var(--muted); font-size: 17px; }
.sections { display: flex; gap: 8px; margin: 0 0 56px; }
.sections a { display: inline-flex; align-items: baseline; gap: 7px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; text-decoration: none; background: var(--card); transition: border-color .15s ease, color .15s ease; }
.sections a span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sections a:hover { color: var(--accent); border-color: var(--accent); }
.sections a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.section { scroll-margin-top: 32px; }
.section + .section { margin-top: 88px; padding-top: 32px; border-top: 1px solid var(--line); }
.section-title { margin: 0 0 28px; font: 400 clamp(32px, 5vw, 48px)/1 var(--serif); letter-spacing: -0.02em; }
.section-title em { color: var(--accent); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px 24px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card { display: flex; flex-direction: column; }
.thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.card:hover .thumb img, .thumb:focus-visible img { transform: scale(1.03); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 2px 0; }
.meta h2 { margin: 0; font: 400 24px/1.1 var(--serif); }
.meta h2 a { text-decoration: none; }
.meta .src { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 1px solid var(--line); }
.meta .src:hover { color: var(--accent); border-color: var(--accent); }
.tag { margin: 4px 2px 0; color: var(--muted); }
.empty { color: var(--muted); }

/* Video cards: the frame is the video's own 16:9, with a play mark and the platform. */
.card--video .thumb { position: relative; aspect-ratio: 16 / 9; background: var(--ink); }
.card--video .thumb img { object-position: center; }
.card--video .meta h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* A small play mark in the corner, so the poster reads first; it warms to the accent on hover. */
.play { position: absolute; left: 10px; bottom: 10px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(21, 20, 18, 0.45); color: var(--bg); padding-left: 2px; backdrop-filter: blur(6px); transition: background .2s ease, transform .2s ease; }
.play svg { width: 14px; height: 14px; }
.card--video:hover .play, .card--video .thumb:focus-visible .play { background: var(--accent); transform: scale(1.1); }
.meta .src--icon { display: inline-flex; align-self: flex-start; margin-top: 3px; border: 0; transition: color .15s ease; }
.meta .src--icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.foot { margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.viewer { position: fixed; inset: 0; background: #fff; }
#frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
/* Videos play centred on a dark ground: YouTube at the largest 16:9 that fits, an X post at its own width. */
.viewer[data-kind="youtube"], .viewer[data-kind="x"] { display: grid; place-items: center; background: #0d0c0b; }
.viewer[data-kind="youtube"] #frame { width: min(100vw - 48px, (100vh - 112px) * 16 / 9); height: auto; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.viewer[data-kind="x"] #frame { width: min(100vw - 24px, 560px); height: calc(100vh - 96px); margin-bottom: 48px; background: transparent; color-scheme: normal; }

/* Two floating buttons over the full-screen preview. */
.float { position: fixed; left: 20px; bottom: 20px; z-index: 10; display: flex; gap: 8px; }
.fab { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px 0 13px; border-radius: 999px; font: 500 14px/1 var(--sans); text-decoration: none; background: var(--card); color: var(--ink); border: 1px solid rgba(21, 20, 18, 0.1); box-shadow: 0 1px 2px rgba(21, 20, 18, 0.1), 0 6px 18px rgba(21, 20, 18, 0.16); transition: background .15s ease, color .15s ease, transform .15s ease; }
.fab svg { flex: none; }
.fab:hover { color: var(--accent); }
.fab:active { transform: translateY(1px); }
.fab--dark { background: var(--ink); color: var(--bg); border-color: rgba(242, 239, 232, 0.16); }
.fab--dark:hover { background: var(--accent); color: #fff; }
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 720px) {
  .gallery { padding: 40px 18px 28px; }
  .grid { grid-template-columns: 1fr; }
  .viewer[data-kind="youtube"] #frame { width: 100vw; border-radius: 0; }
  .float { left: 12px; bottom: 12px; }
  .fab { height: 36px; padding: 0 14px 0 11px; font-size: 13px; }
}
