/* AOTD — hand-written, no build step. */
:root {
  --bg: #f6f3ee;
  --card: #fffdfa;
  --ink: #1f1c19;
  --muted: #776f66;
  --line: #e6dfd5;
  --accent: #e0532c;
  --accent-ink: #fff;
  --accent-soft: #fbe6de;
  --ok: #2f7d4f;
  --ok-soft: #e1f2e7;
  --danger: #b4321f;
  --logo-groove: #3a3530;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 4px 16px rgba(40, 30, 20, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141312;
    --card: #1d1b1a;
    --ink: #f1ece6;
    --muted: #a39a90;
    --line: #2f2c29;
    --accent: #ff6a3d;
    --accent-ink: #1a0d08;
    --accent-soft: #3a2018;
    --ok: #6ccf93;
    --ok-soft: #173323;
    --danger: #ff7a66;
    --logo-groove: #555;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea {
  font: inherit; color: var(--ink); background: var(--bg); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
label > input, label > textarea { font-weight: 400; font-size: 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
.icon { width: 1.15em; height: 1.15em; flex: none; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 720px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-weight: 800; letter-spacing: .04em; }
.brand:hover { color: inherit; }
.logo { width: 28px; height: 28px; color: var(--ink); }
.brand:hover .logo { animation: spin 1.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav { display: flex; gap: .25rem; margin-left: auto; }
.nav a { text-decoration: none; padding: .35rem .7rem; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a[aria-current] { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }
.nav-guest { align-items: center; }
.nav a.btn, .nav a.btn:hover { color: var(--accent-ink); background: var(--accent); }
.me { display: flex; align-items: center; gap: .25rem; }
.me-link { display: block; }
.menu { position: relative; }
.menu summary { list-style: none; padding: .35rem; border-radius: 999px; color: var(--muted); display: flex; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--line); color: var(--ink); }
.menu-pop { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 160px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .35rem; display: grid; }
.menu-pop a, .menu-pop button { text-decoration: none; padding: .5rem .7rem; border-radius: 8px; text-align: left; width: 100%; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); color: var(--ink); }
.menu-pop form { margin: 0; }

/* Layout */
.container { max-width: 720px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.feed-col { display: grid; gap: 1rem; }
.feed { display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; }
.page-title { font-family: var(--serif); font-size: 1.8rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem; }
.feed-title { margin: .5rem 0 0; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; margin-bottom: .25rem; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 1rem 2rem; }
.stack { display: grid; gap: .9rem; }
.form-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 999px; padding: .6rem 1.15rem; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; transition: transform .08s, filter .15s; }
.btn:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn-small { padding: .4rem .9rem; font-size: .9rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { color: var(--ink); background: var(--bg); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px currentColor; }
.btn-danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.alert { background: var(--accent-soft); color: var(--danger); border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; margin-bottom: .75rem; }
.ok { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: .6rem .8rem; font-size: .92rem; margin-bottom: .75rem; }

/* Avatars & placeholder colours */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; font-weight: 700; color: #fff; background: var(--line); }
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar-group { border-radius: 28%; }
.avatar-gone { background: var(--line); }
.h0 { --h: 8; } .h1 { --h: 28; } .h2 { --h: 45; } .h3 { --h: 90; } .h4 { --h: 150; } .h5 { --h: 175; }
.h6 { --h: 195; } .h7 { --h: 215; } .h8 { --h: 240; } .h9 { --h: 270; } .h10 { --h: 300; } .h11 { --h: 335; }
[class*=" h"].avatar, [class^="h"].avatar, .cover { background: linear-gradient(135deg, hsl(var(--h, 20) 55% 55%), hsl(calc(var(--h, 20) + 40) 50% 38%)); }

/* Post card */
.post { padding: 0; overflow: hidden; }
.post-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.1rem; }
.who { display: flex; align-items: center; gap: .6rem; text-decoration: none; min-width: 0; }
.who-text { display: grid; line-height: 1.25; min-width: 0; }
.who-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text .muted { font-size: .85rem; }
.post-date { font-size: .85rem; text-decoration: none; white-space: nowrap; }
.post-body { display: grid; grid-template-columns: 168px 1fr; gap: 1.1rem; padding: 0 1.1rem 1rem; align-items: start; }
.cover { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-ph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .9); font: 700 2.2rem/1 var(--serif); letter-spacing: .02em; }
.cover-sm { width: 52px; border-radius: 5px; box-shadow: none; }
.cover-sm .cover-ph { font-size: 1rem; }
.album { display: grid; gap: .25rem; min-width: 0; padding-top: .15rem; }
.album-title { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; overflow-wrap: anywhere; }
.album-title a { text-decoration: none; }
.album-artist { font-size: 1.05rem; font-weight: 600; }
.album-meta { font-size: .85rem; }
.album-meta a { color: var(--muted); }
.note { margin-top: .5rem; padding-left: .8rem; border-left: 3px solid var(--accent); white-space: pre-line; overflow-wrap: anywhere; }
.post-foot { display: flex; gap: .4rem; padding: .55rem .8rem; border-top: 1px solid var(--line); }
.action { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 999px; border: 0; background: none; color: var(--muted); font-size: .9rem; font-weight: 600; text-decoration: none; }
a.action:hover, button.action:hover { background: var(--bg); color: var(--ink); }
.checkin { box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.checkin.on { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.checkin.on:hover { background: var(--ok-soft); color: var(--ok); filter: brightness(.97); }
.checkin .count { padding-left: .4rem; margin-left: .1rem; border-left: 1px solid currentColor; opacity: .75; }
.checkin.htmx-request { opacity: .6; }
.load-more { display: flex; gap: .5rem; justify-content: center; align-items: center; color: var(--muted); padding: 1rem; }

@media (max-width: 560px) {
  .post-body { grid-template-columns: 1fr; }
  .post-body .cover { max-width: 100%; }
  .album-title { font-size: 1.3rem; }
  .card { padding: 1rem; }
  .post { padding: 0; }
  .nav a { padding: .35rem .5rem; }
  .brand span { display: none; }
}

/* Today box & post form */
.today { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.today-q { font-family: var(--serif); font-size: 1.5rem; margin-bottom: .9rem; }
.today-done { display: grid; grid-template-columns: 88px 1fr; gap: 1rem; align-items: center; }
.today-done .album-title { font-size: 1.3rem; }
.post-form { display: grid; gap: .75rem; }
.search-field { position: relative; }
.search-field input { font-size: 1.05rem; padding-block: .75rem; border-radius: 12px; }
.search-fields { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.search-fields > .spinner { position: absolute; right: 0; top: 0; }
.mb-results:empty { display: none; }
.mb-list { border: 0; margin: 0; padding: 0; display: grid; gap: .35rem; max-height: 360px; overflow-y: auto; }
.mb-item { display: grid; grid-template-columns: auto 52px 1fr; align-items: center; gap: .75rem; padding: .45rem .6rem; border-radius: 10px; border: 1px solid var(--line); font-weight: 400; cursor: pointer; }
.mb-item:hover { background: var(--bg); }
.mb-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mb-item input { width: auto; accent-color: var(--accent); }
.mb-text { display: grid; line-height: 1.3; min-width: 0; }
.mb-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manual summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.manual[open] summary { margin-bottom: .75rem; }
.manual .hint { margin-bottom: .6rem; }
.manual-row { align-items: end; }
.manual-row .year { width: 110px; }
@media (max-width: 560px) { .search-fields { grid-template-columns: 1fr; } .today-done { grid-template-columns: 64px 1fr; } }

/* Spinner / htmx */
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Comments */
.comments { display: grid; gap: 1rem; }
.comments .section-title { margin-bottom: 0; }
.thread { display: grid; gap: .5rem; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: .6rem; }
.comment-head { font-size: .92rem; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.comment-head a { text-decoration: none; }
.comment-body { white-space: pre-line; overflow-wrap: anywhere; }
.replies { margin-left: 14px; padding-left: 20px; border-left: 2px solid var(--line); display: grid; gap: .6rem; }
.reply { margin-left: 34px; }
.reply summary { font-size: .82rem; color: var(--muted); cursor: pointer; list-style: none; display: inline; }
.reply summary::-webkit-details-marker { display: none; }
.reply summary:hover { color: var(--accent); }
.reply[open] summary { display: none; }
.comment-form { display: grid; gap: .5rem; justify-items: start; }

/* Profile */
.profile { display: grid; grid-template-columns: auto 1fr; gap: 1.25rem; align-items: start; }
.profile-main { display: grid; gap: .6rem; min-width: 0; }
.profile-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.profile h1 { font-family: var(--serif); font-size: 1.7rem; }
.bio { white-space: pre-line; overflow-wrap: anywhere; }
.stats { display: flex; gap: 1rem; font-size: .92rem; }
.stats a { text-decoration: none; color: var(--muted); }
.stats strong { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); text-decoration: none; }
.faces { display: flex; flex-wrap: wrap; gap: .3rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); }
.tabs a { text-decoration: none; padding: .55rem .9rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 560px) { .profile { grid-template-columns: 1fr; } }

/* Lists of people / groups */
.rows { display: grid; gap: .25rem; }
.row { display: flex; gap: .75rem; align-items: center; padding: .5rem; border-radius: 10px; text-decoration: none; }
.row:hover { background: var(--bg); color: inherit; }
.row-text { display: grid; line-height: 1.3; min-width: 0; }
.row-bio { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Settings */
.avatar-edit { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.avatar-edit input[type=file] { padding: .45rem; }

/* Auth pages */
.auth { display: grid; gap: 1.5rem; max-width: 400px; margin: 2rem auto 0; }
.auth-hero { text-align: center; display: grid; gap: .4rem; justify-items: center; }
.auth-hero .logo { width: 56px; height: 56px; animation: spin 6s linear infinite; }
.auth-hero h1 { font-family: var(--serif); font-size: 2rem; }
.auth-card { display: grid; gap: 1rem; padding: 1.5rem; }
.auth-card h2 { font-size: 1.2rem; }
