/* Socially Awkward — no inline styles anywhere (CSP style-src 'self') */
:root {
  --bg: #fbfaf7; --bg2: #f2efe9; --card: #ffffff; --ink: #18171c; --muted: #6d6a73; --line: #e6e2da;
  --accent: #ff5a3c; --accent2: #ff8a3d; --accent-ink: #fff; --ok: #1f8a4c; --err: #c62f2f;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(20,16,10,.06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f0f12; --bg2: #18181d; --card: #16161b; --ink: #f1efe9; --muted: #9a97a3; --line: #2a2a31;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f12; --bg2: #18181d; --card: #16161b; --ink: #f1efe9; --muted: #9a97a3; --line: #2a2a31;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); 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); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.inline { display: inline; margin: 0; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 975px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 800; font-size: 15px; transform: rotate(-6deg); }
.brand-name { font-family: var(--serif); font-size: 21px; font-style: italic; }
.topnav { display: flex; align-items: center; gap: 6px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer; min-height: 42px; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 34px; }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-ink); border-color: transparent; }
.btn-accent:hover { border-color: transparent; filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg2); border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--bg2); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-toggle .i-moon { display: none; }
  :root[data-theme="auto"] .theme-toggle .i-sun { display: inline; }
}

/* layout */
.wrap { width: 100%; max-width: 975px; margin: 0 auto; padding: 0 0 40px; flex: 1; }
.wrap-admin { max-width: 760px; padding: 20px 16px 48px; }
.foot { max-width: 975px; width: 100%; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; gap: 16px; justify-content: center; color: var(--muted); font-size: 13px; }
.foot a { color: var(--muted); }

/* profile header */
.profile { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 28px 16px 24px; }
.avatar { display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent2)); flex: none; text-decoration: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; padding: 3px; }
.avatar-lg img, .avatar-lg .avatar-initial { border-radius: 50%; border: 3px solid var(--bg); }
.avatar-sm { width: 40px; height: 40px; }
.avatar-initial { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; font: 700 32px/1 var(--serif); font-style: italic; }
.avatar-sm .avatar-initial { font-size: 18px; }
.profile-name { margin: 0; font: italic 700 26px/1.15 var(--serif); letter-spacing: -.01em; }
.profile-handle { color: var(--muted); font-size: 14px; }
.profile-stats { margin-top: 6px; font-size: 15px; }
.profile-bio { margin: 8px 0 0; white-space: normal; max-width: 52ch; }
@media (min-width: 736px) {
  .profile { gap: 64px; padding: 40px 48px 36px; }
  .avatar-lg { width: 150px; height: 150px; padding: 4px; }
  .avatar-lg .avatar-initial { font-size: 60px; }
  .profile-name { font-size: 32px; }
}

/* grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-top: 1px solid var(--line); padding-top: 3px; }
@media (min-width: 736px) { .grid { gap: 6px; padding-top: 6px; } }
.tile { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; background: var(--bg2); text-decoration: none; }
.tile picture, .tile img, .tile video { width: 100%; height: 100%; object-fit: cover; }
.tile img, .tile video { transition: transform .35s ease, filter .35s ease; }
.tile:hover img, .tile:hover video { transform: scale(1.03); filter: brightness(.92); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.thought { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10%; background: linear-gradient(150deg, var(--card), var(--bg2)); border: 1px solid var(--line); }
.thought::before { content: "\201C"; position: absolute; top: 2%; left: 7%; font: 700 64px/1 var(--serif); color: var(--accent); opacity: .5; }
.thought p { margin: 0; font: italic 600 clamp(11px, 2.2vw, 19px)/1.35 var(--serif); text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.badge { width: 20px; height: 20px; fill: #fff; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.55)); }
.tile-text .badge { fill: var(--accent); stroke: var(--accent); filter: none; }
.badge rect, .badge path[d^="M3"] { fill: none; }
.pager { display: flex; justify-content: center; gap: 10px; padding: 28px 16px; }
.pager.loading a { opacity: .5; pointer-events: none; }

/* empty state */
.empty { text-align: center; padding: 56px 24px 72px; border-top: 1px solid var(--line); color: var(--muted); }
.empty h2 { color: var(--ink); margin: 14px 0 6px; font: italic 700 26px/1.2 var(--serif); }
.empty p { max-width: 36ch; margin: 0 auto 20px; }
.empty-face { display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 26px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font: 800 34px/1 var(--font); transform: rotate(-8deg); box-shadow: var(--shadow); }

/* post page */
.post { display: grid; grid-template-columns: 1fr; background: var(--card); margin: 0 auto; max-width: 935px; }
@media (min-width: 900px) {
  .post { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
  .post-text { grid-template-columns: 1fr; max-width: 640px; }
}
.notice { grid-column: 1 / -1; padding: 10px 16px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); font-size: 14px; }
.carousel { position: relative; background: #000; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; margin: 0; display: grid; place-items: center; max-height: 85vh; min-height: 240px; }
.slide picture, .slide img, .slide video { width: 100%; max-height: 85vh; object-fit: contain; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: #111; font-size: 24px; line-height: 1; cursor: pointer; display: none; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.car-btn:disabled { opacity: 0; pointer-events: none; }
.car-prev { left: 10px; } .car-next { right: 10px; }
@media (hover: hover) { .car-btn { display: block; } }
.dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; gap: 5px; justify-content: center; pointer-events: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); transition: background .2s, transform .2s; }
.dot.on { background: #fff; transform: scale(1.25); }
.post-side { display: flex; flex-direction: column; padding: 14px 16px 20px; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.post-name { font-weight: 700; text-decoration: none; }
.post-loc { font-size: 13px; color: var(--muted); }
.post-head .pill { margin-left: auto; }
.caption { padding: 14px 0; white-space: normal; overflow-wrap: anywhere; }
.caption-big { font: italic 600 clamp(20px, 4.5vw, 28px)/1.4 var(--serif); padding: 28px 0; }
.post-text .post-side { padding: 24px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.post-meta a { color: var(--accent); }
.back { margin-top: 18px; font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--bg2); font-size: 12px; font-weight: 600; color: var(--muted); }
.pill-published { color: var(--ok); }
.pill-scheduled { color: var(--accent); }

/* admin */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.login-card { max-width: 380px; margin: 40px auto; text-align: center; }
.login-card h1 { font: italic 700 26px/1.2 var(--serif); margin: 16px 0; }
.stack { display: grid; gap: 14px; text-align: left; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.admin-head h1 { margin: 0; font: italic 700 28px/1.2 var(--serif); }
.ok, .err { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.ok { background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.err { background: color-mix(in srgb, var(--err) 14%, var(--card)); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 16px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; text-decoration: none; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.admin-thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--bg2); display: grid; place-items: center; text-decoration: none; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { color: var(--muted); font: italic 700 18px var(--serif); }
.admin-cap { font-weight: 600; overflow-wrap: anywhere; }
.admin-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 3px; }
.admin-actions { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
@media (min-width: 640px) { .admin-row { grid-template-columns: 64px 1fr auto; } .admin-actions { grid-column: auto; } }

.composer { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
input, textarea, select { font: 16px/1.4 var(--font); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
small { font-weight: 400; color: var(--muted); font-size: 12px; }
.row2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1.4fr 1fr; } }
.dropzone { position: relative; display: flex; align-items: center; gap: 16px; padding: 22px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; font-weight: 400; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-size: 30px; font-weight: 300; }
.media-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.media-list:empty { display: none; }
.mitem { display: grid; grid-template-columns: 22px 72px 1fr auto; gap: 10px; align-items: center; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.mitem.dragging { opacity: .6; border-color: var(--accent); }
.handle { cursor: grab; touch-action: none; color: var(--muted); text-align: center; user-select: none; font-size: 18px; letter-spacing: -3px; }
.mprev { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--bg2); }
.mfields { display: grid; gap: 6px; min-width: 0; }
.mfields input { padding: 8px 10px; font-size: 14px; }
.mname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mremove { display: flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; color: var(--muted); }
.mbtns { display: grid; gap: 2px; }
.mbtns .icon-btn { width: 32px; height: 32px; }
fieldset.status { border: 0; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
fieldset.status legend { font-size: 14px; font-weight: 600; margin-bottom: 6px; padding: 0; }
.seg { display: inline-flex; font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.when { opacity: .7; }
.when.need { opacity: 1; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details.more label { margin-top: 10px; }
.actions { display: flex; gap: 10px; }
.actions .btn-accent { min-width: 120px; }
.progress { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 3%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }
.bar[data-pct="10"]{width:10%}.bar[data-pct="20"]{width:20%}.bar[data-pct="30"]{width:30%}.bar[data-pct="40"]{width:40%}.bar[data-pct="50"]{width:50%}.bar[data-pct="60"]{width:60%}.bar[data-pct="70"]{width:70%}.bar[data-pct="80"]{width:80%}.bar[data-pct="90"]{width:90%}.bar[data-pct="100"]{width:100%}
.danger-zone { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.avatar-edit { display: flex; align-items: center; gap: 18px; }
@media (max-width: 480px) { .brand-name { font-size: 18px; } .topnav .btn-ghost { padding: 7px 8px; } }
