/* ============================================================
   Daybook — a quiet, Facebook-inspired static feed
   ============================================================ */

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f3;
  --border: #e4e6eb;
  --border-strong: #d8dadf;
  --text: #050505;
  --muted: #65676b;
  --muted-strong: #4b4d52;
  --blue: #1877f2;
  --blue-dark: #166fe5;
  --blue-soft: #e7f3ff;
  --green: #31a24c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 10px rgba(0, 0, 0, 0.035);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --content: 1240px;
  --header-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

::selection {
  background: rgba(24, 119, 242, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(24, 119, 242, 0.35);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

/* ── Top bar ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: var(--content);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #3b8cff, var(--blue) 55%, #0b5ed7);
  color: #fff;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.brand-name {
  font-size: 22px;
  line-height: 1;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 15px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-tab svg {
  width: 19px;
  height: 19px;
}

.nav-tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-tab.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted-strong);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ── Layout ──────────────────────────────────────────────── */

.page {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 24px 20px 72px;
  display: grid;
  grid-template-columns: 260px minmax(0, 600px) 280px;
  gap: 24px;
  justify-content: center;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  gap: 16px;
  min-width: 0;
}

.feed {
  min-width: 0;
  max-width: 600px;
  justify-self: center;
  width: 100%;
}

/* ── Cards and buttons ───────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.035);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.card + .card {
  margin-top: 0;
}

.card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--surface-3);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.btn-primary:disabled:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
}

.btn-block {
  width: 100%;
  margin-top: 16px;
}

/* ── Profile header ──────────────────────────────────────── */

.profile-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.035);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.cover {
  aspect-ratio: 16 / 5.5;
  min-height: 150px;
  max-height: 240px;
  overflow: hidden;
  background: linear-gradient(135deg, #cfe6ff, #f8e8d8);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-body {
  padding: 0 24px 22px;
}

.profile-avatar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.avatar-wrap {
  margin-top: -58px;
  flex: none;
}

.avatar {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  background: var(--surface-2);
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 2px;
}

.profile-info {
  margin-top: 12px;
}

.profile-name {
  margin: 0;
  font-size: clamp(26px, 3vw, 32px);
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.profile-handle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.profile-handle .dot,
.post-time .dot {
  display: inline-block;
  margin: 0 5px;
  color: var(--muted);
}

.profile-bio {
  max-width: 52ch;
  margin: 12px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.profile-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(24, 119, 242, 0.09);
  color: var(--blue);
  font-size: 13px;
  font-weight: 650;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.profile-meta > span,
.profile-meta > a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
}

.profile-meta > a:hover {
  color: var(--blue);
  text-decoration: none;
}

.profile-meta svg {
  width: 17px;
  height: 17px;
  flex: none;
}

/* ── Feed toolbar ────────────────────────────────────────── */

.feed-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 4px 12px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.feed-title {
  margin: 0;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.feed-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.post-count {
  flex: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

/* ── Posts ───────────────────────────────────────────────── */

.post {
  margin-bottom: 16px;
  padding: 16px 20px 18px;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.035);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
}

.post-head-text {
  min-width: 0;
}

.post-author {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-time {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.3;
  text-decoration: none;
}

.post-time:hover {
  color: var(--blue);
  text-decoration: none;
}

.post-text {
  margin-top: 12px;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.post-text a {
  color: var(--blue);
  font-weight: 550;
}

.post-media {
  margin-top: 14px;
}

/* ── Image gallery ───────────────────────────────────────── */

.media-gallery {
  display: grid;
  gap: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-3);
}

.media-gallery[data-count="1"] {
  grid-template-columns: 1fr;
}

.media-gallery[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.media-gallery[data-count="3"] {
  grid-template-columns: 1.55fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.media-gallery[data-count="3"] .media-item:first-child {
  grid-row: span 2;
}

.media-gallery[data-count="many"] {
  grid-template-columns: 1fr 1fr;
}

.media-item {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: var(--surface-3);
}

/* A single photo is shown whole: no fixed crop, so captions and
   text baked into memes stay readable. Very tall images are only
   scaled down, never cut. */
.media-gallery[data-count="1"] {
  background: var(--surface);
}

.media-gallery[data-count="1"] .media-item {
  aspect-ratio: auto;
  background: transparent;
}

.media-gallery[data-count="1"] .media-button {
  display: grid;
  place-items: center;
  height: auto;
  background: transparent;
}

.media-gallery[data-count="1"] .media-button img {
  width: 100%;
  height: auto;
  max-height: 640px;
  object-fit: contain;
  border-radius: 10px;
}

.media-gallery[data-count="2"] .media-item,
.media-gallery[data-count="3"] .media-item,
.media-gallery[data-count="many"] .media-item {
  aspect-ratio: 1 / 1;
}

.media-gallery[data-count="3"] .media-item:first-child {
  aspect-ratio: auto;
}

.media-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--surface-3);
  cursor: zoom-in;
}

.media-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.media-button:hover img {
  transform: scale(1.018);
  filter: brightness(0.95);
}

.media-more {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  pointer-events: none;
}

/* ── Video embeds ────────────────────────────────────────── */

.video-embed {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #0b0b0c;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.tiktok-wrap {
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 4px 0;
}

.tiktok-wrap .tiktok-embed {
  margin: 0;
  max-width: 340px;
  min-width: 288px;
  width: 100%;
}

/* ── Link cards ──────────────────────────────────────────── */

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.link-card:hover {
  background: #f0f2f5;
  border-color: var(--border-strong);
  text-decoration: none;
}

.link-card--no-image {
  grid-template-columns: 1fr;
}

.link-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 14px 16px;
}

.link-domain {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.link-title {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.link-desc {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.link-url {
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-media {
  min-height: 120px;
  background: var(--surface-3);
}

.link-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Sidebar content ─────────────────────────────────────── */

.intro-list {
  display: grid;
  gap: 13px;
}

.intro-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.intro-item svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  color: var(--muted);
}

.intro-item strong {
  color: var(--text);
  font-weight: 650;
}

.intro-item a {
  overflow-wrap: anywhere;
}

.side-links {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.side-link:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.side-link svg {
  width: 19px;
  height: 19px;
  flex: none;
  color: var(--blue);
}

.project-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-link {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

.project-link:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.project-link svg {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 1px;
  color: var(--blue);
}

.project-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.project-name {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.project-desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.listen-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.listen-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
}

a.listen-item:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.listen-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
}

.listen-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listen-art-icon {
  display: grid;
  place-items: center;
}

.listen-art-icon svg {
  width: 19px;
  height: 19px;
}

.listen-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.listen-track {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.listen-artist {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listen-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listen-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.listen-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
}

.listen-more:hover {
  color: var(--blue);
  text-decoration: none;
}

.listening-inline {
  display: none;
}

.side-note {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ── Back to top ─────────────────────────────────────────── */

.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease,
    background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.to-top svg {
  width: 20px;
  height: 20px;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.topbar:focus {
  outline: none;
}

/* ── Empty state ─────────────────────────────────────────── */

.empty-state {
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

.empty-state .empty-icon svg {
  width: 25px;
  height: 25px;
}

.empty-state h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ── Toast ───────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 150;
  max-width: min(92vw, 420px);
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: #1c1e21;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Lightbox ────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  grid-template-rows: 1fr auto;
  place-items: center;
  background: rgba(7, 10, 15, 0.94);
  color: #fff;
  padding: 24px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  cursor: zoom-out;
}

.lightbox-figure {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  margin: 0;
  min-height: 0;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.4);
}

.lightbox-figure figcaption {
  max-width: 70ch;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.lightbox-btn {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-btn svg {
  width: 23px;
  height: 23px;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.lightbox-prev {
  grid-column: 1;
  grid-row: 1;
}

.lightbox-next {
  grid-column: 3;
  grid-row: 1;
}

.lightbox-count {
  position: relative;
  z-index: 2;
  grid-column: 2;
  grid-row: 2;
  padding-top: 8px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ── Compose page ────────────────────────────────────────── */

.compose-page {
  min-height: 100vh;
}

.compose-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.compose-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compose-header .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.compose-header .brand-name {
  font-size: 19px;
}

.compose-back {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.compose-wrap {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 20px 80px;
}

.compose-intro {
  margin-bottom: 22px;
}

.compose-intro h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.compose-intro p {
  max-width: 62ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.compose-intro code,
.side-note code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}

.compose-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > label,
.field-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.14);
  outline: none;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.media-fields {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.media-fields[hidden] {
  display: none !important;
}

.compose-output {
  margin-top: 20px;
}

.compose-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.compose-output-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.compose-output pre {
  max-height: 520px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-radius: 10px;
  background: #10131a;
  color: #e6edf7;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
}

.compose-output code {
  font-family: inherit;
}

.compose-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ── 404 ─────────────────────────────────────────────────── */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.error-card {
  width: 100%;
  max-width: 460px;
  padding: 44px 34px;
  text-align: center;
}

.error-card .brand-mark {
  margin: 0 auto 18px;
}

.error-card h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.error-card p {
  margin: 10px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1120px) {
  .page {
    grid-template-columns: 260px minmax(0, 600px);
  }

  .sidebar-right {
    display: none;
  }

  .listening-inline {
    display: block;
    margin-bottom: 18px;
  }

  .listening-inline .listen-list {
    grid-template-columns: 1fr 1fr;
  }

  .listening-inline .listen-list li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 880px) {
  .page {
    max-width: 720px;
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar-left {
    display: none;
  }

  .feed {
    max-width: 680px;
  }
}

@media (max-width: 700px) {
  .topbar-inner {
    gap: 8px;
    padding: 0 12px;
  }

  .brand-name {
    display: none;
  }

  .nav-tab {
    padding: 9px 12px;
  }

  .nav-tab .nav-label {
    display: none;
  }

  .page {
    padding: 16px 12px 56px;
  }

  .profile-body {
    padding: 0 16px 18px;
  }

  .cover {
    aspect-ratio: 16 / 6.5;
    min-height: 128px;
  }

  .avatar {
    width: 92px;
    height: 92px;
    border-width: 3px;
  }

  .avatar-wrap {
    margin-top: -46px;
  }

  .profile-avatar-row {
    align-items: flex-end;
  }

  .profile-actions {
    gap: 4px;
  }

  .profile-actions .btn {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
  }

  .profile-actions .btn span:not([data-icon]) {
    display: none;
  }

  .post {
    padding: 14px 16px 16px;
  }

  .to-top {
    right: 14px;
    bottom: 18px;
    width: 44px;
    height: 44px;
  }

  .feed-toolbar {
    align-items: flex-start;
    margin-inline: 2px;
  }

  .feed-subtitle {
    max-width: 34ch;
  }

  .link-card {
    grid-template-columns: 1fr;
  }

  .link-card-media {
    order: -1;
    height: 170px;
  }

  .lightbox {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    padding: 16px 8px;
  }

  .lightbox-btn {
    width: 42px;
    height: 42px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }

  .lightbox-figure img {
    max-height: calc(100vh - 140px);
  }
}

@media (max-width: 560px) {
  .profile-avatar-row {
    flex-wrap: nowrap;
  }

  .profile-actions {
    width: auto;
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .profile-actions .btn span:not([data-icon]) {
    display: inline;
  }

  .feed-toolbar {
    flex-direction: column;
    gap: 4px;
  }

  .post-count {
    font-size: 12px;
  }

  .listening-inline .listen-list {
    grid-template-columns: 1fr;
  }

  .listening-inline .listen-list li:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .compose-wrap {
    padding: 26px 14px 64px;
  }

  .compose-header-inner {
    padding-inline: 14px;
  }

  .compose-output-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .media-gallery[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .media-gallery[data-count="3"] .media-item:first-child {
    grid-column: span 2;
    grid-row: auto;
    aspect-ratio: 16 / 10;
  }

  .media-gallery[data-count="3"] .media-item {
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 380px) {
  .nav-tab {
    padding: 9px 9px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .profile-avatar-row {
    flex-wrap: wrap;
  }

  .profile-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .profile-actions .btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
