/* MarketKuraa — light, dense investor-community UI. Tokens first; components below use tokens only. */
/* Self-hosted (not Google Fonts' CDN): one less third-party connection on every page load, and
   text renders in the real typeface immediately instead of a system-font flash while a
   fonts.gstatic.com request is in flight — on a slow or blocked connection that flash is often
   the whole visit. Inter and JetBrains Mono both ship as variable fonts, so a single file per
   subset covers the full weight range below. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../fonts/inter-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;
}
@font-face {
  /* Nepali/Devanagari text (the "ne" locale, and any user-written Devanagari in posts) was falling
     all the way through to whatever generic fallback the viewer's OS happens to ship — "Noto Sans
     Devanagari" was named in --font-sans but never actually loaded, so it rendered in a mismatched,
     thin, inconsistent-weight face right next to crisp Inter Latin text. That's the "cheap" look. */
  font-family: 'Noto Sans Devanagari'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../fonts/noto-sans-devanagari.woff2') format('woff2');
  unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B09;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url('../fonts/jetbrains-mono-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;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500 600; font-display: swap;
  src: url('../fonts/jetbrains-mono-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;
}
:root {
  --bg: #f8fafc; --surface: #fff; --text: #0f172a; --muted: #475569; --line: #e2e8f0; --line-strong: #cbd5e1;
  --brand: #047857; --brand-dark: #065f46; --brand-soft: #ecfdf5; --brand-line: #a7f3d0;
  --gold: #b45309; --gold-dark: #92400e; --gold-soft: #fef3e2; --gold-line: #fde3b0;
  --danger: #b42318; --danger-soft: #fef3f2; --warn-bg: #fffbeb; --warn-line: #f59e0b;
  --long: #047857; --short: #b42318; --info: #1d4ed8; --info-soft: #eff6ff; --purple: #6d28d9; --purple-soft: #f5f3ff;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 1px rgba(16, 24, 40, .03);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --header-h: 60px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur-fast: 120ms; --dur: 200ms; --dur-slow: 420ms;
  --glass-bg: rgba(255, 255, 255, .72); --glass-blur: 14px;
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .1); --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);
  /* "Noto Sans Devanagari" has to sit right after Inter, before any generic system-UI keyword —
     -apple-system/Segoe UI/Roboto don't explicitly claim Devanagari coverage, but the OS's own
     font-substitution can still intercept those glyphs through them before the stack ever reaches
     our explicit webfont, each OS picking a different (and often mismatched) fallback. */
  --font-sans: Inter, "Noto Sans Devanagari", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 12px); scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-sans); font-size: 15px; color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 10% -10%, rgba(4, 120, 87, .16), transparent 62%),
    radial-gradient(900px 560px at 100% -6%, rgba(180, 83, 9, .13), transparent 58%),
    radial-gradient(circle, rgba(15, 23, 42, .07) 1px, transparent 1px);
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, auto, 24px 24px;
  background-position: 0 0, 0 0, 0 0;
}
a {
  color: var(--brand); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat;
  background-position: 0 100%; background-size: 0% 1.5px;
  transition: background-size var(--dur) var(--ease), color var(--dur) var(--ease);
}
a:hover { background-size: 100% 1.5px; }
/* Components with their own hover treatment (pills, buttons, nav rows, chips) opt out of the
   underline reveal above — an underline would clash with a filled/padded hover state. */
.brand, .primary-nav a, .rail-nav a, .rail-item, .tabs a, .strip-list a, .chip-filter, .menu-item, .menu-head,
.skip-link, .btn, button.btn, .feed-foot a, .feed-title > a:not(.ticker), .ticker, .badge, .chip {
  background-image: none;
}
h1, h2, h3 { margin-top: 0; line-height: 1.25; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; transition: outline-offset var(--dur-fast) var(--ease); }
::selection { background: var(--brand-line); color: var(--brand-dark); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); transition: top var(--dur) var(--ease); } .skip-link:focus { top: 8px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main:focus { outline: none; }

/* Shared keyframes for loading and entrance motion. All disabled under prefers-reduced-motion (see file end). */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.7); opacity: .4; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes header-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes bar-sweep { 0% { transform: translateX(-40%); } 100% { transform: translateX(220%); } }

.container { max-width: 1240px; margin: 0 auto; padding: 20px 20px 40px; }

/* ---- Page shell: persistent site sidebar + main content ---- */
.page-shell { display: flex; align-items: flex-start; }
.site-sidebar {
  flex: none; width: 240px; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow-y: auto; display: flex; flex-direction: column; padding: var(--s4) var(--s3); border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.main-content { flex: 1; min-width: 0; }
button.sidebar-toggle { display: none; }
button.sidebar-close { display: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--s4); }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; font-size: .92rem; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.sidebar-nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar-nav .icon { color: var(--muted); }
.sidebar-nav a[aria-current="page"] .icon { color: var(--brand-dark); }
.sidebar-section { padding: 0 2px; margin-bottom: var(--s4); }
.sidebar-heading { display: flex; align-items: center; gap: 9px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.sidebar-heading .icon { width: 15px; height: 15px; padding: 6px; box-sizing: content-box; background: var(--brand-soft); color: var(--brand-dark); border-radius: 8px; }
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { display: flex; justify-content: space-between; align-items: center; }
.sidebar-list a { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--text); font-size: .9rem; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.sidebar-list a:hover { background: var(--bg); text-decoration: none; }
.sidebar-list a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.sidebar-list .icon { color: var(--muted); flex: none; }
.sidebar-list a[aria-current="page"] .icon { color: var(--brand-dark); }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding: var(--s3) 8px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.sidebar-foot a { color: var(--muted); }
.sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(15, 23, 42, .25); backdrop-filter: blur(1px); }
body.sidebar-lock { overflow: hidden; }

/* ---- Promo banner (signed-out visitors, scrolls away above the sticky header) ---- */
.promo-banner { background: linear-gradient(90deg, var(--brand-soft), #fff 75%); border-bottom: 1px solid var(--brand-line); animation: fade-up var(--dur-slow) var(--ease) both; }
.promo-banner-inner { position: relative; display: flex; align-items: center; justify-content: center; padding: 7px 44px; }
.promo-banner-text { margin: 0; font-size: .82rem; font-weight: 500; color: var(--brand-dark); text-align: center; line-height: 1.4; }
.promo-banner-link { margin-left: 2px; font-weight: 700; color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.promo-banner-link:hover { color: var(--brand); }
.promo-banner-close { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; line-height: 0; }
.promo-banner-close:hover { color: var(--brand-dark); }
.promo-banner-close .icon { width: 13px; height: 13px; }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line);
  background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) saturate(160%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  animation: header-drop var(--dur-slow) var(--ease) both;
  transition: box-shadow var(--dur) var(--ease);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .site-header { background: rgba(255, 255, 255, .97); } }
.site-header.scrolled { box-shadow: 0 8px 24px rgba(16, 24, 40, .08); }
.hdr { display: flex; align-items: center; gap: var(--s4); padding-top: 10px; padding-bottom: 10px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; margin-left: -16px; } .brand:hover { text-decoration: none; }
.brand-logo { display: block; height: 26px; width: auto; }
.primary-nav { display: flex; gap: 2px; }
.primary-nav a { color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 500; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.primary-nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-soft); }
.hdr-search { flex: 1; max-width: 460px; margin-left: auto; position: relative; display: flex; align-items: center; }
.hdr-search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.hdr-search input { padding-left: 38px; padding-right: 34px; background: var(--bg); border-color: transparent; height: 40px; }
.hdr-search input:focus { background: #fff; border-color: var(--brand); }
.hdr-search kbd { position: absolute; right: 10px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; font: 12px/18px ui-monospace, monospace; color: var(--muted); background: #fff; }
.hdr-actions { display: flex; align-items: center; gap: var(--s2); }
.hdr-link { color: var(--text); font-weight: 500; padding: 8px 10px; }
/* display:contents keeps Log in/Sign up as direct flex children of .hdr-actions on every screen
   size down to the bottom-nav breakpoint, where they're hidden outright (see Responsive below) —
   the bottom nav's own Sign up tab and "+" → log in button already cover the same actions there. */
.hdr-auth-links { display: contents; }
/* Same idea for a signed-in visitor: New Post and Notifications. The avatar menu stays in the
   header at every width — it's the only way to reach Settings/Watchlists/Log out, nothing in the
   bottom nav covers it. */
.hdr-dup-actions { display: contents; }
.btn-new { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn, .avatar-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--muted); list-style: none; }
.icon-btn:hover, .avatar-btn:hover { background: var(--bg); }
summary::-webkit-details-marker { display: none; }
.avatar-btn { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; overflow: hidden; } .avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.badge-dot { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; animation: pop var(--dur-slow) var(--ease) both; }
.menu { position: relative; }
.icon-btn, .avatar-btn { transition: background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.icon-btn:active, .avatar-btn:active { transform: scale(.92); }
.menu-panel {
  position: absolute; right: 0; top: 46px; width: 280px; max-width: calc(100vw - 24px);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
  transform-origin: top right;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .menu-panel { background: #fff; } }
details[open] > .menu-panel { animation: menu-in .2s var(--ease) both; }
.menu-item, .menu-head { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; transition: background-color var(--dur-fast) var(--ease); }
.menu-item:hover, .menu-head:hover { background: var(--bg); text-decoration: none; }
/* Below .site-header's own z-index (30), not above it: .site-header is `position: sticky` with
   its own z-index, so it forms a stacking context — a menu-panel inside it with a HIGHER z-index
   than this scrim still can't win, because that z-index only competes within the header's own
   context. A scrim z-index above the header's wins at the header's level instead, burying the
   whole header — notifications menu included — behind a blurred, click-catching overlay. */
.menu-scrim { position: fixed; inset: 0; z-index: 28; background: rgba(15, 23, 42, .1); backdrop-filter: blur(1px); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); }
.menu-scrim.show { opacity: 1; pointer-events: auto; }
.menu-head { font-weight: 600; color: var(--brand-dark); } .menu-item.unread { background: var(--brand-soft); } .menu-item.danger-item { color: var(--danger); }
.menu-empty { padding: 10px 12px; color: var(--muted); margin: 0; }
.lang select { width: auto; height: 36px; padding: 0 6px; border-color: var(--line); background: #fff; }

/* ---- Base elements ---- */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { width: 100%; padding: 10px 12px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--text); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-line); outline-offset: 0; }
input[type=checkbox] { width: auto; min-height: 0; }
/* The native file-picker button otherwise renders as unstyled OS chrome sitting inside our
   rounded field — one of the clearest "unfinished prototype" tells on an otherwise polished form. */
input[type=file] { padding: 7px 10px; min-height: 0; background: var(--bg); font-size: .88rem; color: var(--muted); }
input[type=file]::file-selector-button, input[type=file]::-webkit-file-upload-button {
  margin-right: 12px; padding: 7px 14px; border: 0; border-radius: var(--radius-sm);
  background: var(--brand-soft); color: var(--brand-dark); font: inherit; font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: background-color var(--dur) var(--ease);
}
input[type=file]:hover::file-selector-button, input[type=file]:hover::-webkit-file-upload-button { background: var(--brand-line); }
.helptext, .help { color: var(--muted); font-size: .85rem; display: block; margin: 4px 0 0; }
.field-errors, .errorlist { color: var(--danger); margin: 4px 0; padding: 0; list-style: none; font-size: .9rem; }
.btn, button.btn {
  --btn-fg: #fff;
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; padding: 9px 16px; min-height: 40px; border: 0; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; font-size: .95rem;
  transition: background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .3) 50%, transparent 60%);
  transform: translateX(-120%); transition: transform var(--dur-slow) var(--ease);
}
.btn:hover::before { transform: translateX(120%); }
.btn:hover { background: linear-gradient(135deg, var(--brand-dark), #054431); text-decoration: none; color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:hover .icon { transform: translateX(2px); }
.btn:active { transform: translateY(0) scale(.96); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .18); }
.btn .icon { transition: transform var(--dur) var(--ease); }
/* Hover used to step from the pale resting tint (--brand-soft) to another pale tint
   (--brand-line) — barely a shade darker, so the button read as flat/toy-ish rather than
   responsive. A solid, saturated fill reads as a real state change, same as the primary button's
   own hover already does. */
.btn.secondary { --btn-fg: var(--brand-dark); background: var(--brand-soft); color: var(--brand-dark); }
.btn.secondary:hover { background: var(--brand); color: #fff; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .88rem; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--btn-fg); border-top-color: transparent; opacity: .9; animation: spin .6s linear infinite; }
button.danger, .danger { color: var(--danger); background: transparent; border: 0; cursor: pointer; font: inherit; padding: 0; transition: opacity var(--dur) var(--ease); }
button.linklike { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; color: var(--brand); transition: opacity var(--dur) var(--ease); }
.danger.is-loading, button.linklike.is-loading { opacity: .5; pointer-events: none; }
.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* Icon-button toolbar for a post/comment's secondary actions (Edit, Delete, Report, Reply) —
   these used to be plain underlined text links with nothing to tell them apart from body copy or
   group them with the vote control sitting right next to them. */
.action-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; min-height: 36px; border-radius: 999px; background: none; border: 0; color: var(--muted); font-size: .88rem; font-weight: 500; font-family: inherit; cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.action-link:hover { background: var(--bg); color: var(--brand-dark); text-decoration: none; }
.action-link.is-danger { color: var(--danger); }
.action-link.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.action-link .icon { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); } .meta { color: var(--muted); font-size: .9rem; }
.card, .panel, .post-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), var(--shadow); margin-bottom: 16px;
  animation: fade-up var(--dur-slow) var(--ease) both;
}
.panel.notice, .notice { border-left: 4px solid var(--brand); }
.panel.warn { background: var(--warn-bg); border-left: 4px solid var(--warn-line); }
.tabs a { transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.tabs a:active { transform: scale(.96); }
.form-panel { max-width: 720px; margin: 0 auto; }
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.badge { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; padding: 3px 9px; border-radius: 999px; margin-right: 6px; transition: background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
a.badge:hover { background: var(--brand-line); text-decoration: none; transform: translateY(-1px); }
a.badge:active { transform: translateY(0) scale(.95); }
.badge.type-thesis { background: #e6f7ee; color: var(--long); } .badge.type-ama { background: var(--purple-soft); color: var(--purple); } .badge.locked { background: var(--danger-soft); color: var(--danger); }
.verified { color: var(--brand-dark); font-size: .78em; font-weight: 600; margin-left: 4px; cursor: help; }
.host { color: var(--purple); font-size: .8em; font-weight: 600; margin-left: 4px; }
.chips { margin-bottom: 6px; }
/* profile.html and company_detail.html use .tabs standalone, right before a post list, with
   nothing supplying the gap between them — the tabs sat flush against the first card. Give .tabs
   its own margin-bottom for that case, but cancel it back out inside .feed-controls (home.html's
   feed-controls .tabs sits next to the search box in a flex row; the parent already spaces
   itself from what comes after, and a margin on just one flex item there would nudge it out of
   vertical alignment with its sibling). */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.feed-controls .tabs { margin-bottom: 0; }
.tabs a { padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination { display: flex; gap: 12px; align-items: center; margin: 18px 0; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; } .filters label { margin: 0 0 4px; font-size: .85rem; } .filters > div { min-width: 130px; flex: 1; }
.search { display: flex; gap: 8px; margin-bottom: 18px; } .search input { flex: 1; }
.prose p:first-child { margin-top: 0; } .prose pre { background: #f1f3f7; padding: 10px; border-radius: 6px; overflow-x: auto; }
.prose blockquote { border-left: 3px solid var(--line); margin-left: 0; padding-left: 12px; color: var(--muted); }
.prose table { border-collapse: collapse; } .prose th, .prose td { border: 1px solid var(--line); padding: 4px 8px; } .prose { overflow-wrap: anywhere; }
.stats { display: flex; gap: 20px; flex-wrap: wrap; } .stats strong { font-size: 1.4rem; display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; } .grid .card { margin: 0; }

/* ---- News (magazine-style image tiles) ---- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); }
.news-card {
  position: relative; aspect-ratio: 1 / 1; display: flex; align-items: flex-end;
  border-radius: var(--radius); overflow: hidden; background-color: var(--bg); background-size: cover; background-position: center;
  color: #fff; box-shadow: var(--shadow); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; color: #fff; }
.news-card-scrim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, .25) 55%, transparent 100%); }
.news-card-title { position: relative; z-index: 1; padding: var(--s3); font-weight: 700; font-size: 1.05rem; line-height: 1.35; text-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.news-article-image { display: block; width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: var(--s4); background: var(--bg); }
.table { width: 100%; border-collapse: collapse; } .table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); }
.disclaimer { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.messages .panel { margin-bottom: 0; display: flex; align-items: flex-start; gap: 10px; }
.messages .msg-icon { flex: none; margin-top: 1px; }
.messages .error, .messages .warning { border-left: 4px solid var(--danger); background: var(--danger-soft); } .messages .error .msg-icon, .messages .warning .msg-icon { color: var(--danger); }
.messages .success { border-left: 4px solid var(--long); background: var(--brand-soft); } .messages .success .msg-icon { color: var(--long); }
.messages .info, .messages .debug { border-left: 4px solid var(--info); background: var(--info-soft); } .messages .info .msg-icon, .messages .debug .msg-icon { color: var(--info); }
.vote-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; min-height: 36px; cursor: pointer; font: inherit; color: var(--text); transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease), opacity var(--dur) var(--ease); }
.vote-btn.voted { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.vote-btn:active { transform: scale(.96); }
form.htmx-request .vote-btn { opacity: .55; cursor: progress; pointer-events: none; }
.card-vote.htmx-request .vote-arrow { opacity: .55; }
.card-vote.htmx-request .vote-count { opacity: .45; }
/* Inline vote glyph: a crisp vector chevron everywhere a vote count appears, replacing the plain
   "▲" text character that rendered as whatever blunt system-font glyph the viewer's OS shipped —
   inconsistent with every other icon in the app, which is all hand-drawn line icons. Solid fill on
   the voted state mirrors the familiar "filled once you've voted" convention (Reddit, HN, etc). */
.vote-glyph { width: 14px; height: 14px; flex: none; }
.icon-solid { fill: currentColor; stroke: none; }
.inline-stat { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
/* A Reddit-style vote reaction: the arrow itself jumps and overshoots on click, and the count
   gets its own quick pop a beat later — two separate motions read as livelier than one shared
   scale on the whole control, which is what this used to be. */
@keyframes vote-arrow-bounce { 0% { transform: scale(1) translateY(0); } 30% { transform: scale(1.35) translateY(-3px); } 55% { transform: scale(.88) translateY(1px); } 100% { transform: scale(1) translateY(0); } }
@keyframes vote-count-bounce { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
.just-voted .vote-arrow .icon { animation: vote-arrow-bounce .45s var(--ease) both; }
.just-voted .vote-count { display: inline-block; animation: vote-count-bounce .35s var(--ease) .08s both; }
.just-voted.vote-btn .icon, .just-voted .vote-btn .icon { animation: vote-arrow-bounce .45s var(--ease) both; }
.comment { border-top: 1px solid var(--line); padding: 14px 0 6px; animation: fade-up var(--dur-slow) var(--ease) both; }
.comment .children { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 14px; }
.comment.depth-5 .children { margin-left: 0; padding-left: 0; border-left: 0; }
.comment.removed .prose { color: var(--muted); font-style: italic; }
.comment.host-answer { background: var(--purple-soft); border-radius: 8px; padding-left: 10px; }
.comment-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .88rem; margin: 6px 0; }
/* The reply editor is a checkbox-driven disclosure (no JS needed), deliberately NOT a flex item
   of .comment-actions at all — it's a plain block sibling right after it. Two earlier attempts
   tried to keep the trigger and its expanding form as one flex-wrap item (a <details>, with
   flex-basis or display:contents tricks): both ended up moving either the trigger itself or
   whichever buttons came after it in the row whenever the form opened, because a flex item wide
   enough to force a wrap still participates in that row's wrapping algorithm one way or another.
   Taking the form out of the row entirely sidesteps that class of bug outright: Reply stays
   exactly where it is, in its natural reading-order position next to Vote, and the editor always
   renders as its own full-width block below the whole row, however tall it gets. */
.reply-toggle { position: absolute; opacity: 0; pointer-events: none; }
.reply-form { display: none; margin-top: 8px; }
.reply-toggle:checked ~ .reply-form { display: block; }
[hidden] { display: none !important; }

/* ---- Loading: top navigation progress bar ---- */
#nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60; background: linear-gradient(90deg, var(--brand-dark), var(--brand)); opacity: 0; overflow: hidden; transition: width .25s var(--ease), opacity .3s var(--ease) .1s; }
#nav-progress.is-active { opacity: 1; }
#nav-progress.is-active::after { content: ""; position: absolute; inset: 0; width: 40%; background: rgba(255, 255, 255, .55); animation: bar-sweep 1s var(--ease) infinite; }

/* ---- Home: trending strip ---- */
.strip { display: flex; align-items: center; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin-bottom: var(--s4); box-shadow: var(--shadow); }
.strip-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 600; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.strip-list { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.strip-list a { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); white-space: nowrap; min-height: 32px; transition: border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease); }
.strip-list a:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.strip-list a:active { transform: translateY(0) scale(.96); }
.strip-list .num { color: var(--muted); font-size: .82rem; font-family: var(--font-mono); }
.ticker { font-weight: 700; color: var(--brand-dark); transition: opacity var(--dur) var(--ease); }
a.ticker:hover { opacity: .72; text-decoration: none; }
.strip-slot, .soon-tag { font-size: .75rem; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 999px; padding: 3px 10px; white-space: nowrap; font-weight: 500; }

/* ---- Home: grid and rails ---- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); align-items: start; }
/* Grid/flex items default to min-width:auto, which refuses to shrink below their content's
   intrinsic width (e.g. the category chips row) even inside a minmax(0, 1fr) track — forcing
   the whole page to overflow horizontally on narrow screens. min-width:0 is the standard fix. */
.feed, .rail { min-width: 0; }
.rail { display: flex; flex-direction: column; }
.rail-left { position: sticky; top: calc(var(--header-h) + 16px); }
.rail-card { padding: 14px; margin-bottom: var(--s3); }
.rail-title { display: flex; align-items: center; gap: 9px; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.rail-title .icon { width: 15px; height: 15px; padding: 6px; box-sizing: content-box; background: var(--brand-soft); color: var(--brand-dark); border-radius: 8px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.rail-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.rail-nav a:hover { background: var(--bg); text-decoration: none; }
.rail-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); }
.rail-list { list-style: none; margin: 0; padding: 0; } .rail-list li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.rail-note { color: var(--muted); font-size: .8rem; margin: 8px 0 0; }
.rail-item { display: block; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); transition: transform var(--dur) var(--ease); } .rail-item:first-of-type { border-top: 0; padding-top: 0; } .rail-item:hover { text-decoration: none; transform: translateX(3px); }
.rail-item:hover .rail-item-title { color: var(--brand-dark); }
.rail-item-title { display: block; font-weight: 600; font-size: .92rem; } .rail-item-sub { display: block; color: var(--muted); font-size: .8rem; }
.rail-item-title::after { content: "\2192"; display: inline-block; margin-left: 5px; opacity: 0; transform: translateX(-4px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.rail-item:hover .rail-item-title::after { opacity: 1; transform: none; }
.live-tag { color: var(--danger); display: inline-flex; align-items: center; gap: 6px; }
.live-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse-dot 1.8s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(1.3); } }
.hours { list-style: none; margin: 0; padding: 0; }
.hours li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; font-size: .88rem; }
.hours-time { color: var(--muted); font-size: .8rem; font-family: var(--font-mono); }
.hours-status { min-width: 52px; text-align: right; font-weight: 600; font-size: .8rem; color: var(--muted); }
.hours li.is-open .hours-status { color: var(--long); }
.hours li.is-open .hours-status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--long); margin-right: 5px; }
.leaders { list-style: none; margin: 0; padding: 0; } .leaders li { display: grid; grid-template-columns: 18px 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; }
.leader-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .72rem; overflow: hidden; flex: none; }
.leader-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-1 { color: var(--gold-dark); } .rank-1 ~ .leader-avatar { background: var(--gold-soft); color: var(--gold-dark); box-shadow: 0 0 0 2px var(--gold-line); }
.verified-icon { width: 15px; height: 15px; margin-left: 4px; vertical-align: -3px; color: var(--brand); }
.rank { color: var(--muted); font-weight: 700; font-size: .85rem; font-family: var(--font-mono); } .leader-score { font-weight: 700; font-family: var(--font-mono); }
.split { display: block; height: 7px; border-radius: 4px; background: var(--short); opacity: .8; margin: 7px 0 4px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1); }
.split-long { display: block; height: 100%; background: linear-gradient(90deg, var(--long), #10b981); }
.soon-card { border-style: dashed; box-shadow: none; background: transparent; }
.rail-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; padding: 4px 6px; } .rail-foot a { color: var(--muted); }

/* ---- Home: composer, controls ---- */
.composer { display: block; padding: 14px; }
.composer-row-outer { display: flex; gap: 12px; align-items: flex-start; }
.composer-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; overflow: hidden; }
.composer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.composer-main { flex: 1; min-width: 0; }
.composer-main input, .composer-main textarea { border-color: transparent; background: var(--bg); }
.composer-main input[name=title] { font-weight: 600; margin-bottom: 8px; } .composer-main textarea { resize: vertical; min-height: 64px; margin-bottom: 8px; }
/* The rich-text toolbar (rich-editor.js) wraps the textarea in .md-editor, which traps the
   textarea's own margin-bottom inside its overflow:hidden box instead of spacing it from the
   next row — the enhanced textarea needs its margin on the wrapper instead (see .md-editor's own
   margin-bottom below) so it looks the same as the plain (no-JS) one. */
.composer-main .md-editor textarea { margin-bottom: 0; }
.composer-main input:focus, .composer-main textarea:focus { background: #fff; }
.composer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.composer-row select { width: auto; flex: 1 1 150px; max-width: 220px; }
.ticker-input { display: inline-flex; align-items: center; background: var(--bg); border-radius: var(--radius-sm); padding-left: 10px; color: var(--muted); font-weight: 700; flex: 0 1 140px; transition: box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease); } .ticker-input input { text-transform: uppercase; background: transparent; border-color: transparent; }
/* The pill (not the inner input) owns the focus ring, via box-shadow below — otherwise the input's
   own default focus outline (sharp corners, offset from the pill's rounded edge) shows at the same
   time and the two rings visibly fight each other. */
.ticker-input input:focus { outline: none; border-color: transparent; }
.ticker-input:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--brand-line); }
.composer-row .btn:last-child { margin-left: auto; }

/* ---- Markdown editor (post/comment body) ---- */
/* Django's `.as_p` form rendering (the standalone comment form, edit-comment page) wraps every
   field — including this one — in a <p>, and that <p>'s own default browser margin (~1em) stacked
   underneath whatever spacing .md-editor itself already has, leaving an oversized, unintentional
   gap before the submit button on any form where body is the last/only field. :has() targets it
   generically, by structure, so this covers every current and future `.as_p`-rendered body field
   without needing a page-specific override each time. */
p:has(> .md-editor) { margin: 0 0 8px; }
.md-editor { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; overflow: hidden; margin-bottom: 8px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.md-editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-line); }
.md-editor textarea { display: block; border: 0; border-radius: 0; }
.md-editor textarea:focus { outline: none; box-shadow: none; background: #fff; }
.md-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 5px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.md-buttons { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; }
.md-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.md-btn:hover { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.md-btn:active { transform: scale(.92); }
.md-btn .icon { width: 15px; height: 15px; }
.md-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 4px; }
.md-tabs { display: flex; gap: 2px; flex: none; }
.md-tab { padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 600; cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.md-tab:hover { color: var(--text); }
.md-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.md-preview { padding: 12px; min-height: 60px; }
.md-preview[aria-busy="true"] { opacity: .6; }
.join-card {
  display: flex; gap: var(--s4); justify-content: space-between; align-items: center; flex-wrap: wrap;
  background-image: radial-gradient(420px 220px at 100% 0%, rgba(4, 120, 87, .07), transparent 70%);
}
.join-card h1 { font-size: 1.4rem; margin-bottom: 4px; } .join-card p { margin: 0; }
.join-card .actions .btn:not(.secondary) { animation: cta-glow 2.6s ease-in-out infinite; }
.join-card .actions .btn:not(.secondary):hover { animation: none; }
@keyframes cta-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(4, 120, 87, .35); } 50% { box-shadow: 0 0 0 8px rgba(4, 120, 87, 0); } }
.hero-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.hero-stats strong { font-family: var(--font-mono); color: var(--text); font-size: 1.05rem; margin-right: 5px; }
.feed-controls { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: var(--s3); }
.feed-search { flex: 1 1 180px; max-width: 260px; } .feed-search input { height: 36px; min-height: 36px; }
.chips-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: var(--s3); scrollbar-width: thin; }
.chip-filter { white-space: nowrap; padding: 6px 14px; min-height: 34px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: .88rem; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.chip-filter:hover { border-color: var(--brand); text-decoration: none; } .chip-filter.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.chip-filter:active { transform: scale(.95); }

/* ---- Feed card ---- */
.feed-card {
  position: relative; overflow: hidden;
  display: flex; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px 10px; margin-bottom: var(--s3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), var(--shadow);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  animation: fade-up var(--dur-slow) var(--ease) both;
  animation-delay: min(calc(var(--i, 0) * 45ms), 320ms);
}
.feed-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), var(--shadow-md); }

/* ---- Thread list skeleton (shown only while htmx is fetching a new feed/category view) ---- */
.thread-skeleton { display: none; }
.thread-skeleton.is-visible { display: flex; flex-direction: column; gap: var(--s3); }
.thread-skeleton.is-visible ~ #thread-list { display: none; }
.skeleton-card {
  height: 92px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--surface) 35%, var(--bg) 50%, var(--surface) 65%);
  background-size: 250% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-card:nth-child(2n) { height: 72px; }
@keyframes skeleton-shimmer { from { background-position: 135% 0; } to { background-position: -135% 0; } }
.feed-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: transparent; }
.feed-card:has(.chip-thesis)::before { background: var(--long); }
.feed-card:has(.chip-ama)::before { background: var(--purple); }
.card-vote { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 44px; flex: none; margin: 0; }
.vote-arrow { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.vote-arrow:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; } .vote-arrow.voted { color: var(--brand-dark); background: var(--brand-soft); } .vote-arrow.static { cursor: default; opacity: .5; } .vote-arrow.static:hover { background: none; color: var(--muted); }
.vote-arrow:active { transform: scale(.88); }
.vote-arrow .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.vote-count { font-weight: 700; font-size: .95rem; font-family: var(--font-mono); }
.feed-body { min-width: 0; flex: 1; }
.feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); font-size: .85rem; }
.feed-meta a:not(.chip) { color: var(--text); font-weight: 600; }
.dot { color: var(--line-strong); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); font-weight: 500; }
a.chip-cat:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.chip-thesis { background: var(--brand-soft); color: var(--brand-dark); } .chip-ama { background: var(--purple-soft); color: var(--purple); } .chip-locked { background: var(--danger-soft); color: var(--danger); }
.chip .icon { width: 12px; height: 12px; }
.feed-title { font-size: 1.08rem; margin: 6px 0 4px; overflow-wrap: anywhere; } .feed-title > a:not(.ticker) { color: var(--text); } .feed-title > a:not(.ticker):hover { color: var(--brand-dark); }
.feed-title > a:not(.ticker)::after { content: "\2192"; display: inline-block; margin-left: 6px; opacity: 0; transform: translateX(-4px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.feed-title > a:not(.ticker):hover::after { opacity: 1; transform: none; }
.feed-excerpt { color: #374151; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.thesis-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 8px 0 0; padding: 7px 10px; background: var(--bg); border-radius: var(--radius-sm); font-size: .85rem; color: var(--muted); }
.pos { font-weight: 700; padding: 1px 8px; border-radius: 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.pos-long { color: var(--long); background: #d1fae5; } .pos-short { color: var(--short); background: #fee4e2; } .pos-watching { color: var(--info); background: var(--info-soft); } .pos-ama { color: var(--purple); background: var(--purple-soft); }
.feed-foot { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; color: var(--muted); font-size: .85rem; }
.feed-foot a, .feed-foot span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); min-height: 24px; } .feed-foot a:hover { color: var(--brand-dark); text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 1099px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .primary-nav a { padding: 8px 9px; }

  /* The sidebar becomes an off-canvas drawer, opened with the header's menu button. */
  button.sidebar-toggle { display: inline-flex; }
  button.sidebar-close { display: inline-flex; align-self: flex-end; margin-bottom: var(--s3); }
  .site-sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 45; isolation: isolate; width: 280px; max-width: 82vw;
    padding-top: var(--s4); border-right: 0; box-shadow: var(--shadow-lg);
    background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none;
    transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease);
  }
  .site-sidebar.is-open { transform: translateX(0); }
}
@media (max-width: 799px) {
  .container { padding: 14px 14px 32px; }
  .hdr { flex-wrap: wrap; gap: 8px 10px; }
  .hdr-search { order: 3; flex: 1 1 100%; max-width: none; margin: 0; } .hdr-search kbd { display: none; }
  .brand-logo { height: 21px; }
  .brand { margin-left: 0; } /* the hamburger button, not the logo, sits at the true left edge here */
  .primary-nav { order: 4; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .hdr-actions { margin-left: auto; }
  .btn-new span { display: none; } .btn-new { width: 40px; padding: 0; border-radius: 50%; }
  .promo-banner-inner { padding: 7px 32px; } .promo-banner-close { right: 10px; }
  .layout { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .feed, .rail-right { grid-column: 1; }
  .feed { grid-row: 1; } .rail-right { grid-row: 2; }
  .strip { flex-wrap: wrap; } .strip-slot { display: none; }
  .comment .children { margin-left: 8px; padding-left: 8px; }
  .feed-card { padding-right: 12px; } .card-vote { width: 40px; }
  .md-toolbar { flex-direction: column; align-items: stretch; }
  .md-tabs { justify-content: flex-end; }
  .menu-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-width: none; }
  .composer-row .btn:last-child { margin-left: 0; flex: 1 1 100%; }
  input, select, textarea { font-size: 16px; }
}

/* ---- Bottom navigation (phones only — tablets and up keep the header + off-canvas sidebar) ---- */
.bottom-nav { display: none; }
.bottom-nav-item {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 0; padding: 6px 2px; border: 0; background: none; font: inherit; cursor: pointer;
  color: var(--muted); font-size: .68rem; font-weight: 600; transition: color var(--dur) var(--ease);
}
.bottom-nav-item:hover, .bottom-nav-item:active { text-decoration: none; color: var(--brand-dark); }
.bottom-nav-item:active { transform: scale(.94); }
.bottom-nav-item[aria-current="page"] { color: var(--brand-dark); }
.bottom-nav-item .icon { width: 22px; height: 22px; }
/* Five tabs in ~390px leaves each label only ~80px — comfortable for short English words but not
   guaranteed for every locale's translation of them. Truncate rather than let a long word overflow
   into the neighbouring tab (min-width:0 above is required for the ellipsis to take effect at all
   inside a flex item, which defaults to min-width:auto). */
.bottom-nav-item span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav-icon-wrap { position: relative; display: inline-flex; }
/* The "new post" / "log in" action is lifted above the bar as a filled circular button — same
   raised-FAB treatment every app with a bottom tab bar uses to mark its one primary action. */
.bottom-nav-new {
  flex: none; width: 46px; height: 46px; margin-top: -20px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: var(--shadow-md); color: #fff;
}
.bottom-nav-new:hover { color: #fff; background: linear-gradient(135deg, var(--brand-dark), #054431); }
.bottom-nav-new .icon { width: 24px; height: 24px; }
@media (max-width: 640px) {
  /* z-index 30 matches .site-header: both are persistent chrome that should stay above the
     sidebar-scrim (25) rather than get dimmed by it when the off-canvas drawer opens — only the
     page content between them is meant to be obscured. */
  .bottom-nav {
    display: flex; align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: 58px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) saturate(160%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(16, 24, 40, .08);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .bottom-nav { background: rgba(255, 255, 255, .97); } }
  /* Leaves room so the bar never covers the last bit of page content (composer buttons, footer
     links) — matches the bar's own height plus its safe-area inset. */
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  /* The signed-out header crammed a hamburger, logo, "Log in", a "Sign up" button and the language
     switcher into one row with nothing to spare, wrapping into a cramped, uneven mess on true phone
     widths. Both auth actions are one tap away in the bottom nav now (its Sign up tab and "+" → log
     in button), so dropping them here just removes the duplication instead of losing anything. */
  .hdr-auth-links { display: none; }
  /* Signed in, the same crowding showed up one row down: New Post, the notification bell, the
     avatar and the language switcher all squeezed together — and New Post/Notifications are now
     exact duplicates of the bottom nav's "+" and Alerts tabs, not just tight for space. */
  .hdr-dup-actions { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
