/* Look borrowed from glosse.me: Luxi Mono, same light/dark colours, small bordered buttons. */
@font-face { font-family: "Luxi Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/luxi-mono/luximr.ttf") format("truetype"); }
@font-face { font-family: "Luxi Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/luxi-mono/luximb.ttf") format("truetype"); }
@font-face { font-family: "Luxi Mono"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/luxi-mono/luximri.ttf") format("truetype"); }

:root {
  --bg: #fafafa;
  --fg: #111111;
  --muted: #6b7280;
  --border: #e5e5e5;
  --card: #ffffff;
  --mono: "Luxi Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --gap: 12px;
}
[data-theme="dark"] {
  --bg: #0d0d0d;
  --fg: #eaeaea;
  --muted: #8a8a8a;
  --border: #262626;
  --card: #151515;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: var(--mono); transition: background .2s ease, color .2s ease; }
body { min-height: 100vh; display: flex; flex-direction: column; font-size: 14px; line-height: 1.6; }
main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 var(--gap) 3rem; }
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: .5rem; background: var(--bg); padding: .3rem .6rem; border: 1px solid var(--border); z-index: 10; }
.dim { color: var(--muted); }
.empty { color: var(--muted); }
code { font-family: inherit; border: 1px solid var(--border); border-radius: 4px; padding: 0 .3em; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem var(--gap);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: .95rem; text-decoration: none; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.bar-nav { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; justify-content: flex-end; }
.bar-nav a { color: var(--muted); text-decoration: none; font-size: .85rem; }
.bar-nav a:hover, .bar-nav a:focus-visible { color: var(--fg); }
.bar-nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; }
.layout-switch { display: inline-flex; gap: 2px; }
.layout-switch[hidden] { display: none; }
.bar-nav button {
  background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px;
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font: inherit; font-size: .85rem;
}
.bar-nav button:hover { border-color: var(--muted); color: var(--fg); }
.bar-nav button[aria-pressed="true"] { color: var(--fg); border-color: var(--fg); }

/* ---------- tiles: masonry (JS columns) and neat grid ---------- */
.tiles { padding-top: var(--gap); }
.tiles[data-layout="masonry"] { display: flex; gap: var(--gap); align-items: flex-start; }
.tiles[data-layout="masonry"] > .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
/* before JS arranges columns (or with no JS) tiles just stack */
.tiles[data-layout="masonry"]:not(.ready) { display: block; column-count: 2; column-gap: var(--gap); }
.tiles[data-layout="masonry"]:not(.ready) > .tile { break-inside: avoid; margin-bottom: var(--gap); }
.tiles[data-layout="grid"] { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.tile { position: relative; display: block; text-decoration: none; background: var(--card); border: 1px solid var(--border); overflow: hidden; }
.tile img { width: 100%; height: auto; aspect-ratio: var(--ar); object-fit: cover; transition: opacity .2s ease; }
.tile:hover img { opacity: .88; }
.tiles[data-layout="grid"] .tile { aspect-ratio: 1 / 1; }
.tiles[data-layout="grid"] .tile img { height: 100%; aspect-ratio: auto; }
.badge { position: absolute; left: 0; top: 0; background: var(--bg); color: var(--fg); font-size: .72rem; padding: .1rem .45rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tile-text { padding: .9rem 1rem; min-height: 7rem; }
.tile-text time { display: block; color: var(--muted); font-size: .72rem; margin-bottom: .4rem; }
.tile-text p { margin: 0; font-size: .85rem; overflow-wrap: anywhere; }
.more { text-align: center; color: var(--muted); padding: 2rem 0; min-height: 3rem; font-size: .8rem; }

/* ---------- post page ---------- */
.post { max-width: 760px; margin: 0 auto; padding-top: 1.5rem; }
.post-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; color: var(--muted); font-size: .85rem; }
.post-head .back { text-decoration: none; font-size: 1.1rem; color: var(--fg); }
.post-body img { margin: 0 auto 1rem; cursor: zoom-in; border: 1px solid var(--border); }
.post-body p { margin: 0 0 1rem; overflow-wrap: anywhere; }
.post-body blockquote { margin: 0 0 1rem; padding-left: 1rem; border-left: 2px solid var(--border); color: var(--muted); }
.post-body blockquote img { border: 0; }
.post-foot { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--border); font-size: .85rem; }
.terms { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.terms a { color: var(--muted); text-decoration: none; }
.terms a:hover { color: var(--fg); text-decoration: underline; }
.terms-themes a, .terms-categories a { color: var(--fg); border: 1px solid var(--border); border-radius: 6px; padding: 0 .5rem; }
.post-src { color: var(--muted); margin: .8rem 0 0; }
.post-nav { display: flex; justify-content: space-between; margin: 2rem 0 0; font-size: .85rem; }
.post-nav a { text-decoration: none; }

.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; border: 0; margin: 0; cursor: zoom-out; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; font: inherit; font-size: 1.6rem; cursor: pointer; padding: .6rem 1rem; }
.lightbox .prev { left: 0; top: 50%; } .lightbox .next { right: 0; top: 50%; } .lightbox .close { right: 0; top: 0; }
.lightbox .count { position: absolute; bottom: .8rem; left: 0; right: 0; text-align: center; color: #bbb; font-size: .8rem; }

/* ---------- listings, clouds, search ---------- */
.listing { max-width: 900px; margin: 0 auto; padding-top: 2rem; }
.listing h1 { font-size: 1.3rem; margin: 0 0 1rem; }
.listing h1 small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.listing h2 { font-size: .95rem; margin: 2rem 0 .6rem; color: var(--muted); }
.crumb { margin: 0 0 .5rem; font-size: .85rem; }
.cloud { line-height: 2.2; }
.cloud a { display: inline-block; margin: 0 .9rem 0 0; color: var(--muted); text-decoration: none; transition: color .15s ease; }
.cloud a:hover, .cloud a:focus-visible { color: var(--fg); }
.cloud sup { font-size: .6rem; margin-left: .15rem; opacity: .7; }
.cloud .w1 { font-size: .8rem; } .cloud .w2 { font-size: .95rem; } .cloud .w3 { font-size: 1.15rem; } .cloud .w4 { font-size: 1.45rem; color: var(--fg); } .cloud .w5 { font-size: 1.8rem; color: var(--fg); }
.rare { margin-top: 2rem; color: var(--muted); }
.rare summary { cursor: pointer; }
.az a { display: inline-block; margin: 0 .7rem 0 0; color: var(--muted); text-decoration: none; font-size: .8rem; }
.az a:hover { color: var(--fg); }
.archive h2 { color: var(--fg); border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.archive h3 { font-size: .8rem; color: var(--muted); margin: 1.2rem 0 .3rem; font-weight: 400; }
.archive ul { list-style: none; margin: 0; padding: 0; }
.archive li { display: flex; gap: .8rem; padding: .1rem 0; }
.archive time { color: var(--muted); min-width: 1.6rem; text-align: right; }
.archive a { text-decoration: none; overflow-wrap: anywhere; }
.archive a:hover { text-decoration: underline; }
.search { width: 100%; padding: .6rem .8rem; background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.search:focus { outline: none; border-color: var(--muted); }
.results { list-style: none; margin: 0; padding: 0; }
.results li a { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; text-decoration: none; }
.results li a:hover { text-decoration: underline; }
.results .kind { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.results .when { color: var(--muted); font-size: .75rem; min-width: 5.5rem; }

.foot { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; padding: 1.5rem var(--gap); border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--fg); }

@media (max-width: 600px) {
  .bar { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .bar-nav { justify-content: flex-start; }
  .tiles[data-layout="grid"] { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
