/* News — economist.com-derived skin. Black/white/red, serif body, red rules. */

@font-face {
  font-family: 'rews-font-serif';
  src: url('/fonts/rews-font-serif-roman.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'rews-font-serif';
  src: url('/fonts/rews-font-serif-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'rews-font-serif-display';
  src: url('/fonts/rews-font-serif-display-roman.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'rews-font-sans';
  src: url('/fonts/rews-font-sans-roman.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'rews-font-sans';
  src: url('/fonts/rews-font-sans-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'rews-font-sans-headline';
  src: url('/fonts/rews-font-sans-headline.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --econ-red: #E3120B;
  --ink: #0D0D0D;
  --paper: #FFFFFF;
  --grey-90: #333333;
  --grey-60: #6B6B6B;
  --grey-40: #B7B7B7;
  --rule: #E0E0E0;
  --wash: #F5F4EF;
  --serif: 'rews-font-serif', Georgia, 'Times New Roman', serif;
  /* headlines use the TEXT serif (low contrast, wide), not the high-contrast
     Display cut — Display hairlines read starkly different */
  --display: 'rews-font-serif', Georgia, 'Times New Roman', serif;
  --source-blue: #5f82a6;
  --visited: #6f6f6f;
  --sans: 'rews-font-sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --col: 640px;
}

.dark {
  --ink: #E8E8E8;
  --paper: #121212;
  --grey-90: #CCCCCC;
  --grey-60: #969696;
  --grey-40: #5A5A5A;
  --rule: #2C2C2C;
  --wash: #1A1A1A;
  --source-blue: #8ab0d6;
  --visited: #8a8a8a;
}

/* sepia: warm "reading mode" — aged paper + brown ink, third tap-cycle phase */
.sepia {
  --ink: #43382a;
  --paper: #F3EAD6;
  --grey-90: #5a4c37;
  --grey-60: #857458;
  --grey-40: #b6a583;
  --rule: #ddcfb2;
  --wash: #ece0c6;
  --source-blue: #7c6a3e;
  --visited: #8a7c62;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  font-size: 20px;
  line-height: 1.6;
}

a { color: inherit; }

/* ---- header ---- */

.site-header {
  border-top: 4px solid var(--econ-red);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.wordmark img {
  height: 32px;
  width: auto;
  display: block;
}

/* the article's source domain, pinned next to the logo while the reader is
   scrolled past the in-page meta-line (js/article.js IntersectionObserver) */
.header-source {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--source-blue);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 38vw;
}
.header-source:hover { text-decoration: underline; }

.header-right { margin-left: auto; display: flex; gap: 4px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
}
.icon-btn:hover { color: var(--econ-red); }

/* ---- search (header overlay + /search page) ---- */

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(0, 0, 0, 0.32);
}
.search-backdrop[hidden] { display: none; }

.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--paper);
  border-top: 4px solid var(--econ-red);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.search-panel[hidden] { display: none; }

.search-box {
  max-width: var(--col);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--grey-60);
}
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
}
.search-box input::placeholder { color: var(--grey-40); }

.search-results {
  max-width: var(--col);
  margin: 0 auto;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 0 16px 16px;
}

.search-group-title {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--grey-60);
  margin: 14px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}
.search-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 0;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.search-item:hover .s-title { color: var(--econ-red); }
.search-item .s-title { font-family: var(--serif); font-size: 18px; line-height: 1.3; }
.search-item .s-meta { font-family: var(--sans); font-size: 12px; color: var(--grey-60); }
.search-item .s-source { color: var(--source-blue); }

.search-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
.search-chips .tag-chip {
  font-family: var(--sans);
  font-size: 13px;
  text-decoration: none;
  color: var(--econ-red);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 3px 8px;
}
.search-chips .tag-chip::before { content: '#'; opacity: 0.5; }
.search-chips .tag-chip:hover { border-color: var(--econ-red); }

.search-hint { font-family: var(--sans); font-size: 14px; color: var(--grey-60); padding: 16px 0; }

body.search-open { overflow: hidden; }

/* full-page results at /search */
.search-page { max-width: var(--col); margin: 0 auto; padding: 10px 16px 48px; }
.search-page-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 12px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--ink);
  color: var(--grey-60);
}
.search-page-box input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--display);
  font-size: 28px;
  color: var(--ink);
}
.search-page-box input::placeholder { color: var(--grey-40); }
.search-page-results .search-item { padding: 12px 0; }
.search-page-results .search-item .s-title { font-size: 20px; }

/* ---- drawer ---- */

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  border-top: 4px solid var(--econ-red);
  z-index: 60;
  transform: translateX(-102%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
.drawer-logo { display: inline-flex; align-items: center; text-decoration: none; }
.drawer-logo img { height: 25px; width: auto; display: block; }

.drawer-links { display: flex; flex-direction: column; padding: 8px 0; }
.drawer-links a {
  font-family: var(--sans);
  font-size: 15px;
  text-decoration: none;
  padding: 11px 18px;
  border-bottom: 1px solid var(--rule);
}
.drawer-links a:hover { color: var(--econ-red); }

/* home / theme / search / refresh, bottom-aligned above the auth block, right-aligned */
.drawer-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 12px 12px;
  border-top: 1px solid var(--rule);
}
.drawer-actions .icon-btn { padding: 8px; }

.drawer-auth { padding: 16px 18px; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 13px; }
.drawer-auth p { margin-bottom: 8px; color: var(--grey-60); }
.drawer-auth input[type=email] {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 8px;
}
.drawer-auth .signed-email { font-weight: 600; color: var(--ink); }

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 50;
}

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  background: var(--econ-red);
  color: #fff;
  border: none;
  padding: 9px 16px;
  cursor: pointer;
}
.btn:hover { background: #C10E08; }
.btn.ghost {
  background: none;
  color: var(--ink);
  border: 1px solid var(--grey-40);
}
.btn.ghost:hover { color: var(--econ-red); border-color: var(--econ-red); }

/* ---- modal (downvote "anything wrong?" dialog) ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--paper);
  color: var(--ink);
  border-top: 4px solid var(--econ-red);
  max-width: 400px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.modal h3 {
  font-family: var(--sans);
  font-size: 18px;
  margin: 0 0 4px;
}
.modal-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
  margin: 0 0 14px;
}
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-options .btn { width: 100%; text-align: left; }
/* second line inside a modal option (the refresh menu's explanations) */
.modal-options .modal-desc {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--grey-60);
  margin-top: 2px;
}
/* thin rule separating the issue options from the demote-source action */
.modal-cut {
  border-top: 1px solid var(--grey-40);
  margin: 14px 0;
}
.modal-demote { color: var(--grey-60); }

.modal-describe textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
  margin: 10px 0 8px;
  resize: vertical;
}
.modal-actions { display: flex; justify-content: flex-end; }

/* on-demand rews: "Writing the story in the voice of …" (js/article.js) */
.rews-writing h3 { font-family: var(--display); font-weight: 500; font-size: 22px; line-height: 1.2; }
.rews-writing .rw-quill { color: var(--econ-red); margin-bottom: 8px; transform-origin: 20% 90%; animation: rw-scribble 1.1s ease-in-out infinite; }
.rews-writing .rw-bar { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; position: relative; }
.rews-writing .rw-fill { height: 100%; width: 0; background: var(--econ-red); border-radius: 3px; transition: width 0.4s ease; position: relative; overflow: hidden; }
/* a sheen running along the filled part: the bar is alive between stage reports */
.rews-writing .rw-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: rw-sheen 1.6s ease-in-out infinite;
}
.rews-writing .rw-stage { font-family: var(--sans); font-size: 13px; color: var(--grey-60); margin: 10px 0 16px; min-height: 2.6em; }
.rews-writing .modal-actions { gap: 8px; }
.rews-writing.failed .rw-quill, .rews-writing.failed .rw-fill::after { animation: none; }
.rews-writing.failed .rw-fill { background: var(--grey-40); }
@keyframes rw-scribble { 0%, 100% { transform: rotate(0deg) translateX(0); } 30% { transform: rotate(-8deg) translateX(3px); } 60% { transform: rotate(5deg) translateX(-2px); } }
@keyframes rw-sheen { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .rews-writing .rw-quill, .rews-writing .rw-fill::after { animation: none; }
}
/* Sources rank dialog: one big numeric field, Enter submits */
.modal-number input {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  padding: 8px 10px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
  margin: 4px 0 10px;
}

/* ---- view / feed ---- */

.view { max-width: var(--col); margin: 0 auto; padding: 0 16px 80px; }

.filter-banner {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
  background: var(--wash);
  padding: 8px 12px;
  margin: 12px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-banner b { color: var(--ink); }
.filter-banner button { margin-left: auto; }

/* two-column grid: every card spans the full width except two-ups (t2), which
   take one column each and pair up into rows */
.feed {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.card {
  grid-column: 1 / -1;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.card-body { min-width: 0; }

/* ---- picture templates (front page only; see js/layout.js) ---- */

.card-img {
  display: block;
  margin: 0 0 12px;
}
.card-img img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--wash);
}
.dark .card-img img { filter: brightness(0.9); }

/* t2: two-up — half column each, hairline between the pair, tighter type */
.card.t2 { grid-column: span 1; }
.card.t2.t2-l { padding-right: 14px; }
.card.t2.t2-r { padding-left: 14px; border-left: 1px solid var(--rule); }
.card.t2 h3 { font-size: 20px; line-height: 1.18; }
.card.t2 .kicker { margin-bottom: 4px; }
.card.t2 .rubric { font-size: 14px; margin-bottom: 4px; }

/* t3 / t4: text beside a thumbnail (picture right / left) */
.card.t3, .card.t4 {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.card.t3 .card-body, .card.t4 .card-body { flex: 1 1 auto; }
.card.t3 .card-img, .card.t4 .card-img {
  flex: 0 0 34%;
  max-width: 230px;
  margin: 2px 0 0;
}
.card.t3 h3, .card.t4 h3 { font-size: 22px; line-height: 1.16; }
.card.t3 .rubric, .card.t4 .rubric { font-size: 16px; }

/* t5: long dek-less headline set large */
.card.t5 h3 {
  font-size: 32px;
  line-height: 1.08;
  margin-bottom: 8px;
}
.card.t5 .rubric { margin-top: 2px; }

.card .kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--econ-red);
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.card .kicker .tag-chip { text-decoration: none; color: var(--econ-red); }
.card .kicker .tag-chip:hover { text-decoration: underline; }
.card .kicker .badge-injected { color: var(--grey-40); font-weight: 400; letter-spacing: 0; text-transform: none; }

.card h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.14;
  margin-bottom: 6px;
}
.card h3 a { text-decoration: none; }
/* already-visited headlines fade to a medium-dark grey (server-read too) */
.card h3 a:visited { color: var(--visited); }
.card.read h3 a { color: var(--visited); }
.card h3 a:hover { color: var(--econ-red); }

.card .rubric {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
  color: var(--grey-90);
  margin-bottom: 7px;
}
.source-link { color: var(--source-blue); text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.card .rubric .source-link {
  font-family: var(--sans);
  font-size: 13px;
  white-space: nowrap;
}
/* keep the source blue in the article meta line too (must out-specify
   `.article .meta-line a`, which is 0,0,2,1) */
.article .meta-line .source-link { color: var(--source-blue); }
.article .meta-line .source-link:hover { color: var(--source-blue); text-decoration: underline; }

.card .meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey-60);
}
.card .meta a { color: var(--grey-60); text-decoration: none; }
.card .meta a:hover { color: var(--econ-red); }
.card .meta .sep { margin: 0 4px; color: var(--grey-40); }

/* story age ("5d", "2wk", "1mo"…) — shown once a story is older than 4 days */
.badge-age {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--paper);
  background: var(--source-blue);
  padding: 0 5px;
  margin-left: 6px;
}

.badge-hn, .badge-type {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--grey-60);
  border: 1px solid var(--grey-40);
  padding: 0 5px;
  margin-left: 6px;
}

.feed-sentinel { height: 1px; }
.feed-loading {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
  text-align: center;
  padding: 24px 0;
}
.feed-end {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-40);
  text-align: center;
  padding: 30px 0;
}
.feed-end .feed-fresh { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.feed-end .feed-soon { margin-top: 12px; color: var(--grey-60); }

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

.article { padding-top: 26px; }

.article .kicker-rule {
  width: 64px;
  height: 3px;
  background: var(--econ-red);
  margin-bottom: 14px;
}

.article .kicker {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--econ-red);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.article .kicker a { color: var(--econ-red); text-decoration: none; }
.article .kicker a:hover { text-decoration: underline; }

.article-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.article-top h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(33px, 6.5vw, 50px);
  line-height: 1.08;
  flex: 1;
}

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-40);
  padding: 6px 0 6px 6px;
  margin-top: 6px;
}
.fav-btn:hover { color: var(--econ-red); }
.fav-btn.on { color: var(--econ-red); }

.article .rubric {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.38;
  color: var(--grey-90);
  margin-top: 14px;
}

.article .meta-line {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
  margin: 18px 0 0;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
}
.article .meta-line a { color: var(--grey-60); text-decoration: none; }
.article .meta-line a:hover { color: var(--econ-red); }

/* hero picture under the meta-line — only when the body has no image of its own */
.article-hero { margin: 18px 0 0; }
.article-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--wash);
}
.dark .article-hero img { filter: brightness(0.9); }

.article-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}
.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-40);
  padding: 4px 7px;
}
.vote-btn:hover { color: var(--ink); }
.vote-btn.on { color: var(--econ-red); }

.flag-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-40);
  padding: 4px 7px;
}
.flag-btn:hover { color: var(--econ-red); }

/* rews toggle (right of the flag): source ⇄ its rews version */
.rews-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--grey-40);
  padding: 4px 7px;
}
.rews-btn:hover { color: var(--ink); }
.rews-btn.on { color: var(--econ-red); }

/* foot of a rews story: the reporting it was written from */
.rews-foot { margin-top: 28px; }
/* the foot's own rule follows right after: no second rule under the last source */
.rews-sources li:last-child { border-bottom: none; }
.rews-sources .s-ext { color: var(--grey-60); vertical-align: -2px; margin-left: 4px; }
.rews-sources .s-ext:hover { color: var(--econ-red); }

/* bottom-row heart: pushed to the far right, away from the thumbs+flag group */
.fav-foot { margin-left: auto; }

.lang-select {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey-60);
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 3px 4px;
  margin-left: 10px;
}

/* "In brief" — top-of-article bullet summary with jump-to-passage anchors */
.in-brief {
  margin: 24px 0 4px;
  padding: 13px 0 15px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.in-brief-label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--econ-red);
  margin-bottom: 9px;
}
.in-brief ul { list-style: none; margin: 0; padding: 0; }
.in-brief li {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.46;
  color: var(--grey-90);
  position: relative;
  padding-left: 16px;
  margin-bottom: 7px;
}
.in-brief li:last-child { margin-bottom: 0; }
.in-brief li::before { content: "•"; color: var(--econ-red); position: absolute; left: 0; }
.ib-jump {
  font-family: var(--sans);
  text-decoration: none;
  color: var(--grey-40);
  margin-left: 3px;
  font-size: 0.95em;
}
.ib-jump:hover { color: var(--econ-red); }
/* keep a jumped-to block clear of the sticky header */
.article-body > [id^="ib-"] { scroll-margin-top: 72px; }

.article-body { margin-top: 26px; }

.article-body p { margin-bottom: 1.15em; }

.article-body > p:first-of-type::first-letter {
  font-family: var(--display);
  font-size: 3.05em;
  line-height: 0.82;
  float: left;
  padding: 4px 8px 0 0;
  color: var(--econ-red);
  font-weight: 600;
}

.article-body h2, .article-body h3, .article-body h4 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.22;
  margin: 1.6em 0 0.6em;
}
.article-body h2 { font-size: 28px; }
.article-body h3 { font-size: 24px; }
.article-body h4 { font-size: 21px; }

.article-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--grey-40); text-underline-offset: 2px; }
.article-body a:hover { color: var(--econ-red); text-decoration-color: var(--econ-red); }

.article-body ul, .article-body ol { margin: 0 0 1.15em 1.4em; }
.article-body li { margin-bottom: 0.35em; }

.article-body blockquote {
  font-family: var(--serif);
  font-style: italic;
  border-left: 3px solid var(--econ-red);
  padding-left: 16px;
  margin: 1.4em 0;
  color: var(--grey-90);
}

.article-body figure { margin: 1.6em 0; }
.article-body img {
  max-width: 100%;
  height: auto;
  display: block;
}
.article-body figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
  padding-top: 8px;
}

.article-body pre {
  font-size: 13.5px;
  background: var(--wash);
  padding: 14px;
  overflow-x: auto;
  margin-bottom: 1.15em;
}
.article-body code { font-size: 0.88em; background: var(--wash); padding: 1px 4px; }
.article-body pre code { background: none; padding: 0; }

.article-body table {
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14px;
  margin: 1.4em 0;
  width: 100%;
}
.article-body td, .article-body th {
  border: 1px solid var(--rule);
  padding: 6px 9px;
  text-align: left;
}

.notice {
  font-family: var(--sans);
  font-size: 14px;
  background: var(--wash);
  border-left: 3px solid var(--econ-red);
  padding: 14px 16px;
  margin: 22px 0;
}
.notice a { color: var(--econ-red); }
.notice .btn { margin-top: 10px; }
/* body placeholder while an auto-translation warms (article.js) */
.notice.translating { animation: notice-pulse 1.6s ease-in-out infinite; }
@keyframes notice-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .notice.translating { animation: none; } }

/* article footer: votes, related, original link */

.article-foot {
  margin-top: 36px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}

.article-foot .vote-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--grey-60);
}

.related { margin-top: 30px; }
.related + .related { margin-top: 26px; }
.related h4 {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  border-top: 3px solid var(--ink);
  padding-top: 8px;
  margin-bottom: 12px;
}
.related ul { list-style: none; }
.related li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.related .r-title { font-family: var(--display); font-weight: 500; font-size: 19px; line-height: 1.25; text-decoration: none; display: block; }
.related .r-title:hover { color: var(--econ-red); }
.related .r-meta { font-family: var(--sans); font-size: 12px; color: var(--grey-60); margin-top: 2px; }
.related .same-story {
  color: var(--econ-red);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 6px;
}
.related .badge-injected { color: var(--grey-40); margin-left: 4px; }

.original-link {
  margin-top: 30px;
  font-family: var(--sans);
  font-size: 14px;
  padding: 14px 0;
  border-top: 3px solid var(--ink);
}
.original-link a { color: var(--econ-red); text-decoration: none; word-break: break-all; }
.original-link a:hover { text-decoration: underline; }
.original-link .hn-link { margin-top: 6px; }

/* ---- lists / settings / admin ---- */

.page-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 32px;
  margin: 26px 0 4px;
}
.page-sub {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--grey-60);
  margin-bottom: 10px;
}

/* Activity page tab selector: icon + label pills (same idiom as .lang-chip) */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--grey-40);
  border-radius: 999px;
  color: var(--grey-60);
  text-decoration: none;
  user-select: none;
  transition: color .12s, border-color .12s, background .12s;
}
.pill svg { flex: none; }
.pill:hover { color: var(--ink); border-color: var(--econ-red); }
.pill.on { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.card .un-row { margin-top: 8px; }
.un-btn {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey-60);
  background: none;
  border: 1px solid var(--grey-40);
  padding: 3px 10px;
  cursor: pointer;
}
.un-btn:hover { color: var(--econ-red); border-color: var(--econ-red); }

.settings-block { margin: 26px 0; border-bottom: 1px solid var(--rule); padding-bottom: 26px; }
.settings-block h4 { font-family: var(--sans); font-size: 15px; margin-bottom: 6px; }
.settings-block p.hint { font-family: var(--sans); font-size: 13px; color: var(--grey-60); margin-bottom: 12px; }
.settings-block select, .settings-block input[type=text] {
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
  min-width: 200px;
}
.settings-block input[type=range] { width: 220px; accent-color: var(--econ-red); }
.range-val { font-family: var(--sans); font-size: 13px; color: var(--grey-60); margin-left: 10px; }

/* allowed-languages multiselect: quiet toggle chips */
.lang-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-chip {
  font-family: var(--sans);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--grey-40);
  border-radius: 999px;
  color: var(--grey-60);
  cursor: pointer;
  user-select: none;
  transition: color .12s, border-color .12s, background .12s;
}
.lang-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.lang-chip:hover { border-color: var(--econ-red); }
.lang-chip.on { color: var(--paper); background: var(--ink); border-color: var(--ink); }

/* front-page template switches, each with a pictogram of the card shape */
.tpl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  cursor: pointer;
}
.tpl-row:last-child { border-bottom: none; }
.tpl-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl-name { font-size: 14px; font-weight: 600; }
.tpl-desc { font-size: 12px; color: var(--grey-60); }
.tpl-glyph {
  flex: none;
  width: 52px;
  height: 36px;
  display: grid;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.tpl-glyph i { display: block; background: var(--grey-40); }   /* picture */
.tpl-glyph b { display: block; background: var(--ink); height: 3px; border-radius: 1px; } /* text line */
.tpl-glyph b + b { opacity: 0.45; }
.tpl-glyph.tpl-1 { grid-template-rows: 1fr 3px 3px; }
.tpl-glyph.tpl-2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 3px; }
.tpl-glyph.tpl-2 i { grid-column: 1 / -1; width: 46%; }
.tpl-glyph.tpl-2 b { width: 90%; }
.tpl-glyph.tpl-3 { grid-template-columns: 1fr 20px; grid-template-rows: 1fr 1fr; align-items: center; }
.tpl-glyph.tpl-3 i { grid-column: 2; grid-row: 1 / -1; height: 100%; }
.tpl-glyph.tpl-3 b { grid-column: 1; }
.tpl-glyph.tpl-4 { grid-template-columns: 20px 1fr; grid-template-rows: 1fr 1fr; align-items: center; }
.tpl-glyph.tpl-4 i { grid-column: 1; grid-row: 1 / -1; height: 100%; }
.tpl-glyph.tpl-4 b { grid-column: 2; }
.tpl-glyph.tpl-5 { grid-template-rows: 1fr 1fr; align-items: center; }
.tpl-glyph.tpl-5 i { display: none; }
.tpl-glyph.tpl-5 b { height: 6px; }
.tpl-glyph.tpl-5 b + b { opacity: 1; width: 65%; }

.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 14px;
}
.source-row .s-domain { font-weight: 600; text-decoration: none; }
.source-row .s-domain:hover { color: var(--econ-red); }
.source-row .s-kind { font-size: 12px; color: var(--grey-60); }
.source-row .s-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.source-row .s-rank {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--grey-60);
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: none;
  border: 1px solid transparent;
  padding: 2px 4px;
  cursor: pointer;
}
.source-row .s-rank:hover:not(:disabled) { color: var(--econ-red); border-color: var(--grey-40); }
.source-row .s-rank:disabled { cursor: default; }
.rank-btn {
  background: none;
  border: 1px solid var(--grey-40);
  color: var(--grey-60);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
}
.rank-btn:hover:not(:disabled) { color: var(--econ-red); border-color: var(--econ-red); }
.rank-btn:disabled { opacity: 0.35; cursor: default; }

/* "open site in a new tab" glyph (sources list + feed filter banner) */
.s-ext { color: var(--grey-40); display: inline-flex; align-items: center; text-decoration: none; }
.s-ext:hover { color: var(--econ-red); }

.add-source { display: flex; gap: 8px; margin: 14px 0; }
.add-source input { flex: 1; }

.sources-toolbar { display: flex; gap: 8px; align-items: center; margin: 6px 0 2px; }
.src-filter {
  flex: 1;
  font-family: var(--sans);
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
}

/* left→right toggle switch (on = source active, off = muted) */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--grey-40);
  border-radius: 22px;
  transition: background 0.18s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background: var(--paper);
  border-radius: 50%;
  transition: transform 0.18s;
}
.switch input:checked + .slider { background: var(--ink); }
.switch input:checked + .slider::before { transform: translateX(16px); }

.admin-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 13px; margin: 14px 0; }
.admin-table th, .admin-table td { border: 1px solid var(--rule); padding: 6px 8px; text-align: left; }
.admin-table th { background: var(--wash); font-weight: 600; }
.admin-table .num { text-align: right; }

/* Admin → rews: model/switch row, persona grid with inline inputs, voice editor */
.rews-settings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--sans); font-size: 14px; margin: 10px 0; }
.rews-settings input, .rews-personas input, .rews-personas textarea, .rews-add-form input, .rews-add-form textarea {
  font-family: var(--sans);
  font-size: 13px;
  padding: 5px 7px;
  border: 1px solid var(--grey-40);
  background: var(--paper);
  color: var(--ink);
}
.rews-settings #rews-model { width: 240px; }
.rews-onoff { display: inline-flex; align-items: center; gap: 8px; }
.rews-personas input { width: 100%; min-width: 70px; }
.rews-personas .p-weight { width: 64px; min-width: 0; }
.rews-personas .p-acts { white-space: nowrap; }
.rews-personas .p-acts .un-btn + .un-btn { margin-left: 4px; }
.rews-personas .p-voice textarea, .rews-personas .p-voice input { width: 100%; margin-top: 4px; }
.rews-personas .p-voice textarea { line-height: 1.45; resize: vertical; }
.rews-add { font-family: var(--sans); font-size: 14px; margin: 6px 0 14px; }
.rews-add summary { cursor: pointer; color: var(--grey-60); }
.rews-add-form { display: grid; gap: 6px; margin-top: 8px; max-width: 640px; }
.rews-sub { font-family: var(--sans); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 18px; }

/* ---- toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 18px;
  z-index: 100;
  max-width: 90vw;
}

/* ---- desktop ---- */

@media (min-width: 720px) {
  .view { padding: 0 0 80px; }
  .header-inner { padding: 12px 0; }
  .card h3 { font-size: 29px; }
  .card.t2 h3 { font-size: 23px; }
  .card.t3 h3, .card.t4 h3 { font-size: 25px; }
  .card.t5 h3 { font-size: 36px; }
  .card.t3, .card.t4 { gap: 22px; }
}
.rews-desk { margin-top: 2px; }
.rews-num { display: inline-flex; align-items: center; gap: 6px; }
.rews-num input { width: 72px; }
.rews-num span { color: var(--grey-60); font-size: 12px; }
