/* ── Top Nav (logged-out) ── */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 1rem;
  background: var(--background);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .topnav { padding-inline: 1.5rem; }
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

/* Brand mark: icon tuned for surface (see assets/img/wordtipperlogo-*-background.svg) */
.logo-mark {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  box-sizing: border-box;
  vertical-align: middle;
  text-decoration: none;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: url('../assets/img/wordtipperlogo-light-background.svg?v=2') center / contain no-repeat;
}

.dark .logo-mark {
  background-image: url('../assets/img/wordtipperlogo-dark-background.svg?v=2');
}

/* Log in / sign up (nav sits on --primary background) */
.auth-logo-mark {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 2.125rem;
  height: 2.125rem;
  box-sizing: border-box;
  text-decoration: none;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: url('../assets/img/wordtipperlogo-dark-background.svg?v=2') center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

@media (min-width: 1024px) {
  .auth-logo-mark {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Home hero: same mark as sidebar (light-background.svg) with inverted colours — white tile + navy W on photo */
.hero-logo-mark {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 2.5rem;
  box-sizing: border-box;
  font-size: 0;
  line-height: 0;
  color: transparent;
  background: url('../assets/img/wordtipperlogo-hero.svg?v=6') center / contain no-repeat;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
  flex-shrink: 0;
}


.topnav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
}

@media (min-width: 768px) {
  .topnav-links { display: flex; }
}

.topnav-link {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: 0.375rem;
  transition: color 150ms ease, background 150ms ease;
}

.topnav-link:hover {
  color: var(--foreground);
  background: var(--accent);
}

.topnav-link.active {
  color: var(--foreground);
  font-weight: 600;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  color: var(--foreground);
}

.hamburger:hover { background: var(--accent); }

@media (min-width: 768px) {
  .hamburger { display: none; }
}

/* ── Mobile Sheet (logged-out nav) ── */

.mobile-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.21 0.04 265 / 0.4);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.mobile-sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--card);
  z-index: 51;
  transform: translateX(100%);
  transition: transform 300ms ease;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
}

.mobile-sheet-backdrop.open .mobile-sheet {
  transform: translateX(0);
}

.mobile-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.mobile-sheet-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
}

/* ── Marketing top bar (no sidebar) ── */

.wt-public-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (min-width: 640px) {
  .wt-public-topnav { padding-inline: 1.5rem; }
}

.wt-public-topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.wt-marketing-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wt-marketing-page .wt-marketing-main {
  flex: 1;
}

/* ── Info pages layout (About, Contact, Terms, Privacy) ── */

.wt-info-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wt-info-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
  padding: 0 1rem 5rem;
  gap: 0;
}

@media (min-width: 768px) {
  .wt-info-body {
    grid-template-columns: 180px 1fr;
    gap: 3rem;
    padding: 0 1.5rem 5rem;
  }
}

.wt-info-sidenav {
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

@media (min-width: 768px) {
  .wt-info-sidenav {
    position: sticky;
    top: 4.5rem;
    align-self: start;
    height: fit-content;
    border-right: 1px solid var(--border);
    padding-right: 1.5rem;
  }
}

.wt-info-sidenav-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
  padding: 0 0.625rem;
}

.wt-info-sidenav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background 150ms, color 150ms;
  margin-bottom: 1px;
}

.wt-info-sidenav-link:hover {
  background: var(--accent);
  color: var(--foreground);
}

.wt-info-sidenav-link.is-active {
  background: var(--accent);
  color: var(--foreground);
  font-weight: 600;
}

/* On mobile, sidenav becomes a horizontal scroll strip */
@media (max-width: 767px) {
  .wt-info-sidenav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--border);
  }
  .wt-info-sidenav-title { display: none; }
  .wt-info-sidenav-link {
    display: inline-flex;
  }
}

.wt-info-main {
  min-width: 0;
  padding-top: 2.5rem;
}

/* ── Footer ── */

.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 3.5rem 1.5rem 0;
}

/* ── Footer newsletter strip ────────────────────────────────────────────── */
/* Newsletter — inline inside footer brand column */
.footer-newsletter-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 0.375rem;
  flex-wrap: wrap;
}
.footer-newsletter-input {
  flex: 1 1 180px;
  min-width: 0;
  height: 2.125rem;
  font-size: 0.8125rem;
  padding: 0 0.75rem;
}
.footer-newsletter-btn {
  flex-shrink: 0;
  height: 2.125rem;
}
.footer-newsletter-msg {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  min-height: 1rem;
}

/* Stacked shell: main grows, footer sits at bottom */
body.wt-inject-site-footer {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.wt-inject-site-footer > .app-layout {
  flex: 1 0 auto;
}

body.wt-inject-site-footer > .site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

body.wt-inject-site-footer > .site-footer.wt-footer-injected {
  margin-top: 2rem;
}

body.wt-inject-site-footer > .wt-home-root {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Home (index): footer lives inside .wt-home-root so it scrolls with content and shows without JS */
body.wt-inject-site-footer > .wt-home-root > .app-layout {
  flex: 1 1 auto;
  min-height: 0;
}

body.wt-inject-site-footer > .wt-home-root > .site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

body.wt-inject-site-footer > .wt-home-root > .site-footer.wt-footer-static {
  margin-top: 0;
  padding-top: calc(3.5rem + 2rem); /* visual gap moved inside footer so its background covers the ::before strip */
}

body.wt-inject-site-footer > .wt-page-stack {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Full-height left rail: one continuous card strip beside main + footer (desktop with app shell) */
@media (min-width: 1024px) {
  body.wt-inject-site-footer:has(.app-layout) {
    position: relative;
  }
  body.wt-inject-site-footer:has(.app-layout)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 0;
    pointer-events: none;
    background: var(--card);
    border-right: 1px solid var(--border);
  }
  html.wt-sidebar-collapsed body.wt-inject-site-footer:has(.app-layout)::before {
    width: 62px;
  }
}

/* Keep app shell + footers above the ::before without hiding the left rail (home: .wt-home-root stays transparent) */
body.wt-inject-site-footer:has(.app-layout) > .app-layout,
body.wt-inject-site-footer:has(.app-layout) > .site-footer,
body.wt-inject-site-footer:has(.app-layout) .wt-home-root > .app-layout,
body.wt-inject-site-footer:has(.app-layout) .wt-home-root > .site-footer {
  position: relative;
  z-index: 1;
}

/* ── Footer layout ── */

.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem 2rem;
  max-width: 1060px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

@media (min-width: 640px) {
  .footer-inner { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 960px) {
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2.5rem 3rem; }
}

/* Brand column */
.footer-brand-col {
  grid-column: 1 / -1; /* full width on mobile */
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

@media (min-width: 960px) {
  .footer-brand-col { grid-column: auto; }
}

.footer-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--foreground);
  width: fit-content;
}

.footer-brand-logo .logo-mark {
  width: 1.875rem;
  height: 1.875rem;
  flex-shrink: 0;
}

.footer-brand-name {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.footer-brand-desc {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  margin: 0;
  max-width: 26rem;
}

.footer-brand-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Nav columns */
.footer-nav-col {
  display: flex;
  flex-direction: column;
}

.footer-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 0.875rem;
}

.footer-link {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.875rem;
  color: var(--foreground);
  text-decoration: none;
  transition: color 150ms ease;
}

.footer-link:hover { color: var(--primary); }

/* Bottom bar */
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.footer-bottom-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-bottom-logo {
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0.5;
}

.footer-bottom-made {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Legacy classes — no longer used */

/* ── App Shell (logged-in) ── */

.app-layout {
  display: flex;
  min-height: 100vh;
  /* Sidebar stays sticky + viewport-tall; main column can grow; left rail is body::before on lg+ */
  align-items: flex-start;
}

/* Desktop sidebar: scrolls on its own; full-height strip comes from body::before (lg+) */
.sidebar {
  display: none;
  flex-direction: column;
  width: 260px;
  height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  border-right: 1px solid var(--border);
  background: var(--card);
  padding: 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  /* auto: no reserved gutter when content fits; scrollbars only if overflow */
  transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

/* html class set by scripts/sidebar-collapse-early.js before first paint to avoid expand→shrink flash */
html.wt-sidebar-collapsed .sidebar,
.sidebar.collapsed {
  width: 62px;
  /* Symmetric padding; children span full width so inner content can be truly centred */
  padding: 0.75rem 0.5rem;
  align-items: stretch;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  /* Sticky: stay in the viewport while the main column scrolls; inner overflow-y: auto
     scrolls the rail when “Following” (etc.) is tall. Do not use position: relative here
     or the sidebar scrolls away with the page. */
  .sidebar {
    display: flex;
    background: transparent;
    border-right: none;
    position: sticky;
    top: 0;
    z-index: 1;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.25rem 0.75rem;
  gap: 0.5rem;
}

.sidebar-brand-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.sidebar-brand-name {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-width: 0;
  opacity: 1;
  transition: opacity 200ms ease;
}

/* Rail: don’t use width:0 (flex min-width:auto still reserves space) — remove from flow */
html.wt-sidebar-collapsed .sidebar .sidebar-brand-name,
.sidebar.collapsed .sidebar-brand-name {
  display: none;
}

html.wt-sidebar-collapsed .sidebar .sidebar-collapse-text,
.sidebar.collapsed .sidebar-collapse-text { display: none; }

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--muted-foreground);
  border-radius: 0.375rem;
  transition: background 150ms ease, color 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--accent); color: var(--foreground); }

html.wt-sidebar-collapsed .sidebar .sidebar-brand,
.sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 0.25rem 0 0.5rem;
  gap: 0.25rem;
  box-sizing: border-box;
}
html.wt-sidebar-collapsed .sidebar .sidebar-brand-left,
.sidebar.collapsed .sidebar-brand-left {
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 0;
}
/* Logo tile — centre in rail (period ::after is inside the box) */
html.wt-sidebar-collapsed .sidebar .sidebar-brand .logo-mark,
html.wt-sidebar-collapsed .sidebar a.sidebar-brand-left .logo-mark,
html.wt-sidebar-collapsed .sidebar a.logo-mark,
.sidebar.collapsed .sidebar-brand .logo-mark,
.sidebar.collapsed a.sidebar-brand-left .logo-mark,
.sidebar.collapsed a.logo-mark {
  display: block;
  margin: 0 auto;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
}
html.wt-sidebar-collapsed .sidebar .sidebar-toggle svg,
.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-expand-btn { display: none; }

/* User card in sidebar */
.user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  transition: padding 200ms ease, border-color 200ms ease;
}

html.wt-sidebar-collapsed .sidebar .user-card,
.sidebar.collapsed .user-card {
  display: none;
}
html.wt-sidebar-collapsed .sidebar .user-card .dropdown-menu,
.sidebar.collapsed .user-card .dropdown-menu { display: none; }

.user-card-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  transition: background 100ms ease;
}

.user-card-main:hover { background: var(--accent); }


.user-card-info {
  flex: 1; min-width: 0;
  opacity: 1;
  transition: opacity 200ms ease;
}

.user-card-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-email {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* Account dropdown: balance + withdraw, then links */
.user-card-dropdown-head {
  padding: 0.5rem 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.user-card-dropdown-balance-row {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.35;
}
.user-card-dropdown-balance-row .user-card-dropdown-balance {
  color: var(--foreground);
  font-weight: 600;
}
.user-card-dropdown-withdraw {
  width: 100%;
  margin-top: 0.5rem;
  justify-content: center;
  box-sizing: border-box;
}

/* ── Drawer (mobile/tablet) user-card: same click-to-open dropdown pattern as
   the desktop sidebar, but the popup renders IN-FLOW (pushes other drawer
   items down) instead of as an absolute popover. ── */
.user-card.user-card--drawer {
  padding: 0.5rem;
}
.user-card--drawer .dropdown { position: static; }
.user-card--drawer .dropdown-menu {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.25rem;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: auto;
}
.user-card--drawer .user-card-dropdown-head {
  padding: 0.5rem 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}
.user-card--drawer .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 0.375rem;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.user-card--drawer .dropdown-item:hover { background: var(--accent); }
.user-card--drawer .dropdown-item.destructive { color: var(--destructive); }
.user-card--drawer .dropdown-item.destructive:hover { background: oklch(0.58 0.22 27 / 0.08); }
.user-card--drawer .dropdown.open .user-card-chevron { transform: rotate(180deg); }
.user-card--drawer .user-card-chevron { transition: transform 200ms ease; }
/* Children of the toggle should never absorb clicks — make every tap inside
   the user-card-main land on the trigger itself so the toggle always fires. */
.user-card--drawer [data-dropdown-trigger] > * { pointer-events: none; }

.user-card-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding: 0.5rem 0.625rem;
  background: oklch(0.96 0.01 250 / 0.6);
  border-radius: 0.5rem;
  font-size: 0.75rem;
}

.user-card-balance-label { color: var(--muted-foreground); }

.withdraw-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--foreground);
  color: var(--background);
}


/* Sidebar CTAs */
.sidebar-ctas {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.75rem;
}

html.wt-sidebar-collapsed .sidebar .sidebar-ctas,
.sidebar.collapsed .sidebar-ctas {
  align-items: center;
  align-self: center;
  width: 2.5rem;
  max-width: 2.5rem;
  margin: 0 auto;
}

html.wt-sidebar-collapsed .sidebar .sidebar-ctas .btn,
.sidebar.collapsed .sidebar-ctas .btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 9999px;
  justify-content: center;
  position: relative;
  margin: 0 auto;
}

html.wt-sidebar-collapsed .sidebar .sidebar-ctas .btn span,
.sidebar.collapsed .sidebar-ctas .btn span { display: none; }

/* Sidebar following list */
.sidebar-section-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  padding: 0.75rem 0.25rem 0.375rem;
  line-height: 1.25;
  flex-shrink: 0;
  white-space: normal;
  overflow: visible;
  word-wrap: break-word;
  hyphens: auto;
  text-decoration: none;
  display: block;
}

a.sidebar-section-heading--link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--foreground);
}

/* Collapsed rail: heading link — keep same underline-on-hover */
html.wt-sidebar-collapsed .sidebar a.sidebar-section-heading--link:hover,
.sidebar.collapsed a.sidebar-section-heading--link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.find-towns-btn + .sidebar-section-heading {
  margin-top: 1.25rem;
  transition: opacity 200ms ease;
}

html.wt-sidebar-collapsed .sidebar .sidebar-section-heading,
.sidebar.collapsed .sidebar-section-heading {
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.25rem 0.15rem 0.15rem;
  border-top: 1px solid var(--border);
  margin-top: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
}

html.wt-sidebar-collapsed .sidebar .sidebar-following-word,
.sidebar.collapsed .sidebar-following-word {
  display: none;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: 0.375rem;
  transition: background 100ms ease, color 100ms ease;
  position: relative;
  white-space: nowrap;
  min-width: 0;
}

/* Long town/author names: ellipsis so the rail width stays fixed and headings don’t get pushed */
.sidebar-nav-link > span:not(.sidebar-nav-icon) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-link .sidebar-nav-text {
  white-space: normal;
}

.sidebar-nav-link .wt-town-label__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.sidebar-nav-link:hover {
  background: var(--muted);
  color: var(--foreground);
}

.sidebar-nav-link.active {
  background: var(--muted);
  color: var(--foreground);
  font-weight: 600;
}

.sidebar-all-slot {
  margin-top: 2rem;
}

html.wt-sidebar-collapsed .sidebar .sidebar-all-slot,
.sidebar.collapsed .sidebar-all-slot {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.sidebar-all-link .sidebar-nav-icon {
  background: var(--muted);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-draggable {
  cursor: pointer;
  transition: opacity 150ms ease, background 150ms ease;
}
.sidebar-dragging {
  opacity: 0.4;
}
.sidebar-drag-over {
  background: var(--accent);
  border-radius: var(--radius);
}

.sidebar-nav-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.6875rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-nav-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.sidebar-nav-icon--avatar {
  background: var(--muted);
  color: var(--muted-foreground);
}

html.wt-sidebar-collapsed .sidebar .sidebar-nav-link,
.sidebar.collapsed .sidebar-nav-link {
  justify-content: center;
  align-items: center;
  align-self: center;
  min-height: 2.5rem;
  width: 2.5rem;
  max-width: 2.5rem;
  box-sizing: border-box;
  padding: 0.25rem;
  margin: 0 auto;
}
html.wt-sidebar-collapsed .sidebar .sidebar-nav-link span:not(.sidebar-nav-icon),
.sidebar.collapsed .sidebar-nav-link span:not(.sidebar-nav-icon) { display: none; }

/* Collapsed: All Articles — match My Articles: .btn.btn-outline in .sidebar-ctas (light fill + grey ring) */
html.wt-sidebar-collapsed .sidebar .sidebar-nav-link.sidebar-all-link,
.sidebar.collapsed .sidebar-nav-link.sidebar-all-link {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  min-height: 2.5rem;
  margin: 0 auto;
  padding: 0;
  border-radius: 9999px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  /* Same as .btn-outline: transparent fill, grey ring; reads as a white disc on the card in light mode */
  background: transparent;
  color: var(--foreground);
  text-decoration: none;
  font-weight: 500;
  justify-content: center;
  align-items: center;
}
html.wt-sidebar-collapsed .sidebar .sidebar-nav-link.sidebar-all-link:hover,
.sidebar.collapsed .sidebar-nav-link.sidebar-all-link:hover {
  background: var(--accent);
  color: var(--foreground);
}
html.wt-sidebar-collapsed .sidebar .sidebar-nav-link.sidebar-all-link .sidebar-nav-icon,
.sidebar.collapsed .sidebar-nav-link.sidebar-all-link .sidebar-nav-icon {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border-radius: inherit;
  /* No muted fill — icon sits on the same surface as My Articles */
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Collapsed rail: one icon size for glyphs (SVG + chevron), pills for letter marks */
html.wt-sidebar-collapsed .sidebar .sidebar-nav-icon,
.sidebar.collapsed .sidebar-nav-icon {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.625rem;
}

html.wt-sidebar-collapsed .sidebar .sidebar-nav-link svg,
html.wt-sidebar-collapsed .sidebar .sidebar-ctas .btn svg,
html.wt-sidebar-collapsed .sidebar .find-towns-btn svg,
html.wt-sidebar-collapsed .sidebar .find-authors-btn svg,
html.wt-sidebar-collapsed .sidebar .sidebar-toggle svg,
html.wt-sidebar-collapsed .sidebar .sidebar-expand-btn svg,
.sidebar.collapsed .sidebar-nav-link svg,
.sidebar.collapsed .sidebar-ctas .btn svg,
.sidebar.collapsed .find-towns-btn svg,
.sidebar.collapsed .find-authors-btn svg,
.sidebar.collapsed .sidebar-toggle svg,
.sidebar.collapsed .sidebar-expand-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

html.wt-sidebar-collapsed .sidebar .sidebar-toggle,
.sidebar.collapsed .sidebar-toggle {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto;
}

/* Collapsed sidebar labels: fixed tooltip (see main.js — avoids overflow clip) */
.wt-sidebar-tooltip {
  position: fixed;
  z-index: 10050;
  padding: 0.375rem 0.75rem;
  max-width: min(280px, calc(100vw - 1rem));
  background: var(--foreground);
  color: var(--background);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  border-radius: 0.375rem;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: none;
  box-shadow: 0 4px 20px oklch(0.2 0.02 250 / 0.18);
  opacity: 0;
  transition: opacity 120ms ease;
}
.wt-sidebar-tooltip.visible {
  opacity: 1;
}

.find-towns-btn,
.find-authors-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.25rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  border: 1px dashed var(--border);
  border-radius: 9999px;
  background: none;
  cursor: pointer;
  transition: background 100ms ease;
  width: fit-content;
  position: relative;
  white-space: nowrap;
}

.find-towns-btn:hover,
.find-authors-btn:hover { background: var(--accent); }

html.wt-sidebar-collapsed .sidebar .find-towns-btn,
html.wt-sidebar-collapsed .sidebar .find-authors-btn,
.sidebar.collapsed .find-towns-btn,
.sidebar.collapsed .find-authors-btn {
  /* Match CTA / nav circle size and centre in rail */
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  justify-content: center;
  border-radius: 9999px;
  margin: 0.25rem auto 0;
  align-self: center;
}
html.wt-sidebar-collapsed .sidebar .find-towns-btn .sidebar-collapse-text,
html.wt-sidebar-collapsed .sidebar .find-authors-btn .sidebar-collapse-text,
.sidebar.collapsed .find-towns-btn .sidebar-collapse-text,
.sidebar.collapsed .find-authors-btn .sidebar-collapse-text { display: none; }

/* Centre town/author link stacks in the rail (IDs from render + pages) */
html.wt-sidebar-collapsed .sidebar #sidebarFollowingTowns,
html.wt-sidebar-collapsed .sidebar #sidebarFollowingAuthors,
.sidebar.collapsed #sidebarFollowingTowns,
.sidebar.collapsed #sidebarFollowingAuthors {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.sidebar-promo {
  position: relative;
  margin-top: 1.25rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Pen + pound — left, above the copy */
.sidebar-promo-icons {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding-right: 1.5rem; /* keep clear of close button */
}
.sidebar-promo-icon {
  display: block;
  flex-shrink: 0;
  color: var(--muted-foreground);
  opacity: 0.95;
}
.sidebar-promo-icon text {
  font-weight: 700;
}

.sidebar-promo-close {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 20px;
  text-align: center;
  padding: 0;
  opacity: 0.4;
  transition: opacity 150ms;
}
.sidebar-promo-close:hover { opacity: 1; }
.sidebar-promo-text {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0 0 0.375rem;
  padding-right: 1.25rem;
  text-align: left;
  word-wrap: break-word;
}
.sidebar-promo-link {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  text-decoration: none;
}
.sidebar-promo-link:hover { text-decoration: underline; }
html.wt-sidebar-collapsed .sidebar .sidebar-promo,
.sidebar.collapsed .sidebar-promo { display: none; }

/* ── Logged-out sidebar skin (blue, white logo, login + create account) ── */

/* FOUC prevention: hide opposite state immediately based on early html class */
html.wt-auth-signed-in [data-auth="logged-out"] { display: none !important; }
html.wt-auth-signed-out [data-auth="logged-in"] { display: none !important; }

/* Universal hide for the default logged-in sidebar elements when signed out
   (so pages that haven't been wrapped with data-auth attributes still hide them). */
html.wt-auth-signed-out .sidebar > .user-card,
html.wt-auth-signed-out .sidebar > .sidebar-ctas,
html.wt-auth-signed-out .sidebar > .sidebar-all-slot,
html.wt-auth-signed-out .sidebar > .sidebar-section-heading,
html.wt-auth-signed-out .sidebar > #sidebarFollowingTowns,
html.wt-auth-signed-out .sidebar > #sidebarFollowingAuthors,
html.wt-auth-signed-out .sidebar > .find-towns-btn,
html.wt-auth-signed-out .sidebar > .find-authors-btn,
html.wt-auth-signed-out .sidebar > .sidebar-promo {
  display: none !important;
}

/* Same for the mobile drawer */
html.wt-auth-signed-out .drawer > .user-card,
html.wt-auth-signed-out .drawer > .sidebar-ctas,
html.wt-auth-signed-out .drawer > .sidebar-all-slot,
html.wt-auth-signed-out .drawer > .sidebar-section-heading,
html.wt-auth-signed-out .drawer > #drawerFollowingTowns,
html.wt-auth-signed-out .drawer > #drawerFollowingAuthors,
html.wt-auth-signed-out .drawer > .find-towns-btn,
html.wt-auth-signed-out .drawer > .find-authors-btn,
html.wt-auth-signed-out .drawer > .drawer-footer,
html.wt-auth-signed-out .drawer > a.btn,
html.wt-auth-signed-out .drawer > .sidebar-promo {
  display: none !important;
}

/* Tint the desktop sidebar AND the strip behind it when not signed in */
@media (min-width: 1024px) {
  html.wt-auth-signed-out body.wt-inject-site-footer:has(.app-layout)::before {
    background: var(--primary);
    border-right-color: oklch(0.32 0.06 265);
  }
}

html.wt-auth-signed-out .sidebar {
  background: var(--primary);
  border-right-color: oklch(0.32 0.06 265);
  color: oklch(0.96 0.01 265);
}

/* Brand: white logo + white wordmark */
html.wt-auth-signed-out .sidebar .sidebar-brand-name {
  color: white;
}
html.wt-auth-signed-out .sidebar .sidebar-brand .logo-mark,
html.wt-auth-signed-out .sidebar a.sidebar-brand-left .logo-mark,
html.wt-auth-signed-out .sidebar a.logo-mark {
  background-image: url('../assets/img/wordtipperlogo-dark-background.svg?v=2');
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

/* Toggle button: lighten on the dark background */
html.wt-auth-signed-out .sidebar .sidebar-toggle {
  color: oklch(0.85 0.02 265);
}
html.wt-auth-signed-out .sidebar .sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}
html.wt-auth-signed-out .sidebar .sidebar-expand-btn {
  color: oklch(0.85 0.02 265);
}
html.wt-auth-signed-out .sidebar .sidebar-expand-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

/* Logged-out CTA card */
.sidebar-loggedout {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem 0.75rem;
  margin-top: 0.25rem;
}

.sidebar-loggedout-pitch {
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: oklch(0.92 0.01 265);
  padding: 0 0.25rem;
}

.sidebar-loggedout .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.sidebar-loggedout-btn-primary {
  background: white;
  color: var(--primary);
  border: 1px solid white;
}
.sidebar-loggedout-btn-primary:hover {
  background: oklch(0.94 0.01 265);
  color: var(--primary);
}

.sidebar-loggedout-btn-outline {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.sidebar-loggedout-btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.85);
  color: white;
}

/* Secondary links beneath the buttons */
.sidebar-loggedout-meta {
  margin-top: 1rem;
  padding: 0.875rem 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
}
.sidebar-loggedout-meta-heading {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: oklch(0.85 0.02 265);
  margin: 0 0 0.5rem;
}
.sidebar-loggedout-meta-link {
  display: block;
  padding: 0.3rem 0;
  font-size: 0.8125rem;
  color: oklch(0.96 0.01 265);
  text-decoration: none;
  transition: color 150ms ease;
}
.sidebar-loggedout-meta-link:hover {
  color: white;
  text-decoration: underline;
}

/* Collapsed rail in logged-out state — show CTAs as square icon-only buttons */
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout {
  padding: 0.5rem 0.125rem;
  align-items: center;
  gap: 0.45rem;
}
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout .sidebar-loggedout-pitch,
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout .sidebar-loggedout-meta,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout .sidebar-loggedout-pitch,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout .sidebar-loggedout-meta {
  display: none;
}
/* Hide the button labels — only icons remain */
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout .btn span,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout .btn span {
  display: none;
}
/* Icon buttons: square, centered, just the SVG */
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout .btn,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout .btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  gap: 0;
}
html.wt-sidebar-collapsed.wt-auth-signed-out .sidebar .sidebar-loggedout .btn svg,
.wt-auth-signed-out .sidebar.collapsed .sidebar-loggedout .btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Feed search bar */
.feed-search-wrap {
  position: relative;
  margin-bottom: 0.75rem;
}
/* Full-width bar sitting above the page / feed title — reads like a light top bar */
.page-feed-search-above-title.feed-search-wrap {
  margin-top: 0.875rem;
  padding-bottom: 0.875rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) {
  .page-feed-search-above-title.feed-search-wrap {
    margin-top: 1.125rem;
    padding-bottom: 1rem;
    margin-bottom: 1.625rem;
  }
}

/* Full-width rule under search (inside app-main); search field stays in .feed-page-top-inner */
.feed-page-top {
  width: 100%;
  box-sizing: border-box;
}

/* ── Mobile/tablet search bar: hidden by default, click the topbar
   Search icon to drop it down. When open, it sticks below the mobile
   topbar so users can scroll the page while typing.
   On desktop (≥1024px) the mobile topbar disappears, so we let the search
   bar be visible at the top of the page like on desktop. ── */
@media (max-width: 1023px) {
  .feed-page-top {
    position: sticky;
    top: 3.5rem; /* offsets the fixed mobile topbar (height 3.5rem) */
    z-index: 30;
    background: var(--background);
    display: none;
    border-bottom: 1px solid var(--border);
  }
  body.wt-search-open .feed-page-top {
    display: block;
    animation: wtSearchSlideDown 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes wtSearchSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* Active state on the topbar search icon when the search panel is open */
.mobile-topbar [aria-label="Search"][aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.18);
}
.feed-page-top-inner {
  max-width: 64rem;
  margin-inline: auto;
  padding: 0.75rem 1rem 0.625rem;
  box-sizing: border-box;
}
@media (min-width: 768px) {
  .feed-page-top-inner {
    padding-top: 1rem;
    padding-bottom: 0.75rem;
  }
}
.feed-page-top .feed-search-wrap {
  position: relative;
  margin: 0;
}
.feed-page-top .feed-search {
  margin-bottom: 0;
}
.feed-page-top-rule {
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.town-main-inner {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: 1rem;
  box-sizing: border-box;
}
.feed-page-top + .town-main-inner {
  padding-top: 1.25rem;
}
@media (min-width: 768px) {
  .feed-page-top + .town-main-inner {
    padding-top: 1.625rem;
  }
}

.feed-search-wrap .feed-search {
  margin-bottom: 0;
}
.feed-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.feed-search-live {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 50;
  max-height: min(320px, 55vh);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 40px oklch(0.2 0.02 250 / 0.14);
}
.feed-search-live[hidden] {
  display: none !important;
}
.feed-search-live-list {
  display: flex;
  flex-direction: column;
  padding: 0.25rem;
  gap: 0.125rem;
}
.feed-search-live-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.625rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--foreground);
  transition: background 120ms ease;
}
.feed-search-live-item.feed-search-live-item--row {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
}
.feed-search-live-type-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--muted-foreground);
  margin-top: 0.0625rem;
}
.feed-search-live-type-icon svg {
  display: block;
  width: 14px;
  height: 14px;
}
/* Author avatar slot in search results — sits in the same 2rem column
   as the type icon so rows stay aligned. */
.feed-search-live-avatar {
  margin-top: 0.0625rem;
}
.feed-search-live-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
}
.feed-search-live-item:hover,
.feed-search-live-item:focus-visible {
  background: var(--accent);
  outline: none;
}
.feed-search-live-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}
.feed-search-live-author {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.feed-search-live-meta {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  opacity: 0.92;
}
.feed-search-live-empty {
  padding: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-align: center;
}
.feed-search-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  /* 16px minimum prevents iOS Safari auto-zoom on focus */
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  color: var(--foreground);
  outline: none;
  transition: border-color 150ms;
}
@media (min-width: 1024px) {
  .feed-search-input { font-size: 0.8125rem; }
}
.feed-search-input:focus {
  border-color: var(--primary);
}
.feed-search-input::placeholder {
  color: var(--muted-foreground);
}
.feed-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 9999px;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  transition: color 150ms;
}
.feed-search-clear:hover {
  color: var(--foreground);
}

/* App shell main content */
.app-main {
  flex: 1;
  min-width: 0;
}

/* ── Mobile Top Bar (logged-in) ── */

.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5rem;
  padding-inline: 0.75rem;
  background: #131e36;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  z-index: 40;
}

/* Icons & logo on the navy bar are white; logo mark uses the white-tile + navy W svg */
.mobile-topbar .topnav-logo,
.mobile-topbar .btn-icon,
.mobile-topbar .btn-ghost { color: white; }
.mobile-topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.mobile-topbar .logo-mark {
  background-image: url('../assets/img/wordtipperlogo-hero.svg?v=6');
}

@media (min-width: 1024px) {
  .mobile-topbar { display: none; }
}

.mobile-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Mobile Drawer (logged-in) ── */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.21 0.04 265 / 0.4);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--card);
  z-index: 51;
  transform: translateX(-100%);
  transition: transform 300ms ease;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}

.drawer-backdrop.open .drawer {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.drawer-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Page-level Grids ── */

.page-header {
  padding: 2rem 0 1.5rem;
}

/* When search sits directly above, tighten title block top padding */
.page-feed-search-above-title + .page-header {
  padding-top: 0.5rem;
}

.page-feed-search-above-title + .town-header {
  padding-top: 0.75rem;
}

.page-header .eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}

.page-header h1 { margin-bottom: 0.25rem; }

.page-header .subhead {
  font-size: 0.9375rem;
  color: var(--muted-foreground);
  max-width: 36rem;
}

.content-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .content-grid { grid-template-columns: 1fr 320px; }
}

.article-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .article-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

/* Two-thirds / one-third layout (town page) */
.town-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .town-grid { grid-template-columns: 2fr 1fr; }
}

/* Mobile top bar spacer */
.mobile-topbar-spacer {
  height: 3.5rem;
}

@media (min-width: 1024px) {
  .mobile-topbar-spacer { display: none; }
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Notification Bell & Panel ─────────────────────────────────────── */

.wt-notif-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Bell in sidebar-brand: flex item pushed right via flex-grow gap */
.sidebar-brand .wt-notif-wrap {
  margin-left: auto;
  margin-right: 0;
}

.wt-notif-bell {
  position: relative;
  color: var(--muted-foreground);
  transition: color 0.15s;
  flex-shrink: 0;
}

.wt-notif-bell:hover {
  color: var(--foreground);
}

.wt-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1.1rem;
  height: 1.1rem;
  border-radius: 99px;
  background: var(--destructive, oklch(55% 0.22 25));
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  padding: 0 0.25rem;
  pointer-events: none;
}

.wt-notif-panel {
  position: fixed;
  top: 0;   /* overridden by JS on open */
  left: 0;  /* overridden by JS on open */
  width: min(340px, calc(100vw - 2rem));
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 0.75rem);
  box-shadow: 0 8px 32px oklch(0% 0 0 / 0.12), 0 2px 8px oklch(0% 0 0 / 0.06);
  z-index: 300;
  overflow: hidden;
  animation: wtNotifIn 0.15s ease;
}

/* No longer needed — panel is now fixed, not relative to sidebar */

@keyframes wtNotifIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wt-notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.wt-notif-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
}

.wt-notif-mark-all {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0.25rem 0.5rem;
}

.wt-notif-mark-all:hover {
  color: var(--primary);
}

.wt-notif-list {
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wt-notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.wt-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--foreground);
  cursor: default;
  transition: background 0.1s;
}

a.wt-notif-item {
  cursor: pointer;
}

a.wt-notif-item:hover {
  background: var(--muted, oklch(97% 0 0));
}

.wt-notif-item:last-child {
  border-bottom: none;
}

.wt-notif-item--unread {
  background: oklch(from var(--primary) l c h / 0.06);
}

.wt-notif-item--unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.wt-notif-item {
  position: relative;
}

.wt-notif-item-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted, oklch(96% 0 0));
  color: var(--muted-foreground);
}

.wt-notif-item-icon.wt-notif-item--payment_received {
  background: oklch(92% 0.08 145);
  color: oklch(40% 0.14 145);
}
.wt-notif-item-icon.wt-notif-item--rank_update {
  background: oklch(92% 0.08 230);
  color: oklch(40% 0.14 230);
}
.wt-notif-item-icon.wt-notif-item--new_follower {
  background: oklch(92% 0.08 280);
  color: oklch(40% 0.14 280);
}
.wt-notif-item-icon.wt-notif-item--article_approved {
  background: oklch(92% 0.08 145);
  color: oklch(40% 0.14 145);
}
.wt-notif-item-icon.wt-notif-item--article_rejected {
  background: oklch(92% 0.08 25);
  color: oklch(40% 0.14 25);
}

.wt-notif-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.wt-notif-item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--foreground);
}

.wt-notif-item-body-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wt-notif-item-time {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

/* When sidebar is in collapsed (rail) mode, hide bell label — it's icon-only */
html.wt-sidebar-collapsed .sidebar .wt-notif-bell .wt-notif-badge {
  top: 0px;
  right: 0px;
}

/* Hide bell from sidebar entirely when collapsed — show only in mobile topbar */
html.wt-sidebar-collapsed .sidebar .wt-notif-wrap {
  display: none;
}

/* ── Newsletter strip ── */
.wt-newsletter-strip {
  background: var(--primary);
  color: #fff;
  padding: 2rem 1.5rem;
}
.wt-newsletter-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}
.wt-newsletter-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.wt-newsletter-text strong {
  font-size: 1.0625rem;
  font-weight: 700;
}
.wt-newsletter-text span {
  font-size: 0.875rem;
  opacity: 0.8;
}
.wt-newsletter-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  flex-wrap: wrap;
}
.wt-newsletter-form .input {
  flex: 1;
  min-width: 180px;
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}
.wt-newsletter-form .input::placeholder { color: rgba(255,255,255,0.5); }
.wt-newsletter-form .input:focus { outline: 2px solid rgba(255,255,255,0.5); border-color: transparent; }
.wt-newsletter-form .btn-primary {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
  white-space: nowrap;
}
.wt-newsletter-form .btn-primary:hover { background: oklch(0.94 0.01 265); }
@media (min-width: 640px) {
  .wt-newsletter-inner { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
  .wt-newsletter-form { width: auto; min-width: 340px; }
}
