/* =========================================================================
   Scripted's articles: shared styles
   Three themes (light, dark, dark-blue) selected via [data-theme] on <html>.
   The theme is applied in an inline script in <head> before paint to avoid
   a flash of unstyled content. All theme tokens live on :root.
   ========================================================================= */

/* Playfair Display (Yuyu is not on Google Fonts and made brand text disappear). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  --reader-font-size: 18px;
  --reader-line-height: 1.7;
  --reader-font-family: 'Lora', Georgia, 'Times New Roman', serif;

  /* Layout */
  --content-max: 980px;
  --nav-height: 64px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-brand: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/*
 * Theme tokens live on <html data-theme="...">.
 * Use html[data-theme] (not bare :root for dark modes) so switching always wins.
 */

/* ---------- Theme: light (warm editorial), default ---------- */
:root,
html[data-theme='light'] {
  --bg: #fbfaf8;
  --bg-elevated: #ffffff;
  --bg-subtle: #f3f1ed;
  --text: #1c1917;
  --text-muted: #57534e;
  --text-faint: #78716c;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-text: #ffffff;
  --link: #4f46e5;
  --shadow-card: 0 1px 2px rgba(28, 25, 23, 0.04), 0 4px 14px rgba(28, 25, 23, 0.04);
  --shadow-card-hover: 0 2px 6px rgba(28, 25, 23, 0.06), 0 10px 28px rgba(28, 25, 23, 0.08);
  --code-bg: #f3f1ed;
  --selection-bg: #e0e7ff;
  --selection-text: #312e81;
  --panel-bg: #ffffff;
  --panel-border: #e7e5e4;
  --control-bg: #f3f1ed;
  --control-hover: #e7e5e4;
  --control-active-bg: #44403c;
  --control-active-text: #fafaf9;
  --btn-primary-bg: #f5f5f4;
  --btn-primary-text: #292524;
  --btn-primary-hover: #ebe9e6;
  --btn-primary-border: #e7e5e4;
  --btn-primary-border-hover: #d6d3d1;
  color-scheme: light;
}

/* ---------- Theme: dark (soft charcoal) ---------- */
html[data-theme='dark'] {
  --bg: #121212;
  --bg-elevated: #1a1a1a;
  --bg-subtle: #242424;
  --text: #f5f5f4;
  --text-muted: #a8a29e;
  --text-faint: #a8a29e;
  --border: #2a2a2a;
  --border-strong: #3f3f46;
  --accent: #a5b4fc;
  --accent-hover: #c7d2fe;
  --accent-text: #121212;
  --link: #c7d2fe;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 28px rgba(0, 0, 0, 0.35);
  --code-bg: #242424;
  --selection-bg: #3730a3;
  --selection-text: #e0e7ff;
  --panel-bg: #1a1a1a;
  --panel-border: #2a2a2a;
  --control-bg: #242424;
  --control-hover: #2e2e2e;
  --control-active-bg: #3f3f46;
  --control-active-text: #f5f5f4;
  --btn-primary-bg: #27272a;
  --btn-primary-text: #fafafa;
  --btn-primary-hover: #323236;
  --btn-primary-border: #2a2a2a;
  --btn-primary-border-hover: #3f3f46;
  color-scheme: dark;
}

/* ---------- Theme: dark blue (deep ink) ---------- */
html[data-theme='dark-blue'] {
  --bg: #0b1420;
  --bg-elevated: #111c2b;
  --bg-subtle: #182536;
  --text: #e8eef6;
  --text-muted: #9fb0c3;
  --text-faint: #9fb0c3;
  --border: #1e2f44;
  --border-strong: #2a4160;
  --accent: #7dd3fc;
  --accent-hover: #bae6fd;
  --accent-text: #0b1420;
  --link: #7dd3fc;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 2px 6px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.38);
  --code-bg: #111c2b;
  --selection-bg: #0c4a6e;
  --selection-text: #e0f2fe;
  --panel-bg: #111c2b;
  --panel-border: #1e2f44;
  --control-bg: #182536;
  --control-hover: #1e2f44;
  --control-active-bg: #1e3a5f;
  --control-active-text: #e8eef6;
  --btn-primary-bg: #152a45;
  --btn-primary-text: #e8eef6;
  --btn-primary-hover: #1a3554;
  --btn-primary-border: #1e2f44;
  --btn-primary-border-hover: #2a4160;
  color-scheme: dark;
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

/* Subtle scrollbar (right edge): low opacity, thin */
html {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: color-mix(in srgb, var(--text-faint) 35%, transparent) transparent;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-faint) 35%, transparent);
  border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-muted) 55%, transparent);
}
/* Nested scroll areas (editor, code blocks, reader panel on mobile) */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-faint) 30%, transparent);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-muted) 50%, transparent);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.15s ease, color 0.15s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--selection-bg); color: var(--selection-text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.22s ease;
}
.nav.is-hidden {
  transform: translateY(-100%);
}
.nav__brand {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  text-decoration: none;
  line-height: 1;
}
.nav__brand:hover { text-decoration: none; color: var(--accent); }
.nav__links { display: flex; align-items: center; gap: 6px; }
.nav__link {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav__link:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.nav__link--active { color: var(--text); }
.nav__theme-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav__theme-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.nav__theme-btn span { color: inherit; }

/* ---------- Layout containers ---------- */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
}
.container--wide { max-width: 1080px; }

/* ---------- Home: hero (legacy pages) ---------- */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}
.hero__title {
  font-family: var(--font-brand);
  font-size: clamp(56px, 12vw, 120px);
  font-weight: 600;
  line-height: 1;
  margin: 0 0 16px;
  color: var(--text);
  letter-spacing: 1px;
}
.hero__subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0 0 32px;
}

/* ---------- Medium-style feed ---------- */
.feed-page {
  max-width: 1190px;
  margin: 0 auto;
  padding: 8px 24px 80px;
}
.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  align-items: start;
}
.feed-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.feed-tab {
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  padding: 14px 4px 12px;
  margin-right: 20px;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 500;
}
.feed-tab:hover { color: var(--text); }
.feed-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.feed-note {
  font-size: 13px;
  color: var(--text-muted);
  margin: 14px 0 8px;
}
.feed-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.feed-author:hover { text-decoration: none; color: var(--accent); }
.feed-author__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
}
.feed-author__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}
.article-card__excerpt-link { color: inherit; text-decoration: none; }
.article-card__excerpt-link:hover { text-decoration: none; }

.feed-aside {
  position: sticky;
  top: calc(var(--nav-height) + 12px);
  padding-top: 18px;
}
.feed-aside__block { margin-bottom: 36px; }
.feed-aside__title {
  font-size: 16px;
  font-weight: 650;
  margin: 0 0 16px;
}
.feed-aside__empty {
  font-size: 13px;
  color: var(--text-faint);
  margin: 0;
}
.pick {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.pick__n {
  font-family: var(--font-brand);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--border-strong);
}
.pick__title {
  display: block;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
  margin: 4px 0 6px;
}
.pick__title:hover { color: var(--accent); text-decoration: none; }
.pick__meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
}
.suggest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.suggest__person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.suggest__person:hover { text-decoration: none; }
.suggest__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.suggest__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.suggest__name { display: block; font-size: 14px; font-weight: 600; }
.suggest__user { display: block; font-size: 12px; color: var(--text-faint); }
.follow-btn--sm { padding: 4px 10px; font-size: 12px; flex-shrink: 0; }

@media (max-width: 900px) {
  .feed-layout { grid-template-columns: 1fr; gap: 36px; }
  .feed-aside { position: static; padding-top: 0; }
}

/* ---------- Home: article list (text left, banner right; one vertical column) ---------- */
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  margin: 48px auto 20px;
  max-width: 720px;
}
.article-list {
  list-style: none;
  margin: 0 auto 80px;
  padding: 0;
  /* Single vertical column only */
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 720px;
  width: 100%;
}
/* Simple Medium-style row: no card border/shadow */
.article-card {
  display: grid;
  grid-template-columns: 1fr 148px;
  gap: 20px;
  align-items: center;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  padding: 20px 0;
  box-shadow: none;
  transition: opacity 0.15s ease;
  text-decoration: none;
  color: inherit;
}
.article-card:hover {
  transform: none;
  box-shadow: none;
  border: none;
  background: transparent;
  text-decoration: none;
  opacity: 1;
}
.article-card:hover .article-card__title {
  color: var(--accent);
}
.article-card:hover .article-card__banner {
  transform: scale(1.02);
}
.article-card__title-link { color: inherit; text-decoration: none; }
.article-card__title-link:hover { text-decoration: none; }
.article-card__author { color: inherit; text-decoration: none; font-weight: 500; }
.article-card__author:hover { color: var(--accent); text-decoration: none; }
.article-card__banner-link { order: 2; justify-self: end; }
/* No banner: full-width text */
.article-card:not(:has(.article-card__banner)),
.article-card--no-banner {
  grid-template-columns: 1fr;
}
.article-card__banner {
  width: 148px;
  height: 100px;
  justify-self: end;
  object-fit: cover;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: none;
  flex-shrink: 0;
  order: 2;
  transition: transform 0.2s ease;
}
.article-card__body {
  padding: 0;
  min-width: 0;
  order: 1;
}
.article-card__title {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}
.article-card__excerpt {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.article-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-faint);
}
.article-card__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}
.article-list__item {
  position: relative;
  display: block;
  padding-bottom: 4px;
}
.article-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.article-edit,
.article-delete {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  cursor: pointer;
  font: inherit;
}
.article-edit:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-subtle);
  text-decoration: none;
}
.article-delete:hover {
  color: #b91c1c;
  border-color: color-mix(in srgb, #ef4444 35%, transparent);
  background: color-mix(in srgb, #ef4444 10%, transparent);
}
html[data-theme='dark'] .article-delete:hover,
html[data-theme='dark-blue'] .article-delete:hover {
  color: #fca5a5;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.empty__title { font-size: 20px; font-weight: 600; margin: 0 0 8px; color: var(--text); }
.empty__text { color: var(--text-muted); margin: 0 0 24px; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.06s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--btn-primary-bg, var(--accent));
  color: var(--btn-primary-text, var(--accent-text));
  border-color: var(--btn-primary-border, var(--btn-primary-bg, var(--accent)));
}
.btn--primary:hover {
  background: var(--btn-primary-hover, var(--accent-hover));
  border-color: var(--btn-primary-border-hover, var(--btn-primary-hover, var(--accent-hover)));
  text-decoration: none;
  color: var(--btn-primary-text, var(--accent-text));
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-subtle); border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.btn--small { padding: 6px 12px; font-size: 13px; }

/* ---------- Editor page ---------- */
.editor-page { padding: 48px 0 96px; }
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.editor-header h1 { font-size: 22px; font-weight: 600; margin: 0; }
.editor-actions { display: flex; gap: 8px; }

.field { display: block; margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field__hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.4;
}
.input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.input--title { font-size: 24px; font-weight: 600; padding: 14px 16px; }

.banner-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.banner-uploader__preview {
  width: 140px;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  object-fit: cover;
  display: none;
}
.banner-uploader__preview[src] { display: block; }
.banner-uploader__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.banner-uploader__hint { color: var(--text-faint); font-size: 12px; margin-top: 4px; }

.editor-shell { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-shell .ql-toolbar {
  background: var(--bg-subtle);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.editor-shell .ql-container { border: none; font-family: var(--font-sans); font-size: 16px; min-height: 380px; }
.editor-shell .ql-editor { min-height: 380px; padding: 24px 28px; color: var(--text); }
.editor-shell .ql-editor.ql-blank::before { color: var(--text-faint); font-style: normal; left: 28px; }
.editor-shell .ql-editor img { max-width: 100%; border-radius: 6px; margin: 8px 0; }
.editor-shell .ql-editor h1, .editor-shell .ql-editor h2, .editor-shell .ql-editor h3 { font-weight: 600; color: var(--text); }
.editor-shell .ql-editor p,
.editor-shell .ql-editor li { color: var(--text); }
.editor-shell .ql-editor p { margin: 0 0 0.4em; }
.editor-shell .ql-editor h1,
.editor-shell .ql-editor h2,
.editor-shell .ql-editor h3 { margin: 0.8em 0 0.35em; }
.editor-shell .ql-editor pre.ql-syntax {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.editor-shell .ql-snow .ql-stroke { stroke: var(--text); }
.editor-shell .ql-snow .ql-fill { fill: var(--text); }
.editor-shell .ql-snow .ql-picker { color: var(--text); }
.editor-shell .ql-snow .ql-picker-options { background: var(--bg-elevated); border-color: var(--border); }
.editor-shell .ql-snow .ql-picker-item { color: var(--text); }

.notice {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 14px;
}
.notice--error { background: color-mix(in srgb, #ef4444 12%, transparent); color: #b91c1c; border: 1px solid color-mix(in srgb, #ef4444 30%, transparent); }
.notice--ok { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
[data-theme='dark'] .notice--error { color: #fca5a5; }
[data-theme='dark-blue'] .notice--error { color: #fca5a5; }

/* ---------- Article reader ---------- */
.reader-page { padding: 0 0 96px; }
.reader-article {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 36px 0;
}
.reader-article__banner {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 40px;
  background: var(--bg-subtle);
}
.reader-article__title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.reader-article__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 40px;
}
.reader-article__body {
  font-family: var(--reader-font-family);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: var(--text);
}
.reader-article__body p { margin: 0 0 0.55em; }
.reader-article__body p:empty { display: none; }
.reader-article__body h1,
.reader-article__body h2,
.reader-article__body h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 1.8em 0 0.6em;
  line-height: 1.3;
}
.reader-article__body h1 { font-size: 1.6em; }
.reader-article__body h2 { font-size: 1.35em; }
.reader-article__body h3 { font-size: 1.15em; }
.reader-article__body a { color: var(--link); }
.reader-article__body img { border-radius: 8px; margin: 1.4em 0; }
.reader-article__body blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}
.reader-article__body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.9em;
  line-height: 1.55;
  font-family: ui-monospace, 'Cascadia Code', Consolas, 'Courier New', monospace;
  border: 1px solid #2d2d2d;
}
.reader-article__body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.reader-article__body .hljs-comment,
.reader-article__body .hljs-quote { color: #6a9955; }
.reader-article__body .hljs-string,
.reader-article__body .hljs-char.escape_,
.reader-article__body .hljs-regexp,
.reader-article__body .hljs-addition { color: #4ec9b0; }
.reader-article__body .hljs-number,
.reader-article__body .hljs-literal { color: #b5cea8; }
.reader-article__body .hljs-keyword,
.reader-article__body .hljs-selector-tag,
.reader-article__body .hljs-built_in { color: #569cd6; }
.reader-article__body .hljs-title,
.reader-article__body .hljs-section,
.reader-article__body .hljs-title.function_ { color: #dcdcaa; }
.reader-article__body .hljs-attr,
.reader-article__body .hljs-variable,
.reader-article__body .hljs-template-variable,
.reader-article__body .hljs-type { color: #9cdcfe; }
.reader-article__body .hljs-name,
.reader-article__body .hljs-selector-class,
.reader-article__body .hljs-selector-id { color: #4ec9b0; }
.reader-article__body .hljs-meta,
.reader-article__body .hljs-doctag { color: #c586c0; }
.reader-article__body code {
  background: color-mix(in srgb, #1e1e1e 12%, var(--bg-subtle));
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.reader-article__body ul,
.reader-article__body ol { padding-left: 1.5em; }
.reader-article__body li { margin: 0.4em 0; }

/* Compact menu: 3-line button + small popover (font / share / admin only) */
.reader-menu-btn {
  position: fixed;
  top: calc(var(--nav-height) + 14px);
  right: 16px;
  z-index: 55;
  width: 42px;
  height: 42px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-bg, var(--bg-elevated));
  box-shadow: var(--shadow-md);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.reader-menu-btn[hidden] { display: none !important; }
.reader-menu-btn:hover {
  background: var(--control-hover, var(--bg-subtle));
  border-color: var(--border-strong);
}
.reader-menu-btn__bar {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.reader-menu-btn--open .reader-menu-btn__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.reader-menu-btn--open .reader-menu-btn__bar:nth-child(2) {
  opacity: 0;
}
.reader-menu-btn--open .reader-menu-btn__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Invisible click-catcher only (no full-screen dim bar) */
.reader-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: transparent;
  border: none;
  cursor: default;
}
.reader-drawer-backdrop[hidden] {
  display: none !important;
}

/* Small floating card under the hamburger */
.reader-controls {
  position: fixed;
  top: calc(var(--nav-height) + 64px);
  right: 16px;
  z-index: 56;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 200px;
  max-width: calc(100vw - 32px);
  height: auto;
  max-height: none;
  margin: 0;
  padding: 12px;
  background: var(--panel-bg, var(--bg-elevated));
  border: 1px solid var(--panel-border, var(--border));
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  color: var(--text);
  transform: translateY(-6px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.16s ease, opacity 0.16s ease;
  overflow: visible;
}
.reader-controls[hidden] {
  display: none !important;
}
.reader-controls.reader-controls--open {
  display: flex !important;
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}
.reader-controls__header {
  display: none; /* compact: no big title bar */
}
.reader-controls__group { display: flex; flex-direction: column; gap: 6px; }
.reader-controls__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 2px;
}
.reader-controls__row { display: flex; gap: 4px; flex-wrap: nowrap; }
.reader-controls__btn {
  flex: 1 1 0;
  min-width: 0;
  background: var(--control-bg, var(--bg-subtle));
  border: 1px solid transparent;
  color: var(--text);
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.reader-controls__btn:hover {
  background: var(--control-hover, var(--border));
  border-color: var(--border);
}
.reader-controls__btn[aria-pressed='true'] {
  background: var(--control-active-bg);
  color: var(--control-active-text);
  border-color: transparent;
}
.reader-controls__btn--link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}
.reader-controls__btn--link:hover {
  text-decoration: none;
}
.reader-controls__btn--danger {
  width: 100%;
  color: #b91c1c;
  border-color: color-mix(in srgb, #ef4444 30%, transparent);
  background: color-mix(in srgb, #ef4444 8%, transparent);
}
.reader-controls__btn--danger:hover {
  background: color-mix(in srgb, #ef4444 16%, transparent) !important;
  border-color: color-mix(in srgb, #ef4444 45%, transparent) !important;
  color: #991b1b !important;
}
html[data-theme='dark'] .reader-controls__btn--danger,
html[data-theme='dark-blue'] .reader-controls__btn--danger {
  color: #fca5a5;
}
html[data-theme='dark'] .reader-controls__btn--danger:hover,
html[data-theme='dark-blue'] .reader-controls__btn--danger:hover {
  color: #fecaca !important;
}

.reader-controls__share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  background: var(--control-bg, var(--bg-subtle));
  border: 1px solid transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  width: 100%;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.reader-controls__share:hover {
  background: var(--control-hover, var(--border));
  border-color: var(--border);
}
.reader-controls__share-copied {
  color: var(--control-active-text);
  border-color: transparent;
  background: var(--control-active-bg);
}

/* Loading state */
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive tweaks */
@media (max-width: 640px) {
  .nav { padding: 0 16px; }
  .nav__brand { font-size: 24px; }
  .nav__link { padding: 6px 10px; }
  .hero { padding: 56px 0 32px; }
  .article-card {
    grid-template-columns: 1fr 96px;
    gap: 14px;
    padding: 16px 0;
  }
  .article-card__banner {
    width: 96px;
    height: 72px;
  }
  .article-card__title { font-size: 17px; }
  .reader-article { padding: 40px 20px 0; }
  .reader-menu-btn {
    top: auto;
    bottom: 20px;
    right: 16px;
  }
  .reader-controls {
    top: auto;
    bottom: 72px;
    right: 16px;
    width: 200px;
  }
}

/* ---------- Auth / social / profile ---------- */
.nav__signin,
.nav__signout {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav__signin:hover,
.nav__signout:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.nav__user {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav__user-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}
.nav__user-link:hover { background: var(--bg-subtle); text-decoration: none; }
.nav__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
}
.nav__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.nav__user-name {
  font-size: 13px;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publishing-as {
  margin: -8px 0 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.google-btn-wrap {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: min(100%, 280px);
  margin: 0 auto;
}
.google-signin-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
  gap: 10px;
  pointer-events: none;
}
.google-signin-btn__icon { display: block; flex: none; }
.gis-hit {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.02;
  cursor: pointer;
}
.gis-hit > div,
.gis-hit iframe {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 44px !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  margin: 8px 0 16px;
}
.auth-form .btn { justify-content: center; }

.auth-panel {
  margin: 72px auto 80px;
  max-width: 440px;
  text-align: center;
  padding: 28px 24px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.auth-panel .empty__title { margin-top: 8px; }
.auth-panel .empty__text { margin-bottom: 20px; }
.auth-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}
.auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
}
.auth-tab:hover { color: var(--text); text-decoration: none; background: var(--bg-subtle); }
.auth-tab.is-active {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-subtle);
}

.article-social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: -16px 0 32px;
}
.like-btn,
.follow-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}
.like-btn:hover,
.follow-btn:hover { border-color: var(--border-strong); color: var(--text); }
.like-btn[aria-pressed='true'] {
  color: #e11d48;
  border-color: color-mix(in srgb, #e11d48 35%, transparent);
  background: color-mix(in srgb, #e11d48 8%, transparent);
}
.follow-btn[aria-pressed='true'] {
  background: var(--bg-subtle);
  color: var(--text);
}
.follow-btn--lg { padding: 8px 18px; }
.view-stat { font-size: 13px; color: var(--text-faint); }
.reader-article__author { color: inherit; font-weight: 500; text-decoration: none; }
.reader-article__author:hover { color: var(--accent); text-decoration: none; }

.profile-hero {
  text-align: center;
  padding: 36px 0 8px;
}
.profile-hero__avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  background: var(--bg-subtle);
}
.profile-hero__avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
}
.profile-hero__name { margin: 0 0 4px; font-size: 28px; font-weight: 650; }
.profile-hero__username { margin: 0 0 16px; color: var(--text-muted); }
.profile-hero__stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.profile-hero__stats strong { color: var(--text); font-weight: 600; }
.profile-hero__actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.profile-articles .section-title {
  margin: 12px 0 10px;
  max-width: none;
  text-align: left;
}
.profile-articles .article-list {
  margin: 0 0 40px;
  gap: 0;
  max-width: none;
}
.profile-articles .article-list__item {
  padding-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.profile-articles .article-list__item:last-child {
  border-bottom: 0;
}
.profile-articles .article-card,
.profile-articles .article-card--no-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  padding: 12px 0;
  gap: 40px;
}
.profile-articles .article-card__banner-link {
  order: 0;
  flex: 0 0 auto;
  justify-self: start;
}
.profile-articles .article-card__banner {
  display: block;
  width: 176px;
  height: 118px;
  justify-self: start;
  order: 0;
  border-radius: var(--radius-sm);
}
.profile-articles .article-card__body {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
  text-align: left;
}
.profile-articles .article-card__title {
  text-align: left;
  margin: 0 0 4px;
  font-size: 26px;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.profile-articles .article-card__excerpt {
  margin: 0 0 4px;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}
.profile-articles .article-card__meta {
  justify-content: flex-start;
}

.following-people {
  margin: 0 0 22px;
}
.following-people__title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.following-people__row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.following-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated, var(--bg));
}
.following-chip__person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.following-chip__person:hover { text-decoration: none; }
.following-chip__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  flex: none;
}
.following-chip__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.following-chip__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.following-chip__user {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.feed-search {
  display: block;
  margin: 0 0 16px;
}
.feed-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elevated, var(--bg));
  border: 1px solid var(--border);
  border-radius: 10px;
}
.feed-search input:focus {
  outline: none;
  border-color: var(--accent, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #4f46e5) 18%, transparent);
}

.comments {
  margin: 48px 0 24px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.comments__title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 650;
}
.comments__list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.comments__item {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.comments__author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-right: 8px;
}
.comments__author:hover { color: var(--accent); text-decoration: none; }
.comments__item time {
  font-size: 12px;
  color: var(--text-faint);
}
.comments__body {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.comments__delete {
  margin-top: 8px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.comments__delete:hover { color: #b91c1c; }
.comments__empty {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-muted);
}
.comments__form { display: flex; flex-direction: column; gap: 10px; }
.comments__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elevated, var(--bg));
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  min-height: 84px;
}
.comments__input:focus {
  outline: none;
  border-color: var(--accent, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #4f46e5) 18%, transparent);
}
.comments__form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.comments__hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .nav__user-name { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
