/*
 * Design tokens. Light theme is the default look; dark is available only
 * as an explicit, user-chosen `data-theme="dark"` override via the
 * header toggle (no `prefers-color-scheme` auto-switch) per the owner's
 * request to make light the app's actual theme, not just its fallback.
 * Primary is the owner's chosen brand teal (#025B66); crimson ("official")
 * stays reserved strictly for PSC content (notices, vacancy alerts) so it
 * never competes with the brand color.
 */
:root {
  --background: #eef0f6;
  --foreground: #14181f;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --muted: #697182;
  --border: #e1e4ec;

  --primary: #025b66;
  --primary-soft: #dcecec;
  --primary-foreground: #ffffff;
  --primary-2: #06838f;

  --official: #c8102e;
  --official-foreground: #ffffff;
  --official-soft: #fdedef;

  --good: #0e7c5a;
  --good-soft: #e6f5ef;
  --warn: #8a5a00;
  --warn-soft: #fdf3e0;
  --destructive: #c8102e;
  --destructive-foreground: #ffffff;

  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) * 0.5);
  --radius-md: calc(var(--radius) * 0.75);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);

  --shadow-sm: 0 1px 3px rgba(20, 24, 31, 0.06), 0 1px 2px rgba(20, 24, 31, 0.04);
  --shadow-md: 0 12px 28px -10px rgba(20, 24, 31, 0.16);

  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-deva: "Noto Sans Devanagari", "Mukta", sans-serif;

  --shell-max: 1800px;
  --rail-left: 260px;
  --rail-right: 300px;
  --header-h: 3.75rem;
}

:root[data-theme="dark"] {
  --background: #0c0e13;
  --foreground: #edeff3;
  --surface: #13161d;
  --surface-2: #1a1e26;
  --muted: #8d96a5;
  --border: #262b35;
  --primary: #3ddbd4;
  --primary-soft: #113233;
  --primary-foreground: #06282b;
  --primary-2: #28b8ae;
  --official: #ff5c6b;
  --official-foreground: #0c0e13;
  --official-soft: #2b1418;
  --good: #3fce9c;
  --good-soft: #0e2520;
  --warn: #e0a633;
  --warn-soft: #251c09;
  --destructive: #ff5c6b;
  --destructive-foreground: #0c0e13;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  border-color: var(--border);
}

html {
  font-size: 93.75%; /* 15px base — the owner found the whole site's type scale too large */
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(1100px 500px at 15% -8%, #dcf1ef 0%, var(--background) 55%) fixed;
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] body {
  background: var(--background);
}

[lang="ne"],
.font-deva {
  font-family: var(--font-deva);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

svg {
  display: block;
}

/* --- Icon sprite host -------------------------------------------------- */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* --- Header ------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.site-header::after {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.site-header__inner {
  margin: 0 auto;
  max-width: var(--shell-max);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 max(1.25rem, env(safe-area-inset-left, 0px)) 0 max(1.25rem, env(safe-area-inset-right, 0px));
}

.brand-logo {
  display: block;
  height: 1.875rem;
  width: auto;
}

.brand-logo--sm {
  height: 1.25rem;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: 32rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
}

.site-header__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.header-search .icon {
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  flex-shrink: 0;
}

.header-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--foreground);
}

.header-search input::placeholder {
  color: var(--muted);
}

@media (max-width: 768px) {
  .header-search {
    display: none;
  }
}

.icon-btn,
.text-btn {
  display: inline-flex;
  height: 2.375rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.icon-btn {
  width: 2.375rem;
  padding: 0;
}

.text-btn {
  padding: 0 0.75rem;
  gap: 0.375rem;
}

.icon-btn:hover,
.text-btn:hover {
  background: var(--surface-2);
}

/* --- Shell: left sidebar / main / right sidebar ------------------------ */

.app-shell {
  margin: 0 auto;
  max-width: var(--shell-max);
  display: flex;
  align-items: stretch;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.75rem max(1rem, env(safe-area-inset-right, 0px)) 2rem max(1rem, env(safe-area-inset-left, 0px));
}

.site-footer__inner {
  margin: 0 auto;
  max-width: var(--shell-max);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer__links a:hover {
  color: var(--primary);
}

@media (min-width: 1025px) {
  /* The left sidebar carries this same brand/links/copyright content,
     pinned to its own bottom — the standalone footer would just repeat
     it below a shell that already reaches the bottom of the viewport. */
  .site-footer {
    display: none;
  }
}

@media (max-width: 1024px) {
  .site-footer {
    padding-bottom: 5.5rem;
  }
}

main.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem max(1.5rem, env(safe-area-inset-right, 0px)) 2.5rem max(1.5rem, env(safe-area-inset-left, 0px));
}

.side-rail {
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  padding: 1.5rem 1.25rem;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.side-rail--left {
  width: var(--rail-left);
  border-right: 1px solid var(--border);
  border-radius: 0 1.25rem 1.25rem 0;
  box-shadow: 3px 0 14px -6px rgba(20, 24, 31, 0.08);
  /* The left rail carries the nav + favourites + the footer pinned to
     its bottom — it's meant to read as a full-height panel. The right
     rail only ever holds two or three short widgets, so forcing it to
     the same height left a mostly-empty white block underneath them
     (the exact "too much empty space" complaint from an earlier round,
     recreated on the other side by applying one rule to both rails). */
  min-height: calc(100vh - var(--header-h));
}

.side-rail--right {
  width: var(--rail-right);
  border-left: 1px solid var(--border);
  border-radius: 1.25rem 0 0 1.25rem;
  box-shadow: -3px 0 14px -6px rgba(20, 24, 31, 0.08);
}

.side-rail__favorites {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.side-rail__footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.side-rail__footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.side-rail__footer-links a:hover {
  color: var(--primary);
}

.side-rail__copyright {
  margin-top: 0.75rem;
  font-size: 0.6875rem;
  color: var(--muted);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.side-nav__new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.625rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  font-size: 0.8125rem;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.side-nav__new:hover {
  background: var(--primary-2);
  box-shadow: var(--shadow-sm);
}

.side-nav__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--foreground);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.side-nav__item:hover {
  background: var(--surface-2);
}

.side-nav__item[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.side-nav__icon {
  width: 1.375rem;
  height: 1.375rem;
}

.side-nav__label {
  white-space: nowrap;
}

/* --- Widgets (right sidebar) -------------------------------------------- */

.widget {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.widget + .widget {
  margin-top: 1rem;
}

.widget__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.875rem;
}

.widget__title .icon {
  width: 1rem;
  height: 1rem;
}

.widget__view-all {
  margin-left: auto;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.widget__view-all:hover {
  text-decoration: underline;
}

.widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.625rem;
  padding: 1.25rem 0.5rem 0.25rem;
}

.widget-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.widget-empty__icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.widget-empty__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.widget-empty__cta {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8125rem;
}

.widget-empty__cta:hover {
  text-decoration: underline;
}

.favorite-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0;
  font-size: 0.8125rem;
}

.favorite-row + .favorite-row {
  border-top: 1px solid var(--border);
}

.favorite-row .icon {
  width: 1rem;
  height: 1rem;
  color: var(--warn);
  fill: var(--warn-soft);
  flex-shrink: 0;
}

.favorite-row__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.stat-row {
  display: flex;
  gap: 1.5rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.stat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.stat__icon--flame {
  background: var(--warn-soft);
  color: var(--warn);
}

.stat__value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat__label {
  font-size: 0.6875rem;
  color: var(--muted);
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0;
  font-size: 0.8125rem;
}

.leader-row + .leader-row {
  border-top: 1px solid var(--border);
}

.leader-row__rank {
  width: 1.375rem;
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.75rem;
}

.leader-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.leader-row__points {
  font-weight: 700;
  color: var(--primary);
}

.widget-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 100%;
  margin-top: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  font-size: 0.875rem;
}

/* --- Bottom nav (mobile) ------------------------------------------------ */

.bottom-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav__grid {
  margin: 0 auto;
  max-width: 740px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
}

.bottom-nav__item[aria-current="page"] {
  color: var(--primary);
}

.bottom-nav__icon {
  width: 1.25rem;
  height: 1.25rem;
}

@media (max-width: 1024px) {
  .side-rail--right {
    display: none;
  }
  .side-rail--left {
    display: none;
  }
  .bottom-nav {
    display: block;
  }
  main.app-main {
    padding: 1rem max(1rem, env(safe-area-inset-right, 0px)) 5rem max(1rem, env(safe-area-inset-left, 0px));
  }
}

/* --- Content primitives -------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 0.75rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  margin: 1.5rem 0 0.625rem;
}

.section-title:first-child {
  margin-top: 0;
}

.section-title .icon {
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.1875rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
}

.badge .icon {
  width: 0.8125rem;
  height: 0.8125rem;
}

.badge--official {
  background: var(--official-soft);
  color: var(--official);
}

.muted {
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1.5rem 0;
  text-align: center;
}

.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 2.25rem 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.empty-card .icon {
  width: 2rem;
  height: 2rem;
  opacity: 0.55;
}

/* --- Panel: bordered list box (exam/topic groups, category lists) ------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.panel + .panel {
  margin-top: 0.875rem;
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.125rem;
  font-weight: 700;
  font-size: 0.9375rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.panel__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s ease;
}

.panel__row:last-child {
  border-bottom: none;
}

.panel__row:hover {
  background: var(--surface-2);
}

.panel__row-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.panel__row-meta {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.panel__empty {
  padding: 1.5rem 1.125rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  background: var(--primary-2);
  box-shadow: var(--shadow-sm);
}

.btn--outline {
  background: var(--surface);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn--outline:hover {
  background: var(--surface-2);
}

/* --- Forms ---------------------------------------------------------------- */

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.9375rem;
}

.input,
.select {
  height: 2.625rem;
  padding: 0 0.875rem;
}

.textarea {
  padding: 0.625rem 0.875rem;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* --- Composer (new-post launcher) ----------------------------------------- */

.composer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}

.composer__fake-input {
  flex: 1;
  color: var(--muted);
  font-size: 0.875rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.625rem 1rem;
}

/* --- Chip row (exam categories) -------------------------------------------- */

.chip-row {
  display: flex;
  gap: 0.625rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  margin-bottom: 1.25rem;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip .icon {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
}

.chip__count {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  color: var(--muted);
}

/* --- Notice / quiz banner cards ------------------------------------------- */

.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: var(--radius-lg);
}

.notice-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--official-soft);
  color: var(--official);
  flex-shrink: 0;
}

.quiz-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(120deg, var(--primary-soft), var(--surface));
  border: 1px solid var(--border);
}

.quiz-banner__left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.quiz-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* --- Post cards (modern, social-feed style) ------------------------------- */

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  transform: translateY(-1px);
}

.post-card + .post-card {
  margin-top: 0.875rem;
}

.post-card__head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.post-card__by {
  min-width: 0;
}

.post-card__author {
  font-weight: 600;
  font-size: 0.875rem;
}

.post-card__time {
  color: var(--muted);
  font-size: 0.6875rem;
}

.post-card__exam-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.125rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.post-card__tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.post-card__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 0.75rem 0;
}

/* --- Post detail page: plain article layout, no card chrome ------------ */

.post-detail__head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.post-detail__icons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.icon-ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-ghost-btn:hover {
  background: var(--surface-2);
  color: var(--foreground);
}

.icon-ghost-btn.is-active {
  color: var(--primary);
}

.icon-ghost-btn.is-active .icon {
  fill: var(--primary-soft);
}

.post-detail__title {
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.3;
  margin: 0 0 0.75rem;
}

.post-detail__image-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.post-detail__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  cursor: zoom-in;
}

.image-expand-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.image-expand-btn:hover {
  background: rgba(0, 0, 0, 0.72);
}

.image-expand-btn .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.post-detail__body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--foreground);
}

.post-detail__body p {
  margin: 0 0 0.875rem;
}

.post-detail__body p:last-child {
  margin-bottom: 0;
}

/* --- Lightbox ----------------------------------------------------------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 16, 0.88);
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.is-open {
  display: flex;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
}

.lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* --- Sign-in modal -------------------------------------------------------- */

.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-modal.is-open {
  display: flex;
}

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.6);
  backdrop-filter: blur(3px);
}

.auth-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.75rem 1.75rem;
}

.auth-modal__close {
  position: absolute;
  top: 0.875rem;
  right: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.auth-modal__close:hover {
  background: var(--surface-2);
  color: var(--foreground);
}

.auth-modal__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.auth-modal__title {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

.auth-modal__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.auth-modal__divider::before,
.auth-modal__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Comment composer (sticky bottom bar) -------------------------------- */

.comment-composer {
  position: sticky;
  bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.5rem 0.5rem 0.625rem;
  box-shadow: var(--shadow-md);
  margin: 1rem 0;
}

.comment-composer__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--foreground);
  padding: 0.375rem 0;
}

.comment-composer__input::placeholder {
  color: var(--muted);
}

.comment-composer__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: var(--primary-foreground);
  cursor: pointer;
  flex-shrink: 0;
}

.comment-composer__send:hover {
  background: var(--primary-2);
}

.comment-composer__send .icon {
  width: 1.0625rem;
  height: 1.0625rem;
}

/* --- Post header "..." menu ------------------------------------------- */

.post-menu {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.post-menu__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.post-menu__trigger:hover {
  background: var(--surface-2);
  color: var(--foreground);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 30;
  min-width: 10rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.375rem;
}

.dropdown-menu.is-open {
  display: block;
}

.dropdown-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: none;
  color: var(--foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.dropdown-menu__item:hover {
  background: var(--surface-2);
}

.dropdown-menu__item .icon {
  width: 1rem;
  height: 1rem;
  color: var(--muted);
}

.post-card__title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 0.25rem;
  line-height: 1.35;
}

.post-card__body {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--foreground);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-card__meta .dot::before {
  content: "·";
}

.post-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  margin-top: 0.875rem;
}

.action-pill {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.25rem;
  gap: 0.0625rem;
  min-width: 0;
}

.action-pill__divider {
  width: 1px;
  height: 1.125rem;
  background: var(--border);
  margin: 0 0.1875rem;
  flex-shrink: 0;
}

.post-action-form {
  display: contents;
}

.post-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.post-action:hover {
  background: var(--surface);
  color: var(--foreground);
}

.post-action .icon {
  width: 1rem;
  height: 1rem;
}

.post-action.is-liked {
  color: var(--primary);
}

.post-action.is-liked .icon {
  fill: var(--primary-soft);
}

.share-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  color: var(--foreground);
  flex-shrink: 0;
}

.share-circle:hover {
  background: var(--border);
}

.share-circle.is-copied {
  background: var(--good-soft);
  color: var(--good);
}

.share-circle .icon {
  width: 1.0625rem;
  height: 1.0625rem;
}

.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--radius-sm);
}

.action-chip:hover {
  background: var(--surface-2);
  color: var(--foreground);
}

.action-chip .icon {
  width: 0.9375rem;
  height: 0.9375rem;
}

.action-chip.is-liked {
  color: var(--primary);
}

.action-chip.is-liked .icon {
  fill: var(--primary-soft);
}

@media (max-width: 480px) {
  .post-card__body {
    -webkit-line-clamp: 4;
  }
}

/* --- Profile header + edit-profile disclosure ----------------------- */

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-header__meta {
  min-width: 0;
}

.profile-header__username {
  color: var(--muted);
  font-size: 0.875rem;
}

.profile-header__bio {
  margin: 0.375rem 0 0;
  font-size: 0.875rem;
}

.profile-edit-toggle {
  list-style: none;
  cursor: pointer;
}

.profile-edit-toggle::-webkit-details-marker {
  display: none;
}

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