/* Wall — custom styles on top of Pico CSS */

/* --- Outfit font (self-hosted) --- */

/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Override Pico's system font stack + shared design tokens */
:root {
  --pico-font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  --w-radius: 12px;

  /* Type scale — consolidates ~14 ad-hoc small sizes into 5 steps */
  --w-text-2xs: 0.7rem;
  --w-text-xs: 0.75rem;
  --w-text-sm: 0.82rem;
  --w-text-md: 0.9rem;
  --w-text-lg: 1.15rem;

  /* Spacing scale */
  --w-space-1: 0.25rem;
  --w-space-2: 0.5rem;
  --w-space-3: 0.75rem;
  --w-space-4: 1rem;
  --w-space-5: 1.5rem;
  --w-space-6: 2.5rem;
}

/* =============================================================================
   DESIGN TOKENS — warm-slate chrome, violet accent
   Replaces Pico's stock palette. The `:root[data-theme]` selector matches
   Pico's own specificity so these win in both light and OS-dark contexts.
   ============================================================================= */

:root[data-theme="light"] {
  /* Surfaces */
  --pico-background-color: #f4f3f0;          /* warm page backdrop */
  --w-surface: #ffffff;                       /* cards / posts / inputs */
  --w-surface-2: #fbfaf8;                     /* subtle raised chrome */
  --pico-card-background-color: #ffffff;
  --pico-card-sectioning-background-color: #fbfaf8;

  /* Text — explicit colors instead of opacity dimming */
  --pico-color: #1d1a16;
  /* Pico re-declares --pico-color on buttons/inputs (to its primary-inverse),
     so var(--pico-color) resolves to white inside them. --w-fg is ours alone
     and stays correct in any scope. */
  --w-fg: #1d1a16;
  --pico-h1-color: #131210;
  --pico-h2-color: #131210;
  --pico-h3-color: #1d1a16;
  --pico-muted-color: #6c6860;                /* readable warm grey */

  /* Borders */
  --pico-muted-border-color: #e4e1da;
  --w-border-strong: #d3cfc6;

  /* Violet accent — used sparingly for links / actions / focus */
  --pico-primary: #6d3df5;
  --pico-primary-hover: #5a2fd8;
  --pico-primary-focus: rgba(109, 61, 245, 0.25);
  --pico-primary-background: #6d3df5;
  --pico-primary-hover-background: #5a2fd8;
  --pico-primary-inverse: #ffffff;
  --pico-primary-rgb: 109, 61, 245;

  /* Elevation */
  --w-shadow-sm: 0 1px 2px rgba(28, 26, 22, 0.05), 0 1px 3px rgba(28, 26, 22, 0.05);
  --w-shadow-md: 0 6px 22px rgba(28, 26, 22, 0.09), 0 2px 6px rgba(28, 26, 22, 0.05);
}

:root[data-theme="dark"] {
  /* Surfaces */
  --pico-background-color: #161518;
  --w-surface: #211f25;
  --w-surface-2: #1b1a1f;
  --pico-card-background-color: #211f25;
  --pico-card-sectioning-background-color: #1b1a1f;

  /* Text */
  --pico-color: #ece9e3;
  --w-fg: #ece9e3;
  --pico-h1-color: #f7f5f0;
  --pico-h2-color: #f7f5f0;
  --pico-h3-color: #ece9e3;
  --pico-muted-color: #9c978d;

  /* Borders */
  --pico-muted-border-color: #353339;
  --w-border-strong: #4a4751;

  /* Violet accent — lifted for contrast on dark */
  --pico-primary: #9b7bf8;
  --pico-primary-hover: #b29bfa;
  --pico-primary-focus: rgba(155, 123, 248, 0.3);
  --pico-primary-background: #6d3df5;
  --pico-primary-hover-background: #7d52f6;
  --pico-primary-inverse: #ffffff;
  --pico-primary-rgb: 155, 123, 248;

  /* Elevation */
  --w-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --w-shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* --- Header --- */

.wall-header {
  text-align: center;
  padding: 2rem 0 0.75rem;
}

.wall-header h1 {
  margin-bottom: 0.25rem;
  font-size: 1.6rem;
  font-weight: 500;
}

.logged-out {
  font-weight: 400;
  color: var(--pico-muted-color);
}

.logged-in {
  font-weight: 400;
  color: var(--pico-muted-color);
  font-size: 0.85em;
}

.wordmark {
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--pico-primary), color-mix(in srgb, var(--pico-primary) 60%, #9333ea));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 1;
  padding-right: 0.15em;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--w-text-xs);
  font-weight: 500;
  color: var(--pico-muted-color);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 50%, transparent);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.cta-link:hover {
  color: var(--pico-primary);
  border-color: color-mix(in srgb, var(--pico-primary) 50%, transparent);
  background: color-mix(in srgb, var(--pico-primary) 5%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

.cta-link:active {
  transform: translateY(0);
  box-shadow: none;
}

.profile-pic {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  animation: profileGlow 2.5s ease-in-out;
}

.profile-pic-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--pico-primary-background), color-mix(in srgb, var(--pico-primary-background) 80%, #7c3aed));
  color: var(--pico-primary-inverse);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: profileGlow 2.5s ease-in-out;
}

@keyframes profileGlow {
  0% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
  50% { box-shadow: 0 4px 30px rgba(var(--pico-primary-rgb, 26, 95, 180), 0.2); }
  100% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); }
}

/* Owner-only: the header avatar is a clickable file picker. */
.profile-pic-wrap {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  cursor: pointer;
}

.profile-pic-wrap .profile-pic,
.profile-pic-wrap .profile-pic-placeholder {
  margin: 0;
}

.profile-pic-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.profile-pic-wrap:hover .profile-pic-overlay,
.profile-pic-wrap:focus-within .profile-pic-overlay,
.profile-pic-wrap[aria-busy="true"] .profile-pic-overlay {
  opacity: 1;
}

/* --- Profile-picture crop modal --- */

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.6);
}

.crop-dialog {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--pico-card-background-color, #fff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.crop-stage {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.crop-stage.dragging {
  cursor: grabbing;
}

.crop-img {
  position: absolute;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

.crop-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.crop-zoom {
  width: 100%;
  margin: 0;
}

.crop-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.crop-btn {
  width: auto;
  margin: 0;
  padding: 0.4rem 1.1rem;
}

.crop-cancel {
  background: transparent;
  color: var(--pico-color);
  border-color: var(--pico-muted-border-color);
}

/* --- Wall navigation (tabs + toolbar) --- */

.wall-nav {
  max-width: 520px;
  margin: 0 auto 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
}

.wall-tabs {
  display: flex;
  justify-content: center;
  gap: 0.15rem;
  background: none;
  padding: 0.2rem;
  font-size: var(--w-text-sm);
}

.wall-tabs a,
.wall-tabs strong {
  padding: 0.4rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  line-height: 1.3;
}

.wall-tabs a {
  color: var(--pico-muted-color);
}

.wall-tabs a:hover {
  color: var(--pico-color);
  background: color-mix(in srgb, var(--pico-muted-color) 8%, transparent);
}

.wall-tabs strong {
  background: var(--w-surface);
  box-shadow: var(--w-shadow-sm);
  font-weight: 600;
}

.wall-toolbar {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--pico-muted-border-color);
  background: var(--w-surface);
  overflow: hidden;
}

.wall-toolbar:focus-within {
  border-color: var(--pico-primary);
}

.wall-toolbar .wall-search {
  appearance: none;
  -webkit-appearance: none;
  /* Neutralize Pico's calc()-based height/padding/margin via its own variables */
  --pico-form-element-spacing-vertical: 0;
  --pico-form-element-spacing-horizontal: 0.75rem;
  --pico-border-width: 0;
  --pico-spacing: 0;
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 0.75rem;
  padding-inline-start: 0.75rem;
  border: none;
  border-radius: 0;
  outline: none;
  background: transparent;
  background-image: none;
  box-shadow: none;
  font-size: var(--w-text-sm);
  line-height: 1;
  font-family: inherit;
  color: var(--pico-color);
  transition: none;
}

.wall-toolbar .wall-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 28px;
  width: 28px;
  padding: 7px;
  background: var(--pico-muted-color);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
  mask-size: 14px;
  -webkit-mask-size: 14px;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  border-radius: 4px;
  cursor: pointer;
}

.wall-toolbar .wall-search::-webkit-search-cancel-button:hover {
  background: var(--pico-color);
}

.wall-toolbar .wall-search:focus {
  border: none;
  box-shadow: none;
}

.wall-toolbar .wall-search::placeholder {
  color: var(--pico-muted-color);
  font-weight: 300;
}

.wall-toolbar .wall-toolbar-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: var(--pico-muted-color);
  cursor: pointer;
  border-left: 1px solid var(--pico-muted-border-color);
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.wall-toolbar-btn:hover {
  color: var(--pico-color);
  background: color-mix(in srgb, var(--pico-muted-color) 8%, transparent);
}

.wall-toolbar-btn.active {
  color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 6%, transparent);
}

.wall-toolbar-rss:hover {
  color: #ee802f;
  background: color-mix(in srgb, #ee802f 6%, transparent);
}

.wall-toolbar-btn svg {
  display: block;
}

.user-nav a {
  color: var(--pico-muted-color);
}

.user-nav a:hover {
  color: var(--pico-color);
  background: color-mix(in srgb, var(--pico-muted-color) 8%, transparent);
}

.user-nav strong {
  background: var(--w-surface);
  color: var(--pico-color);
  font-weight: 500;
  box-shadow: var(--w-shadow-sm);
}

/* --- Date separators --- */

.date-separator {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 1rem;
  color: var(--pico-muted-color);
  font-size: var(--w-text-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--pico-muted-border-color);
  animation: lineGrow 0.6s ease-out both;
}

.date-separator::before {
  transform-origin: right;
}

.date-separator::after {
  transform-origin: left;
}

@keyframes lineGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* --- Feed layout --- */

.wall-feed {
  max-width: 520px;
  margin: 0 auto;
}

/* --- Posts --- */

.post {
  animation: postFadeIn 0.4s ease-out both;
  margin-bottom: 1.5rem;
  overflow: hidden;
  padding: 0;
  background: var(--w-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--w-radius);
  box-shadow: var(--w-shadow-sm);
}

.post > footer {
  margin: 0;
  padding: 0.5rem 0.75rem;
  background-color: transparent;
  border-top: none;
  border-radius: 0;
}

.post-text,
.post-link {
  padding: 1rem;
}

.post-text > footer,
.post-link > footer {
  padding: 0.5rem 0 0;
}

.post-photo > .post-content,
.post-video > .post-content {
  padding: 0.5rem 0.75rem 0;
}

.post-photo > footer,
.post-video > footer {
  padding: 0.5rem 0.75rem;
}

.post-time {
  color: var(--pico-muted-color);
}

@keyframes postFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger post animations */
.date-group .post:nth-child(2) { animation-delay: 0.05s; }
.date-group .post:nth-child(3) { animation-delay: 0.1s; }
.date-group .post:nth-child(4) { animation-delay: 0.15s; }
.date-group .post:nth-child(5) { animation-delay: 0.2s; }

/* --- Text posts --- */

.post-text .post-content {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.6;
  margin-bottom: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* --- Link cards --- */

.link-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: inherit;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.link-card-image {
  width: 100%;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
  display: block;
}

.link-card-body {
  padding: 0.75rem 1rem;
  /* Let the flex item shrink and wrap long URLs instead of overflowing. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.link-card-body strong {
  display: block;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card-body p {
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card-domain {
  color: var(--pico-muted-color);
}

/* --- Photos --- */

.post-photo img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--pico-border-radius);
  display: block;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background: color-mix(in srgb, var(--pico-muted-color) 5%, transparent);
}

/* --- Videos --- */

.post-video video {
  width: 100%;
  max-height: 400px;
  border-radius: var(--pico-border-radius);
  display: block;
  margin-bottom: 0.5rem;
  background: #000;
}

/* --- Lightbox (fullscreen image view) --- */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: lightboxIn 0.25s ease-out;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  animation: lightboxImgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightboxImgIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-overlay.closing {
  animation: lightboxOut 0.2s ease-in forwards;
}

.lightbox-overlay.closing img {
  animation: lightboxImgOut 0.2s ease-in forwards;
}

@keyframes lightboxOut {
  to { opacity: 0; }
}

@keyframes lightboxImgOut {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* --- Infinite scroll --- */

.load-more {
  text-align: center;
  padding: 2rem 0;
}

.load-more-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
}

.feed-end {
  text-align: center;
  padding: 1.5rem 0;
  color: var(--pico-muted-color);
}

/* --- Loading skeletons --- */

.skeleton-post {
  padding: var(--w-space-4);
  pointer-events: none;
}

.skeleton-line {
  height: 0.85rem;
  margin-bottom: var(--w-space-2);
  border-radius: 6px;
  background-color: color-mix(in srgb, var(--pico-muted-color) 14%, transparent);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--pico-muted-color) 12%, transparent) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: skeletonShimmer 1.3s ease-in-out infinite;
}

.skeleton-line:last-child {
  margin-bottom: 0;
}

.skeleton-line.short {
  width: 55%;
}

@keyframes skeletonShimmer {
  from { background-position: 150% 0; }
  to { background-position: -150% 0; }
}

/* --- Empty state --- */

.empty-wall {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--w-space-6) var(--w-space-4);
  color: var(--pico-muted-color);
}

.empty-wall svg {
  color: color-mix(in srgb, var(--pico-muted-color) 50%, transparent);
  margin-bottom: var(--w-space-2);
}

.empty-wall-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--pico-color);
}

.empty-wall-sub {
  margin: var(--w-space-1) 0 0;
  font-size: var(--w-text-md);
}

.empty-wall-cta {
  margin-top: var(--w-space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--w-space-1);
  padding: 0.5rem 1.15rem;
  font-size: var(--w-text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--pico-primary-inverse);
  background: var(--pico-primary-background);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.empty-wall-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* --- Grid / Collage feed --- */

.feed-grid {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  columns: var(--feed-columns, 2);
  column-gap: 0.75rem;
}

.feed-grid .post {
  break-inside: avoid;
  margin-bottom: 0.75rem;
}

.feed-grid .date-group {
  break-inside: avoid;
}

.feed-grid .post-photo img {
  max-height: 300px;
}

.feed-grid .post-video video {
  max-height: 300px;
}

.feed-collage .post-photo img,
.feed-collage .post-video video {
  max-height: 350px;
}

/* Limit columns on small screens */
@media (max-width: 576px) {
  .feed-grid { columns: min(var(--feed-columns, 2), 2) !important; }
}
@media (max-width: 400px) {
  .feed-grid { columns: 1 !important; }
}

/* --- Inline composer (owner view) --- */

.inline-composer,
.owner-toolbar {
  margin-bottom: 1.25rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.inline-composer {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--w-radius);
  padding: 1rem 1.25rem;
  background: var(--w-surface);
  box-shadow: var(--w-shadow-sm);
}

.owner-toolbar {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--w-radius);
  padding: 1rem 1.25rem;
  background: var(--w-surface);
  box-shadow: var(--w-shadow-sm);
}

/* Compact form overrides — tame Pico's bulky defaults inside panels */
.owner-toolbar input,
.owner-toolbar select,
.owner-toolbar textarea,
.inline-composer input:not([type="file"]):not([type="hidden"]),
.inline-composer select,
.inline-composer textarea {
  font-size: var(--w-text-sm) !important;
  padding: 0.4rem 0.6rem !important;
  margin-bottom: 0.5rem !important;
  border-radius: 6px;
}

.owner-toolbar label,
.inline-composer label {
  font-size: var(--w-text-sm);
  margin-bottom: 0.6rem;
}

.owner-toolbar fieldset {
  padding: 0.75rem 1rem !important;
  margin-bottom: 0.75rem !important;
}

.owner-toolbar legend {
  font-size: var(--w-text-2xs) !important;
}

.owner-toolbar button[type="submit"] {
  font-size: var(--w-text-sm) !important;
  padding: 0.4rem 1rem !important;
}

.settings-form {
  max-width: 480px;
  margin: 0 auto;
}

.settings-form fieldset {
  margin-bottom: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 40%, transparent);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.settings-form legend {
  font-size: var(--w-text-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pico-muted-color);
  padding: 0 0.35rem;
}

.settings-form label {
  font-size: var(--w-text-sm);
  font-weight: 400;
  margin-bottom: 0.6rem;
  display: block;
  overflow: visible;
}

.settings-hint {
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  margin: 0 0 0.6rem;
}

.settings-form button[type="submit"] {
  width: auto;
  padding: 0.4rem 1.2rem;
  font-size: var(--w-text-sm);
  border-radius: 8px;
}

.settings-link {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  color: var(--pico-muted-color);
}

/* --- Settings sections --- */

.settings-sections {
  padding-top: 0.25rem;
  overflow: visible;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.settings-divider {
  height: 1px;
  background: color-mix(in srgb, var(--pico-muted-border-color) 50%, transparent);
  margin: 1.5rem 0;
}

.settings-section-title {
  font-size: var(--w-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pico-muted-color);
  margin-bottom: 0.85rem;
}

/* --- Import CTA --- */

.import-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color);
  text-decoration: none;
  font-size: var(--w-text-md);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.import-cta:hover {
  color: var(--pico-primary);
  border-color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 4%, transparent);
}

.import-cta svg {
  flex-shrink: 0;
}

/* --- Feed management --- */

/* Reset Pico defaults inside feed section */
.feed-list input,
.feed-list select,
.feed-list button,
.feed-add-row input,
.feed-add-row button {
  margin-bottom: 0 !important;
  width: auto !important;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feed-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
  background: var(--w-surface);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  flex-direction: column;
}

.feed-item.dragging { opacity: 0.4; }
.feed-item.drag-over {
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pico-primary) 12%, transparent);
}

.feed-drag-handle {
  cursor: grab;
  color: var(--pico-muted-color);
  font-size: var(--w-text-xs);
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
  opacity: 0.5;
}
.feed-drag-handle:active { cursor: grabbing; }

.feed-item-all {
  background: color-mix(in srgb, var(--pico-primary) 4%, transparent);
  border-color: color-mix(in srgb, var(--pico-primary) 15%, transparent);
  flex-direction: row;
  align-items: center;
  padding: 0.65rem 0.85rem;
  gap: 0.5rem;
}

.feed-item-label {
  font-size: var(--w-text-sm);
  font-weight: 500;
  flex: 1;
}

.feed-item-meta {
  color: var(--pico-muted-color);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: var(--w-text-2xs);
  font-weight: 400;
}

/* Feed card — stacked layout for clarity */
.feed-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.feed-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
}

.feed-card-name {
  font-size: var(--w-text-md);
  font-weight: 500;
  padding: 0.25rem 0.4rem !important;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  flex: 1;
  min-width: 80px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.feed-card-name:hover {
  border-color: color-mix(in srgb, var(--pico-muted-border-color) 50%, transparent);
  background: color-mix(in srgb, var(--pico-muted-color) 4%, transparent);
}

.feed-card-name:focus {
  border-color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 4%, transparent);
  outline: none;
}

.feed-card-bottom {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  border-top: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 25%, transparent);
  background: color-mix(in srgb, var(--pico-muted-color) 3%, transparent);
  flex-wrap: wrap;
}

.feed-card-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  flex-shrink: 0;
}

.feed-card-toggle input[type="checkbox"] {
  height: 1.2rem !important;
}

.feed-card-sel {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.feed-card-sel select {
  font-size: var(--w-text-xs) !important;
  padding: 0.2rem 0.35rem !important;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 40%, transparent);
  background: var(--w-surface);
}

.feed-card-save {
  font-size: var(--w-text-2xs);
  padding: 0.3rem 0.7rem !important;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.feed-card-save:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.feed-card-del {
  background: none;
  border: none;
  color: var(--pico-muted-color);
  cursor: pointer;
  font-size: var(--w-text-2xs);
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.feed-card-del:hover {
  color: #e53935;
  background: color-mix(in srgb, #e53935 6%, transparent);
}

/* Feed selector in composer */
.feed-select {
  all: unset;
  font-size: var(--w-text-sm);
  font-family: inherit;
  padding: 0.3rem 0.5rem;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 40%, transparent);
  border-radius: 6px;
  color: var(--pico-color);
  background: var(--w-surface);
  cursor: pointer;
  flex-shrink: 0;
}

/* Add feed row */
.feed-add-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.25rem;
}

.feed-add-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.feed-add-input {
  font-size: var(--w-text-sm) !important;
  padding: 0.4rem 0.65rem !important;
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 40%, transparent) !important;
}

.feed-add-btn {
  font-size: 1rem !important;
  padding: 0.3rem 0.65rem !important;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.feed-add-btn:hover { opacity: 0.85; }

.feed-import-link {
  font-size: var(--w-text-sm);
  font-weight: 500;
  color: var(--pico-muted-color);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.feed-import-link:hover {
  color: var(--pico-primary);
}

/* --- Import banner (sticky top) --- */

.import-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  text-align: center;
  font-size: var(--w-text-md);
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  animation: bannerSlide 0.3s ease-out;
}

.import-banner.done {
  background: #2e7d32;
}

.import-banner.error {
  background: #c62828;
}

@keyframes bannerSlide {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* --- Login prompt --- */

.login-prompt {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
  color: var(--pico-muted-color);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 50%, transparent);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.login-pill:hover {
  color: var(--pico-primary);
  border-color: color-mix(in srgb, var(--pico-primary) 40%, transparent);
  background: color-mix(in srgb, var(--pico-primary) 5%, transparent);
  transform: translateY(-1px);
}

.login-pill svg {
  display: block;
  flex-shrink: 0;
}

/* --- Post footer --- */

.post footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  padding-top: 0.4rem;
}

.post-footer-right {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.post-permalink {
  color: var(--pico-muted-color);
  text-decoration: none;
  font-size: var(--w-text-xs);
}

.post-permalink:hover {
  color: var(--pico-color);
}

.share-post-btn,
.edit-post-inline,
.post-delete-inline {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--pico-muted-color);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.share-post-btn svg,
.edit-post-inline svg,
.post-delete-inline svg {
  display: block;
}

.share-post-btn:hover {
  color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

.share-post-btn:active {
  transform: scale(0.9);
}

.post-delete-inline {
  opacity: 0.5;
}

.post:hover .post-delete-inline,
.post-delete-inline:focus {
  opacity: 1;
}

.post-delete-inline:hover {
  color: #c62828;
  background: color-mix(in srgb, #c62828 8%, transparent);
}

/* Edit shares the delete button's subtle, reveal-on-hover treatment (both are
   owner mutations) but tints violet rather than red. */
.edit-post-inline {
  opacity: 0.5;
}

.post:hover .edit-post-inline,
.edit-post-inline:focus {
  opacity: 1;
}

.edit-post-inline:hover {
  color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

/* --- Inline post editor --- */

.post-edit-box {
  padding: 0.5rem 0.75rem 0;
}

/* Text/link posts already pad the article, so don't double the inset. */
.post-text .post-edit-box,
.post-link .post-edit-box {
  padding-left: 0;
  padding-right: 0;
}

.post-edit-area {
  width: 100%;
  font-family: inherit;
  font-size: var(--w-text-md);
  line-height: 1.5;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  background: var(--w-surface);
  color: var(--pico-color);
  resize: vertical;
}

.post-edit-area:focus {
  outline: none;
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

.post-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.post-edit-actions button {
  font-size: var(--w-text-sm);
  font-family: inherit;
  font-weight: 500;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.post-edit-cancel {
  background: transparent;
  color: var(--pico-muted-color);
  border-color: var(--pico-muted-border-color);
}

.post-edit-cancel:hover {
  color: var(--pico-color);
}

.post-edit-save {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.post-edit-save:hover {
  opacity: 0.9;
}

.post-edit-save:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Highlight targeted post from permalink */
.post:target {
  animation: highlightPost 2s ease-out;
}

@keyframes highlightPost {
  0% { box-shadow: 0 0 0 3px var(--pico-primary); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* --- Unclaimed page --- */

.unclaimed-actions {
  text-align: center;
  margin-top: 1.5rem;
}

.unclaimed-actions form {
  display: inline;
}

.unclaimed-actions .claim-link {
  display: inline-block;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse) !important;
  border: none !important;
  font-family: inherit;
  font-size: var(--w-text-md);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.6rem 2rem;
  border-radius: 2rem;
  cursor: pointer;
}

.unclaimed-actions .claim-link:hover {
  opacity: 0.85;
}

.unclaimed-actions .secondary-actions {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 1rem;
}

.unclaimed-actions .secondary-actions .cta-link {
  color: var(--pico-muted-color);
  font-family: inherit;
  font-size: var(--w-text-sm);
  font-weight: 500;
  line-height: 1;
  background: none;
  border: none;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.unclaimed-actions .secondary-actions .cta-link:hover {
  color: var(--pico-color);
}

.unclaimed-actions .secondary-actions .separator {
  color: var(--pico-muted-border-color);
  font-size: var(--w-text-sm);
  line-height: 1;
  padding: 0.4rem 0;
  user-select: none;
}

/* --- Directory (root page) --- */

.dir-header {
  text-align: center;
  padding: 3rem 0 0.25rem;
}

.dir-header h1 {
  font-size: 2.25rem;
  font-weight: 400;
  margin-bottom: 0.2rem;
  letter-spacing: -0.02em;
}

.dir-subtitle {
  color: var(--pico-muted-color);
  font-size: var(--w-text-sm);
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 400;
}

.dir-search-wrap {
  max-width: 400px;
  margin: 1.75rem auto 2rem;
}

.dir-search {
  width: 100%;
  font-size: var(--w-text-md);
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 60%, transparent);
  background: var(--w-surface-2);
  color: var(--pico-color);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dir-search:focus {
  outline: none;
  border-color: var(--pico-primary);
  background: var(--w-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pico-primary) 10%, transparent);
}

.dir-search::placeholder {
  color: var(--pico-muted-color);
  font-weight: 300;
}

.dir-list {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dir-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  border-radius: 14px;
  text-decoration: none;
  color: var(--pico-color);
  border: 1px solid var(--pico-muted-border-color);
  background: var(--w-surface);
  transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.dir-card:hover {
  border-color: color-mix(in srgb, var(--pico-primary) 40%, transparent);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--pico-primary) 8%, transparent),
              0 1px 3px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.dir-card:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.dir-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dir-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--pico-primary-background), color-mix(in srgb, var(--pico-primary-background) 80%, #7c3aed));
  color: var(--pico-primary-inverse);
}

.dir-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dir-card-name {
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.3;
}

.dir-card-meta {
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  font-weight: 400;
}

.dir-card-arrow {
  flex-shrink: 0;
  color: color-mix(in srgb, var(--pico-muted-color) 40%, transparent);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.dir-card:hover .dir-card-arrow {
  color: var(--pico-primary);
  transform: translateX(3px);
}

.dir-empty {
  text-align: center;
  padding: 3.5rem 0;
  color: var(--pico-muted-color);
  font-size: 0.95rem;
  font-weight: 300;
}

.dir-footer {
  text-align: center;
  padding: 2rem 0 1rem;
}

.dir-claim-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--w-text-xs);
  font-weight: 500;
  color: var(--pico-muted-color);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--pico-muted-border-color) 50%, transparent);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  line-height: 1.2;
}

.dir-claim-link:hover {
  color: var(--pico-primary);
  border-color: color-mix(in srgb, var(--pico-primary) 50%, transparent);
  transform: translateY(-1px);
}

/* --- Responsive --- */

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

/* --- Tablet+ (768px) --- */
@media (min-width: 768px) {
  .wall-feed {
    max-width: 520px;
  }

  .wall-feed.feed-grid {
    max-width: 800px;
  }

  .post-text .post-content {
    font-size: 1.15rem;
  }

  .link-card-image {
    max-height: 200px;
  }

  .inline-composer,
  .owner-toolbar {
    max-width: 520px;
  }

  /* Composer footer spreads out */
  .composer-footer {
    gap: 1rem;
  }
}

/* --- Desktop (1024px) --- */
@media (min-width: 1024px) {
  .wall-feed {
    max-width: 560px;
  }

  .wall-feed.feed-grid {
    max-width: 800px;
  }

  .wall-header h1 {
    font-size: 1.8rem;
  }

  .profile-pic {
    width: 84px;
    height: 84px;
  }

  .profile-pic-placeholder {
    width: 84px;
    height: 84px;
    font-size: 2.2rem;
  }

  .profile-pic-wrap {
    width: 84px;
    height: 84px;
  }

  .inline-composer,
  .owner-toolbar {
    max-width: 560px;
  }

  .settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .settings-grid fieldset {
    margin-bottom: 0;
  }

  .settings-form {
    max-width: 100%;
  }

  .feed-card-bottom {
    flex-wrap: nowrap;
    gap: 0.75rem;
  }

  /* Horizontal link cards on large screens */
  .link-card {
    display: flex;
  }

  .link-card-image {
    width: 200px;
    min-width: 200px;
    max-height: none;
    aspect-ratio: auto;
  }

  .link-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* --- Wide desktop (1440px) --- */
@media (min-width: 1440px) {
  .wall-feed {
    max-width: 600px;
  }

  .wall-feed.feed-grid {
    max-width: 900px;
  }
}

/* --- Mobile (576px) --- */
@media (max-width: 576px) {
  .wall-header h1 {
    font-size: 1.25rem;
  }

  .profile-pic,
  .profile-pic-placeholder {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .profile-pic-wrap {
    width: 56px;
    height: 56px;
  }

  .post {
    margin-bottom: 1rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .post-photo img {
    border-radius: 0;
    margin-left: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    margin-right: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    width: calc(100% + 2 * var(--pico-block-spacing-horizontal, 1rem));
    max-width: none;
  }

  .post-video video {
    border-radius: 0;
    margin-left: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    margin-right: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    width: calc(100% + 2 * var(--pico-block-spacing-horizontal, 1rem));
    max-width: none;
  }

  .link-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-left: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    margin-right: calc(-1 * var(--pico-block-spacing-horizontal, 1rem));
    width: calc(100% + 2 * var(--pico-block-spacing-horizontal, 1rem));
  }

  .date-separator {
    margin: 1.5rem 0 0.75rem;
  }

  .composer-footer {
    gap: 0.3rem;
  }

  .wall-tabs {
    font-size: var(--w-text-sm);
  }

  .wall-tabs a,
  .wall-tabs strong {
    padding: 0.35rem 0.75rem;
  }

  .wall-toolbar {
    max-width: 100%;
    height: 38px;
  }

  .wall-toolbar-btn {
    width: 38px;
  }

  .feed-card-bottom {
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
  }

  .feed-card-top {
    padding: 0.5rem 0.65rem;
  }

  .feed-add-row {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-form fieldset {
    padding: 0.65rem 0.85rem;
  }

  .cta-link {
    padding: 0.45rem 0.9rem;
    font-size: var(--w-text-2xs);
  }

  .dir-header {
    padding-top: 2rem;
  }

  .dir-header h1 {
    font-size: 1.75rem;
  }

  .dir-card {
    padding: 0.7rem 0.85rem;
    gap: 0.75rem;
    border-radius: 12px;
  }

  .dir-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.05rem;
  }

  .dir-card-name {
    font-size: var(--w-text-md);
  }

  .unclaimed-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
}

/* =============================================================================
   COMPOSER & MISC
   ============================================================================= */

.post-field {
  margin-bottom: 0.5rem;
}

/* --- Composer footer --- */

.composer-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.composer-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: 6px;
  color: var(--pico-muted-color);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  margin: 0;
  flex-shrink: 0;
}

.composer-tool-btn:hover {
  color: var(--pico-primary);
  background: color-mix(in srgb, var(--pico-primary) 8%, transparent);
}

.composer-tool-btn svg {
  display: block;
  flex-shrink: 0;
}

.composer-footer button[type="submit"] {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1rem;
  font-size: var(--w-text-sm);
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.composer-footer button[type="submit"]:hover {
  opacity: 0.9;
}

.backdate-picker {
  font-size: var(--w-text-sm);
  padding: 0.3rem 0.5rem;
  max-width: 200px;
  margin-bottom: 0;
  flex-shrink: 1;
}

.remove-media {
  background: none;
  border: none;
  color: var(--pico-del-color, #c62828);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 0.3rem;
  vertical-align: middle;
}

/* Remove (×) on the composer's rich URL preview — deletes the rich card only,
   the URL text stays in the draft. */
#link-preview .link-card {
  position: relative;
}

.link-attached-note {
  display: block;
  margin-top: 0.35rem;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
}

.remove-link {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.remove-link:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* (nav-pill-icon and nav-pill-search removed — replaced by wall-tool-btn and wall-search) */

/* Hidden summary for settings panel */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.admin-message {
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

.admin-message.success {
  background: color-mix(in srgb, green 10%, transparent);
  border: 1px solid green;
}

.admin-message.error {
  background: color-mix(in srgb, red 10%, transparent);
  border: 1px solid red;
}

/* =============================================================================
   FOLLOWING TIMELINE — the reader
   A social feed, not an inbox: one column, image-forward cards, ambient read
   state. Styles are token-driven so light/dark come for free.
   ============================================================================= */

.tl {
  --tl-gap: 1.15rem;
  max-width: 580px;
  margin: 0 auto;
}

/* --- source rail (the "stories" row) --- */

.tl-rail {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.25rem 0.15rem 0.9rem;
  margin-bottom: 0.35rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.tl-rail::-webkit-scrollbar { display: none; }

.tl-rail-item {
  all: unset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 62px;
  flex: 0 0 auto;
  cursor: pointer;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
}

.tl-rail-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 2px;
  background: var(--pico-muted-border-color);
  transition: background 0.18s ease, transform 0.18s ease;
}

.tl-rail-item:hover .tl-rail-ring { transform: translateY(-2px); }

/* Unread sources get the accent ring — the one piece of colour in the rail. */
.tl-rail-item.has-unread .tl-rail-ring {
  background: linear-gradient(135deg, var(--pico-primary), color-mix(in srgb, var(--pico-primary) 50%, #e879f9));
}

.tl-rail-item.is-active .tl-rail-ring {
  background: var(--w-fg);
  transform: translateY(-2px);
}

.tl-rail-item.is-muted { opacity: 0.45; }
.tl-rail-item.has-error .tl-rail-ring { background: #d97706; }

.tl-rail-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--w-surface);
  border: 2px solid var(--pico-background-color);
}

.tl-rail-name {
  font-size: var(--w-text-2xs);
  color: var(--pico-muted-color);
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.tl-rail-item.is-active .tl-rail-name {
  color: var(--w-fg);
  font-weight: 600;
}

.tl-rail-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border: 2px solid var(--pico-background-color);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.tl-rail-ring-add {
  background: none;
  border: 1.5px dashed var(--w-border-strong);
  color: var(--pico-muted-color);
}

.tl-rail-add:hover .tl-rail-ring-add {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

/* --- follow panel --- */

.tl-panel {
  background: var(--w-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--w-radius);
  padding: var(--w-space-4);
  margin-bottom: var(--w-space-4);
  box-shadow: var(--w-shadow-sm);
  animation: tl-slide-down 0.22s ease;
}

@keyframes tl-slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.tl-follow-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Pico ships `button[type=submit], input:not(...) { width: 100% }` — an
   (0,1,1) selector that outranks a bare class, so `all: unset` loses and the
   submit button expands to the full row, collapsing the input beside it.
   These element+class selectors are (0,2,1) and win. */
.tl-follow-form button.tl-follow-submit {
  width: auto;
  flex: 0 0 auto;
}

.tl-follow-form input.tl-follow-input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
}

.tl-follow-input {
  flex: 1;
  min-width: 0;
  font-size: var(--w-text-sm) !important;
  padding: 0.55rem 0.9rem !important;
  margin: 0 !important;
  border-radius: 999px;
  border: 1px solid var(--pico-muted-border-color) !important;
  background: var(--pico-background-color);
  color: var(--w-fg);
}

.tl-follow-input:focus {
  outline: none;
  border-color: var(--pico-primary) !important;
  box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

.tl-follow-submit {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.15rem;
  font-size: var(--w-text-sm);
  font-weight: 600;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.tl-follow-submit:hover { opacity: 0.9; }
.tl-follow-submit[disabled] { opacity: 0.6; cursor: default; }

.tl-panel-hint,
.tl-panel-label {
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  margin: 0.6rem 0 0;
}

.tl-panel-label {
  margin-top: var(--w-space-4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tl-sugg-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.5rem;
}

.tl-sugg {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.25rem;
  border-radius: 8px;
}

.tl-sugg:hover { background: var(--w-surface-2); }

.tl-sugg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.tl-sugg-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tl-sugg-name {
  font-size: var(--w-text-md);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-sugg-meta { color: var(--pico-muted-color); font-size: var(--w-text-2xs); }

.tl-sugg-btn {
  all: unset;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--pico-primary);
  color: var(--pico-primary);
  font-size: var(--w-text-xs);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.tl-sugg-btn:hover {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.tl-sugg-btn[disabled] { opacity: 0.6; cursor: default; }

.tl-panel-foot {
  display: flex;
  gap: var(--w-space-4);
  margin-top: var(--w-space-4);
  padding-top: 0.75rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-size: var(--w-text-xs);
}

.tl-opml-import,
.tl-opml-export {
  color: var(--pico-muted-color);
  cursor: pointer;
  text-decoration: none;
}

.tl-opml-import:hover,
.tl-opml-export:hover { color: var(--pico-primary); }

/* --- filter bar --- */

.tl-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.1rem;
  margin-bottom: var(--w-space-2);
  background: color-mix(in srgb, var(--pico-background-color) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
}

.tl-tabs {
  display: flex;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.tl-tab {
  all: unset;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  font-size: var(--w-text-sm);
  font-weight: 500;
  color: var(--pico-muted-color);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.tl-tab:hover { background: var(--w-surface-2); color: var(--w-fg); }

.tl-tab.is-active {
  background: var(--w-surface);
  color: var(--w-fg);
  font-weight: 600;
  box-shadow: var(--w-shadow-sm);
}

.tl-tab-count {
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.tl-bar-tools {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.tl-search {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--w-surface-2);
  transition: border-color 0.15s ease, width 0.2s ease;
}

.tl-search:focus-within { border-color: var(--pico-primary); }
.tl-search-icon { display: flex; color: var(--pico-muted-color); }

/* Pico targets inputs through high-specificity selectors like
   `input:not([type=submit]):not([type=button])`, which outrank a single class —
   `all: unset` alone loses. Re-declare the box explicitly and hold it. */
.tl-search input.tl-search-input,
.tl-search-input {
  all: unset;
  box-sizing: border-box;
  width: 78px;
  height: 22px;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  font-size: var(--w-text-xs);
  line-height: 22px;
  color: var(--w-fg);
  transition: width 0.2s ease;
}

.tl-search input.tl-search-input:focus,
.tl-search-input:focus { width: 130px; }
.tl-search-input::placeholder { color: var(--pico-muted-color); }
.tl-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.tl-icon-btn {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--pico-muted-color);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tl-icon-btn:hover { background: var(--w-surface-2); color: var(--w-fg); }

.tl-icon-btn.is-spinning svg { animation: tl-spin 0.9s linear infinite; }

@keyframes tl-spin { to { transform: rotate(360deg); } }

/* --- selected-source context bar --- */

.tl-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--w-space-2);
  flex-wrap: wrap;
  padding: 0.55rem 0.8rem;
  margin-bottom: var(--w-space-3);
  border-radius: var(--w-radius);
  background: var(--w-surface-2);
  border: 1px solid var(--pico-muted-border-color);
  font-size: var(--w-text-sm);
}

.tl-source-head-name { font-weight: 600; }
.tl-source-head-name small { color: var(--pico-muted-color); font-weight: 400; }
.tl-source-head-acts { display: flex; gap: 0.3rem; }

.tl-source-btn {
  all: unset;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--pico-muted-border-color);
  background: var(--w-surface);
  font-size: var(--w-text-xs);
  color: var(--w-fg);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tl-source-btn:hover { border-color: var(--pico-primary); color: var(--pico-primary); }

.tl-source-btn-danger:hover {
  border-color: #c62828;
  color: #c62828;
}

/* --- feed problem alerts --- */

.tl-alert {
  margin-bottom: var(--w-space-3);
  padding: 0.7rem 0.85rem;
  border-radius: var(--w-radius);
  border: 1px solid color-mix(in srgb, #d97706 45%, var(--pico-muted-border-color));
  background: color-mix(in srgb, #d97706 8%, var(--w-surface));
}

.tl-alert-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-size: var(--w-text-sm);
  font-weight: 600;
  color: var(--w-fg);
}

.tl-alert-head svg { color: #d97706; flex-shrink: 0; }

.tl-alert-list { list-style: none; margin: 0; padding: 0; }

.tl-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--w-space-2);
  flex-wrap: wrap;
  padding: 0.35rem 0;
}

.tl-alert-row + .tl-alert-row { border-top: 1px solid var(--pico-muted-border-color); }

.tl-alert-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--w-text-sm);
}

.tl-alert-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-alert-text small { color: var(--pico-muted-color); font-size: var(--w-text-xs); }

.tl-alert-acts { display: flex; gap: 0.3rem; flex-shrink: 0; }

.tl-source-head-error {
  display: block;
  margin-top: 0.15rem;
  color: #d97706;
  font-weight: 400;
}

.tl-source-head-error svg { vertical-align: -2px; }

/* --- new posts pill --- */

.tl-new-pill {
  position: sticky;
  top: 3.2rem;
  z-index: 25;
  display: flex;
  justify-content: center;
  height: 0;
}

.tl-new-pill button {
  all: unset;
  padding: 0.42rem 1.05rem;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-size: var(--w-text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--w-shadow-md);
  animation: tl-pill-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes tl-pill-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* --- cards --- */

.tl-list {
  display: flex;
  flex-direction: column;
  gap: var(--tl-gap);
}

.tl-card {
  position: relative;
  /* Pico styles bare <article> with its own padding/margin/background — reset
     them so the card can run its media edge to edge. */
  padding: 0;
  margin: 0;
  background: var(--w-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--w-radius);
  overflow: hidden;
  box-shadow: var(--w-shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  animation: tl-card-in 0.3s ease both;
}

@keyframes tl-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tl-card,
  .tl-new-pill button,
  .tl-panel { animation: none; }
  .tl-card,
  .tl-rail-ring,
  .tl-reader-sheet { transition: none; }
}

.tl-card:hover { box-shadow: var(--w-shadow-md); }

.tl-card.is-leaving { opacity: 0; transform: scale(0.97); }

.tl-card.is-cursor {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

/* Read cards recede rather than disappear — the feed stays continuous. */
.tl-card.is-read { opacity: 0.72; }
.tl-card.is-read:hover { opacity: 1; }

.tl-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 0.9rem 0.55rem;
  /* Same Pico `article > header` bleed as the footer — neutralize it. */
  margin: 0;
  width: auto;
  border-radius: 0;
  border-bottom: none;
  background: none;
}

.tl-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.tl-avatar-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--w-text-sm);
  font-weight: 700;
  background: linear-gradient(135deg, var(--pico-primary-background), color-mix(in srgb, var(--pico-primary-background) 60%, #e879f9));
  color: var(--pico-primary-inverse);
}

.tl-head-text {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.tl-src-name {
  font-size: var(--w-text-md);
  font-weight: 600;
  color: var(--w-fg);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-src-name:hover { color: var(--pico-primary); }

.tl-time {
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  flex-shrink: 0;
}

.tl-time::before { content: "· "; }

/* Invisible hit target over the header — "show only this source". */
.tl-src-only {
  all: unset;
  position: absolute;
  inset: 0 0 auto 0;
  height: 52px;
  cursor: pointer;
}

.tl-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pico-primary);
  flex-shrink: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tl-card.is-read .tl-unread-dot { opacity: 0; transform: scale(0.5); }

/* The card body is a div carrying role="button" for keyboard access. Pico
   paints anything with that role as a filled primary button, so every visual
   property has to be reset back to a plain block. */
.tl-body {
  display: block;
  position: relative;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
  -webkit-user-select: text;
  user-select: text;
}

.tl-body:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: -2px;
}

.tl-body-post { cursor: default; }

/* Feed images arrive at wildly different shapes — 3:1 banners, square logos,
   tall screenshots. A fixed 16:9 box with object-fit:cover zoomed a 2.8:1
   banner until only its middle third was visible, which is how a headline
   screenshot turned into an unreadable close-up.
   Instead: let the image keep its natural ratio (height:auto), so anything
   wide or square shows in full and is never cropped. Only genuinely tall
   images exceed the cap, and those crop from the top — where the subject
   almost always is — rather than from the middle. */
.tl-media {
  max-height: 420px;
  overflow: hidden;
  background: var(--w-surface-2);
}

.tl-media img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tl-body:hover .tl-media img { transform: scale(1.02); }

.tl-text { padding: 0.75rem 0.9rem 0.2rem; }

.tl-title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--w-fg);
}

.tl-excerpt {
  margin: 0;
  font-size: var(--w-text-md);
  line-height: 1.5;
  color: var(--pico-muted-color);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* A local wall post keeps its own card styling inside the timeline card. */
.tl-body-post .post {
  margin: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}

.tl-body-post .post footer { display: none; }

.tl-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--w-space-2);
  padding: 0.6rem 0.9rem 0.7rem;
  /* Pico gives `article > footer` negative horizontal margins so it can bleed
     against the article's own padding. The card sets padding: 0, so those
     margins would push the footer past the (overflow: hidden) card edge and
     clip the domain. */
  margin: 0;
  width: auto;
  border-radius: 0;
  background: none;
}

/* Must stay a block for text-overflow to work — ellipsis is ignored on a flex
   container, which let long domains overflow and clip mid-word. */
.tl-meta {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-domain { font-weight: 500; }
.tl-byline::before { content: " · "; }
.tl-permalink { color: var(--pico-muted-color); text-decoration: none; }
.tl-permalink:hover { color: var(--pico-primary); }

.tl-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.tl-act {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--pico-muted-color);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tl-act:hover { background: var(--w-surface-2); color: var(--w-fg); }
.tl-act:active { transform: scale(0.88); }
.tl-act-save.is-saved { color: var(--pico-primary); }

/* --- empty + skeleton --- */

.tl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 3.5rem 1rem;
  color: var(--pico-muted-color);
}

.tl-empty svg { opacity: 0.5; margin-bottom: 0.4rem; }
.tl-empty-title { margin: 0; font-size: var(--w-text-lg); font-weight: 600; color: var(--w-fg); }
.tl-empty-sub { margin: 0; font-size: var(--w-text-md); max-width: 34ch; }

.tl-skeleton {
  padding: 0.8rem 0.9rem;
  animation: none;
}

.tl-sk-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }

.tl-sk-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tl-sk-media {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  margin-bottom: 0.7rem;
}

.tl-sk-line { height: 12px; border-radius: 6px; margin-bottom: 0.5rem; }
.tl-sk-line.short { width: 55%; }

.tl-sk-avatar,
.tl-sk-media,
.tl-sk-line {
  background: linear-gradient(90deg, var(--w-surface-2) 25%, var(--pico-muted-border-color) 50%, var(--w-surface-2) 75%);
  background-size: 200% 100%;
  animation: tl-shimmer 1.4s ease-in-out infinite;
}

@keyframes tl-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* --- pull to refresh --- */

.tl-ptr {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -18px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--w-surface);
  color: var(--pico-muted-color);
  box-shadow: var(--w-shadow-md);
  transition: opacity 0.2s ease;
  z-index: 30;
}

.tl-ptr.is-ready { color: var(--pico-primary); }

/* --- article reader overlay --- */

body.tl-noscroll { overflow: hidden; }

.tl-reader {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.tl-reader.show { opacity: 1; }

.tl-reader-sheet {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  height: min(94vh, 100%);
  background: var(--pico-background-color);
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  box-shadow: var(--w-shadow-md);
  transform: translateY(18px);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tl-reader.show .tl-reader-sheet { transform: none; }

.tl-reader-bar {
  display: flex;
  align-items: center;
  gap: var(--w-space-2);
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  background: var(--w-surface);
  flex-shrink: 0;
}

.tl-reader-src {
  flex: 1;
  min-width: 0;
  font-size: var(--w-text-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-reader-acts { display: flex; align-items: center; gap: 0.15rem; }

.tl-reader-close,
.tl-reader-save,
.tl-reader-ext {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--pico-muted-color);
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.tl-reader-close:hover,
.tl-reader-save:hover,
.tl-reader-ext:hover { background: var(--w-surface-2); color: var(--w-fg); }

.tl-reader-save.is-saved { color: var(--pico-primary); }

.tl-reader-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--w-space-5) var(--w-space-4) 4rem;
}

.tl-reader-loading {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--pico-primary), transparent);
  background-size: 200% 100%;
  animation: tl-shimmer 1.1s linear infinite;
}

/* --- article typography --- */

.tl-art {
  max-width: 68ch;
  margin: 0 auto;
}

.tl-art-head { margin-bottom: var(--w-space-4); }

.tl-art-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tl-art-meta {
  margin: 0;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
}

.tl-art-hero {
  margin: 0 0 var(--w-space-5);
  border-radius: var(--w-radius);
  overflow: hidden;
}

.tl-art-hero img { width: 100%; display: block; }

.tl-art-body {
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--w-fg);
}

.tl-art-body > :first-child { margin-top: 0; }
.tl-art-body p { margin: 0 0 1.1em; }

.tl-art-body h1,
.tl-art-body h2,
.tl-art-body h3,
.tl-art-body h4 {
  margin: 1.8em 0 0.5em;
  line-height: 1.3;
  font-weight: 650;
}

.tl-art-body h1 { font-size: 1.5rem; }
.tl-art-body h2 { font-size: 1.3rem; }
.tl-art-body h3 { font-size: 1.12rem; }

.tl-art-body a {
  color: var(--pico-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.tl-art-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--w-radius);
  margin: 1.2em 0;
  display: block;
}

.tl-art-body figure { margin: 1.4em 0; }

.tl-art-body figcaption {
  margin-top: 0.5em;
  font-size: var(--w-text-xs);
  color: var(--pico-muted-color);
  text-align: center;
}

.tl-art-body blockquote {
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1.1em;
  border-left: 3px solid var(--pico-primary);
  color: var(--pico-muted-color);
  font-style: italic;
}

.tl-art-body ul,
.tl-art-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.tl-art-body li { margin-bottom: 0.4em; }

.tl-art-body pre {
  overflow-x: auto;
  padding: var(--w-space-3);
  border-radius: 8px;
  background: var(--w-surface-2);
  font-size: var(--w-text-sm);
  line-height: 1.5;
}

.tl-art-body code {
  font-size: 0.9em;
  background: var(--w-surface-2);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}

.tl-art-body pre code { background: none; padding: 0; }

.tl-art-body hr {
  margin: 2em 0;
  border: none;
  border-top: 1px solid var(--pico-muted-border-color);
}

/* Wide tables scroll inside the article rather than stretching the sheet. */
.tl-art-body table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--w-text-sm);
  margin-bottom: 1.2em;
}

.tl-art-body th,
.tl-art-body td {
  padding: 0.5em 0.7em;
  border: 1px solid var(--pico-muted-border-color);
  text-align: left;
}

.tl-art-nobody {
  color: var(--pico-muted-color);
  font-style: italic;
}

.tl-art-post .post {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

/* --- wider screens --- */

@media (min-width: 720px) {
  .tl-reader { align-items: center; }
  .tl-reader-sheet { border-radius: 18px; height: min(88vh, 900px); }
  .tl-reader-body { padding: var(--w-space-6) var(--w-space-5) 4rem; }
}

@media (max-width: 480px) {
  .tl-bar { gap: 0.3rem; }
  .tl-tab { padding: 0.3rem 0.55rem; font-size: var(--w-text-xs); }
  .tl-search-input { width: 60px; }
  .tl-search-input:focus { width: 96px; }
}


/* =============================================================================
   TOASTS & CONFIRM DIALOG (styled replacements for native alert/confirm)
   ============================================================================= */

#wall-toasts {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}

.wall-toast {
  pointer-events: auto;
  max-width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--pico-color);
  color: var(--pico-background-color);
  font-size: var(--w-text-sm);
  line-height: 1.4;
  box-shadow: var(--w-shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wall-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.wall-toast-error {
  background: #c62828;
  color: #fff;
}

.wall-toast-success {
  background: #2e7d32;
  color: #fff;
}

.wall-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.wall-confirm-overlay.show {
  opacity: 1;
}

.wall-confirm {
  width: 100%;
  max-width: 360px;
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 12px;
  background: var(--pico-card-background-color, #fff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.96);
  transition: transform 0.15s ease;
}

.wall-confirm-overlay.show .wall-confirm {
  transform: scale(1);
}

.wall-confirm-msg {
  margin: 0 0 1rem;
  font-size: var(--w-text-md);
  line-height: 1.5;
  color: var(--pico-color);
}

.wall-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.wall-confirm-actions button {
  font-family: inherit;
  font-size: var(--w-text-sm);
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.wall-confirm-cancel {
  background: transparent;
  color: var(--pico-color);
  border-color: var(--pico-muted-border-color);
}

.wall-confirm-cancel:hover {
  background: color-mix(in srgb, var(--pico-muted-color) 8%, transparent);
}

.wall-confirm-ok {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.wall-confirm-ok.danger {
  background: #c62828;
}

.wall-confirm-ok:hover {
  opacity: 0.9;
}

