/* ============================================================
   XCryptoDaily — corporate news theme (light + dark), RTL
   ============================================================ */

:root,
[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-soft: #F5F7F9;
  --panel: #FFFFFF;
  --line: #E2E7EB;
  --text: #16191C;
  --muted: #66727A;
  --brand-dark: #1E2B33;
  --brand-dark-soft: #2A3B45;
  --accent: #0A63F2;
  --accent-dark: #0850C7;
  --accent-ink: #FFFFFF;
  --up: #0A9B6E;
  --down: #D63B32;
  --shadow: rgba(20,30,38,.10);
  --hero-glow: rgba(10,99,242,.05);
}

[data-theme="dark"] {
  --bg: #13181B;
  --bg-soft: #1A2124;
  --panel: #1E2629;
  --line: #2B3538;
  --text: #EAEDEF;
  --muted: #8B9599;
  --brand-dark: #0C1113;
  --brand-dark-soft: #171F22;
  --accent: #4E9BFF;
  --accent-dark: #79B4FF;
  --accent-ink: #08131F;
  --up: #2BD9A5;
  --down: #F5645A;
  --shadow: rgba(0,0,0,.35);
  --hero-glow: rgba(78,155,255,.08);
}

:root {
  --radius: 6px;
  --radius-lg: 10px;
  --font-display: "Inter", "Tajawal", sans-serif;
  --font-body: "Inter", "Tajawal", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --container-w: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -.01em;
  line-height: 1.65;
  transition: background .2s, color .2s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: var(--container-w); margin: 0 auto; padding: 0 20px; }
.text-accent { color: var(--accent); }
.empty-note { color: var(--muted); padding: 40px 0; }
.lead { color: var(--muted); font-size: 17px; }

/* ---------- Utility bar ---------- */
.utility-bar {
  background: var(--brand-dark);
  color: rgba(255,255,255,.72);
}
.utility-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  font-size: 12px;
}
.utility-tagline {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
}
.utility-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-inline-start: auto;
}

.theme-toggle {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.lang-switch {
  display: flex;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.lang-switch a { padding: 3px 7px; border-radius: 4px; color: rgba(255,255,255,.6); }
.lang-switch a.active { background: rgba(255,255,255,.14); color: #fff; }
.lang-switch a:hover { color: #fff; }

.account-link {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.account-link:hover { color: var(--accent-dark); }

/* ---------- Price tape ---------- */
.tape {
  display: flex;
  align-items: stretch;
  background: var(--brand-dark-soft);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  direction: ltr;
}
.tape-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 0 14px;
}
.tape-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s ease infinite;
}
.tape-scroll { flex: 1; overflow: hidden; white-space: nowrap; font-family: var(--font-mono); font-size: 13px; }
.tape-inner { display: inline-block; padding: 9px 0; animation: slide 45s linear infinite; }
.tape:hover .tape-inner { animation-play-state: paused; }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-inner { animation: none; } }
.tape-coin { margin: 0 18px; color: rgba(255,255,255,.55); }
.tape-coin b { color: #fff; font-weight: 500; }
.tape-coin .price { color: #fff; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- Breaking news ticker ---------- */
.breaking {
  display: flex;
  align-items: stretch;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  min-height: 38px;
}
.breaking-label {
  flex-shrink: 0;
  background: var(--down);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 14px;
  display: flex;
  align-items: center;
}
.breaking-track { flex: 1; overflow: hidden; position: relative; }
.breaking-inner {
  display: inline-flex;
  gap: 40px;
  white-space: nowrap;
  animation: breaking 60s linear infinite;
  padding: 9px 16px;
}
.breaking-inner a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.breaking-inner a:hover { color: var(--accent); }
@keyframes breaking { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.breaking:hover .breaking-inner { animation-play-state: paused; }

/* ---------- Masthead ---------- */
header.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
}
.logo {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: var(--text);
}
.logo span { color: var(--accent); }
.logo-has-img {
  display: flex;
  align-items: center;
  line-height: 1;
}
.logo-img {
  display: block;
  max-height: 44px;
  max-width: min(220px, 55vw);
  width: auto;
  height: auto;
  object-fit: contain;
}

.search-wrap {
  position: relative;
  min-width: 200px;
  max-width: 360px;
  flex: 1;
  margin-inline-start: auto;
}
.search-form {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
}
.search-form input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  min-width: 0;
}
.search-form input::placeholder { color: var(--muted); }
.search-form button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  padding: 0 14px;
  cursor: pointer;
}
.search-wrap-lg { max-width: 520px; margin-top: 16px; margin-inline-start: 0; min-width: 0; }

.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px var(--shadow);
  overflow: hidden;
  z-index: 60;
  text-align: start;
}
.search-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.search-suggest-item:last-child { border-bottom: 0; }
.search-suggest-item:hover { background: var(--bg-soft); }
.search-suggest-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--bg-soft) center/cover no-repeat;
}
.search-suggest-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.search-suggest-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-suggest-meta { font-size: 12px; color: var(--muted); }
.search-suggest-empty,
.search-suggest-loading {
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.search-suggest-more {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  background: var(--bg-soft);
}
.search-suggest-more:hover { background: var(--hero-glow); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ---------- Nav bar (categories) ---------- */
.nav-bar {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 0;
}
.nav-bar a {
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
}
.nav-bar a em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: none;
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--muted);
}
.nav-bar a:hover { color: var(--text); }
.nav-bar a.active { color: var(--accent); border-color: var(--accent); }
.nav-bar a.active em { background: var(--hero-glow); color: var(--accent); }

/* ---------- Market panel ---------- */
.market-panel {
  margin: 28px 0 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.market-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.market-panel-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.live-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--up);
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.market-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card.skeleton .stat-value { opacity: .4; }
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}
.stat-change { font-family: var(--font-mono); font-size: 12px; }

/* ---------- Topic pills ---------- */
.topic-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.topic-pills-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-inline-end: 4px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.pill em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
.pill:hover { border-color: var(--accent); color: var(--accent); background: var(--hero-glow); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 28px;
  margin: 28px 0;
}
.hero-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, border-color .2s;
}
.hero-card:hover { box-shadow: 0 12px 30px var(--shadow); }
.hero-card .thumb { aspect-ratio: 16 / 8; background: var(--bg-soft) center/cover no-repeat; }
.hero-card .body { padding: 26px; }
.hero-card h2 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  line-height: 1.24;
  margin: 12px 0;
  letter-spacing: -.01em;
}
.hero-card h2 a:hover { color: var(--accent); }
.hero-meta { margin-top: 14px; }

.side-list { display: flex; flex-direction: column; gap: 14px; }
.side-list h3 {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-dark);
}
.side-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.side-item:last-child { border-bottom: 0; padding-bottom: 0; }
.side-thumb {
  position: relative;
  flex-shrink: 0;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}
.side-thumb-img {
  width: 84px;
  height: 84px;
  background: var(--bg-soft) center/cover no-repeat;
  transition: transform .2s;
}
.side-thumb-fallback {
  background: linear-gradient(135deg, var(--bg-soft), var(--line));
}
.side-thumb:hover .side-thumb-img { transform: scale(1.05); }
.side-thumb .rank {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  min-width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.side-body { flex: 1; min-width: 0; }
.side-body > a {
  display: block;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 6px;
}
.side-body > a:hover { color: var(--accent); }

/* ---------- Labels & meta ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--brand-dark);
  padding: 4px 10px;
  border-radius: 3px;
}
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 3px solid var(--brand-dark);
  padding-top: 16px;
  margin: 16px 0 20px;
}
.section-head h3 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
}

.page-head { margin: 28px 0 8px; }
.page-head h1 { font-family: var(--font-display); font-size: 28px; font-weight: 800; }

/* ---------- Card grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 40px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line);
  box-shadow: 0 12px 28px var(--shadow);
}
.card:hover::before { transform: scaleX(1); }
.card-thumb-link { position: relative; display: block; }
.card .thumb { aspect-ratio: 16 / 9; background: var(--bg-soft) center/cover no-repeat; }
.card-read {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 10px;
  background: rgba(20,26,30,.82);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
}
.card .body { padding: 18px; flex: 1; display: flex; flex-direction: column; gap: 9px; }
.card h4 { font-size: 17px; font-weight: 700; line-height: 1.4; flex: 1; letter-spacing: -.01em; }
.card h4 a:hover { color: var(--accent); }
.card p { font-size: 14px; color: var(--muted); }

.ad-slot {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 34px 10px;
  margin: 28px 0;
  background: var(--bg-soft);
}
.ad-unit {
  margin: 28px 0;
  text-align: center;
  overflow: hidden;
  border-radius: var(--radius);
}
.ad-unit iframe,
.ad-unit ins { display: block; margin: 0 auto; max-width: 100%; }

.ad-slot-inline { margin: 28px 0; }
.ad-slot-bottom { margin: 8px 0 28px; }

.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 34px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--panel);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.pagination .page-arrow { font-size: 16px; padding: 9px 12px; }

/* ---------- Article page ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin: 20px 0 8px;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span[aria-current] { color: var(--text); }

/* Article 3-column layout: left ad | content | right ad */
.article-layout {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 160px;
  gap: 24px;
  align-items: start;
  margin-bottom: 40px;
}
.article-layout.no-left {
  grid-template-columns: minmax(0, 1fr) 160px;
}
.article-layout.no-right {
  grid-template-columns: 160px minmax(0, 1fr);
}
.article-layout.no-left.no-right {
  grid-template-columns: minmax(0, 1fr);
}
.article-main { min-width: 0; }

.article-rail { min-width: 0; }
.article-rail-sticky {
  position: sticky;
  top: 14px;
}
.article-rail .ad-slot,
.article-rail .ad-unit {
  margin: 0;
}
.article-rail .ad-slot {
  min-height: 600px;
  padding: 16px 6px;
  font-size: 11px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.article-rail .ad-unit {
  max-width: 160px;
  margin-inline: auto;
}

@media (min-width: 1280px) {
  .article-layout {
    grid-template-columns: 180px minmax(0, 1fr) 180px;
    gap: 28px;
  }
  .article-layout.no-left { grid-template-columns: minmax(0, 1fr) 180px; }
  .article-layout.no-right { grid-template-columns: 180px minmax(0, 1fr); }
  .article-rail .ad-unit { max-width: 180px; }
}

@media (max-width: 1100px) {
  .article-rail { display: none; }
  .article-layout,
  .article-layout.no-left,
  .article-layout.no-right,
  .article-layout.no-left.no-right {
    grid-template-columns: minmax(0, 1fr);
  }
}

article.single { max-width: none; margin: 20px 0 34px; }
article.single h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -.015em;
  margin: 12px 0 18px;
}
.article-meta { margin-bottom: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }

.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.share-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-inline-end: 4px;
}
.share-btn {
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

article.single .content { margin: 24px 0; font-size: 18px; color: var(--text); line-height: 1.8; }
article.single .content h2,
article.single .content h3,
article.single .content h4 {
  font-family: var(--font-display);
  font-weight: 800;
  margin: 1.4em 0 0.6em;
  line-height: 1.28;
  color: var(--text);
}
article.single .content p { margin: 0 0 1.1em; }
article.single .content ul,
article.single .content ol { margin: 0 0 1.1em 1.2em; padding: 0; }
article.single .content li { margin-bottom: 0.5em; }
article.single .content a { color: var(--accent); text-decoration: underline; }
article.single .content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.3em auto;
}
article.single .content blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 20px;
  border-inline-start: 3px solid var(--accent);
  font-size: 1.05em;
  font-style: italic;
  color: var(--muted);
}
article.single .cover { border-radius: var(--radius-lg); margin: 20px 0; width: 100%; height: auto; }

.source-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--muted);
}
.source-box a { color: var(--accent); }

/* ---------- Author byline / box ---------- */
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--brand-dark);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.avatar-md { width: 48px; height: 48px; font-size: 16px; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }

.author-byline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}
.author-byline:hover { color: var(--accent); }

.author-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 20px;
}
.author-box-body { display: flex; flex-direction: column; gap: 2px; }
.author-box-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.author-box-name { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); }
.author-box-name:hover { color: var(--accent); }
.author-box-role { font-size: 13px; color: var(--muted); margin: 0; }
.author-box-link { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 2px; }

.author-page .author-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}
.author-page .author-role { color: var(--muted); margin: 2px 0 0; }
.author-page .author-editor { font-size: 13px; }
.author-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.author-tags-label { font-size: 13px; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 48px;
  background: var(--brand-dark);
  color: rgba(255,255,255,.68);
  font-size: 14px;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 48px 20px 32px;
}
.footer-col h4 {
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
}
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: rgba(255,255,255,.68); }
.footer-col a:hover { color: #fff; }
.footer-logo {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}
.footer-col-brand p { margin-top: 10px; max-width: 320px; line-height: 1.6; }
.footer-editor a { color: var(--accent-dark); font-weight: 600; }
.footer-social { display: flex; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.footer-social a { font-size: 13px; font-weight: 600; color: #fff; }
.footer-social a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-lang { margin-top: 16px; border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius); padding: 3px; display: inline-flex; width: fit-content; }
.footer-lang a { padding: 4px 9px; border-radius: 4px; color: rgba(255,255,255,.6); font-family: var(--font-mono); font-size: 11px; }
.footer-lang a.active { background: rgba(255,255,255,.14); color: #fff; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
}
.footer-copy { white-space: nowrap; }
.footer-disclaimer { color: rgba(255,255,255,.45); max-width: 640px; }

/* ---------- Back to top ---------- */
.back-top {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 40;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.back-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- RTL ---------- */
[dir="rtl"] body, [dir="rtl"] { letter-spacing: 0; }
[dir="rtl"] .logo, [dir="rtl"] .hero-card h2, [dir="rtl"] article.single h1 { letter-spacing: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .market-stats { grid-template-columns: repeat(3, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; }
  .hero-card h2 { font-size: 22px; }
  .nav-toggle { display: flex; }
  .nav-bar {
    display: none;
    flex-direction: column;
    gap: 0;
  }
  .nav-bar.open { display: flex; }
  .nav-bar a { border-bottom: 1px solid var(--line); border-inline-start: 2px solid transparent; margin-bottom: 0; }
  .nav-bar a.active { border-inline-start-color: var(--accent); border-bottom-color: var(--line); }
  .masthead-inner { flex-wrap: wrap; }
  .search-form { order: 3; flex-basis: 100%; margin-inline-start: 0; max-width: none; }
  .utility-tagline { display: none; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .market-stats { grid-template-columns: 1fr 1fr; }
  article.single h1 { font-size: 27px; }
  .breaking-label { font-size: 10px; padding: 0 10px; }
  .share-bar { gap: 6px; }
  .share-btn { font-size: 12px; padding: 5px 10px; }
  .footer-top { grid-template-columns: 1fr; padding: 36px 20px 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ---------- Forms & auth pages ---------- */
.msg {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}
.msg.ok {
  background: color-mix(in srgb, var(--up) 14%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--up) 40%, transparent);
  color: var(--up);
}
.msg.err {
  background: color-mix(in srgb, var(--down) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--down) 35%, transparent);
  color: var(--down);
}

.auth-form {
  max-width: 520px;
  margin: 28px auto 40px;
  padding: 0 4px;
}
.auth-form > p {
  color: var(--muted);
  margin-top: 16px;
  font-size: 15px;
}
.auth-form > p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

/* ---------- Auth pages (login / register) ---------- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 48px 4px 64px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px var(--shadow);
  padding: 36px 32px;
  text-align: center;
}
.auth-logo {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}
.auth-card h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.auth-sub { color: var(--muted); font-size: 14px; margin-top: 8px; }
.auth-card .form-panel {
  text-align: start;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.auth-card .msg { margin-top: 20px; text-align: start; }
.auth-alt { color: var(--muted); margin-top: 20px; font-size: 14px; }
.auth-alt a { color: var(--accent); font-weight: 600; }

.input-wrap { position: relative; display: flex; }
.input-wrap input { padding-inline-end: 42px !important; }
.input-toggle {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  border-radius: var(--radius);
  color: var(--muted);
}
.input-toggle:hover { color: var(--accent); }

.btn-block { display: flex; width: 100%; margin-top: 6px; }

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px var(--shadow);
}
.form-panel label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.form-panel input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}
.form-panel input[type="text"],
.form-panel input[type="email"],
.form-panel input[type="password"],
.form-panel input[type="search"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color .15s;
}
.form-panel input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn.danger {
  background: transparent;
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 50%, transparent);
}
.btn.danger:hover {
  background: color-mix(in srgb, var(--down) 10%, transparent);
  color: var(--down);
  border-color: var(--down);
}
.auth-form .btn { align-self: flex-start; margin-top: 4px; }
.auth-form .msg { margin-bottom: 8px; }
.auth-form .form-panel + form { margin-top: 8px; }
.auth-logout-form { margin-top: 4px; }
