/*
 * Public site styling. Same palette as the local console (app/src/app/globals.css),
 * which takes its colours from this project's VS Code theme in .vscode/settings.json:
 * Monokai customised to dark plum.
 *
 *   #1a0f1a  editor.background                      canvas
 *   #1e0f13  sideBar.background                     canvas gradient end
 *   #241424  editorGutter / suggestWidget           raised surfaces
 *   #651353  titleBar / activityBar / tab.active    chrome and borders
 *   #d72171  editor.selectionBackground             accent
 *   #00ff88  gutter.added                           buy
 *   #ffaa00  gutter.modified                        hold
 *   #ff4444  gutter.deleted                         sell
 *   #f8f8f2  Monokai foreground                     text
 *
 * Dark only, because that theme has no light variant to mirror.
 */

:root {
  color-scheme: dark;

  --bg: #1a0f1a;
  --bg-2: #1e0f13;
  --surface: #241424;
  --surface-2: #1f1120;
  --well: #150c16;
  --chrome: #651353;

  --text: #f8f8f2;
  --text-soft: #cbbcc7;
  --text-muted: #9b8794;

  --border: rgba(101, 19, 83, 0.75);
  --border-strong: rgba(215, 33, 113, 0.55);

  --accent: #d72171;
  --accent-2: #ef4a8f;
  --accent-soft: rgba(215, 33, 113, 0.16);

  --buy: #00ff88;
  --hold: #ffaa00;
  --sell: #ff4444;

  --lip: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --ring: 0 0 0 1px var(--border);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.55), 0 18px 40px -10px rgba(0, 0, 0, 0.7);
  --well-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(101, 19, 83, 0.5);

  --radius: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html {
  /* Fixed, so the wash does not slide against the grain while scrolling. */
  background:
    radial-gradient(1100px 520px at 50% -220px, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 4rem;
}

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 2rem;
  background: color-mix(in srgb, var(--chrome) 74%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: var(--lip), 0 8px 24px -14px rgba(0, 0, 0, 0.85);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand strong {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
}

.brand span {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

/* Two destinations, marked the way the console marks its own tabs. Pushed right
   by the auto margin, so the brand and the nav sit at opposite ends. */
.site-nav {
  display: flex;
  gap: 1.3rem;
  margin-left: auto;
}

.site-nav a {
  position: relative;
  padding: 0.3rem 0.1rem 0.4rem;
  font-size: 0.9rem;
  font-weight: 550;
  color: rgba(255, 255, 255, 0.6);
}

.site-nav a:hover {
  color: #fff;
  text-decoration: none;
}

.site-nav a[aria-current='page'] {
  color: #fff;
}

.site-nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-2);
}

/* ---------- list ---------- */

.lede {
  margin: 0 0 1.75rem;
  max-width: 46rem;
  color: var(--text-soft);
}

.stack {
  display: grid;
  gap: 1rem;
}

/* One analysis in the list. The whole card is the link target. */
.card {
  display: block;
  padding: 1.1rem 1.25rem;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--lip), var(--ring), var(--shadow-md);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--lip), 0 0 0 1px var(--border-strong), var(--shadow-lg);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.ticker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #fff;
}

.card-date {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.excerpt {
  margin: 0;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- badges ---------- */

.badge {
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 999px;
  box-shadow: var(--ring);
  color: var(--text-muted);
  background: var(--well);
  white-space: nowrap;
}

.badge-buy {
  color: var(--buy);
  background: color-mix(in srgb, var(--buy) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--buy) 35%, transparent);
}

.badge-hold {
  color: var(--hold);
  background: color-mix(in srgb, var(--hold) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hold) 35%, transparent);
}

.badge-sell {
  color: var(--sell);
  background: color-mix(in srgb, var(--sell) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sell) 35%, transparent);
}

/*
 * Fear/FOMO scores. The number is the point of the badge, so it keeps its digits
 * rather than being upper-cased away, and the band word beside it is spaced off
 * the score.
 *
 * Coloured from both ends of the scale rather than along one ramp: fear and FOMO
 * are opposite readings and neither is good news, so a single good-to-bad ramp
 * would make one of them look like the safe end. The middle stays unpainted,
 * which is the honest look for "no strong pull either way".
 */
.badge-score {
  text-transform: none;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.badge-score-hot {
  color: var(--sell);
  background: color-mix(in srgb, var(--sell) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sell) 35%, transparent);
}

.badge-score-cold {
  color: var(--buy);
  background: color-mix(in srgb, var(--buy) 12%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--buy) 35%, transparent);
}

/* Risk shares the accent so it reads as a setting, not a verdict. */
.badge-risk {
  color: var(--accent-2);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- detail ---------- */

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.35rem;
}

.detail-head .ticker {
  font-size: 1.9rem;
}

.meta {
  margin: 0 0 1.75rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.tldr {
  margin: 0 0 1.75rem;
  padding: 1rem 1.2rem;
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--lip), var(--ring), var(--shadow-md);
}

.section {
  margin: 0 0 1.6rem;
}

.section h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.points {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
}

.points li {
  color: var(--text-soft);
}

.points li::marker {
  color: var(--accent);
}

/* Sections that read as warnings rather than findings. */
.points-warn li::marker {
  color: var(--hold);
}

/* Model ignored the format — shown verbatim rather than mangled. */
.verbatim {
  margin: 0;
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-soft);
  background: var(--well);
  border-radius: var(--radius);
  box-shadow: var(--well-shadow);
  overflow-x: auto;
}

code {
  padding: 0.05rem 0.3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  color: var(--text);
  background: var(--well);
  border-radius: 5px;
}

/* ---------- pager ---------- */

.pager {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
}

.pager a,
.pager span {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  border-radius: var(--radius);
}

.pager a {
  color: var(--text);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--lip), var(--ring), var(--shadow-md);
}

.pager a:hover {
  text-decoration: none;
  box-shadow: var(--lip), 0 0 0 1px var(--border-strong), var(--shadow-lg);
}

.pager .page-of {
  margin-left: auto;
  color: var(--text-muted);
  background: none;
  box-shadow: none;
}

.back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

/* ---------- states ---------- */

.empty,
.banner {
  padding: 1.5rem;
  color: var(--text-muted);
  background: var(--well);
  border-radius: var(--radius-lg);
  box-shadow: var(--well-shadow);
}

.banner {
  color: var(--text-soft);
  border-left: 3px solid var(--sell);
}

.disclaimer {
  margin-top: 2.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-foot {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

/* ---------- blog ---------- */

.page-title {
  margin: 0 0 1.25rem;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.post-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  color: #fff;
}

/* Category filter row. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  background: var(--well);
  border-radius: 999px;
  box-shadow: var(--ring);
}

.chip:hover {
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.chip-on {
  color: #fff;
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.chip-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chip-on .chip-count {
  color: rgba(255, 255, 255, 0.7);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

/* ---------- post body ---------- */

/*
 * Everything under .prose is rendered from markdown by parts/markdown.php, which
 * emits only the tags styled here — an agent cannot introduce others.
 */
.prose {
  max-width: 44rem;
}

.prose h2,
.prose h3,
.prose h4 {
  margin: 2rem 0 0.6rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.prose h2 {
  font-size: 1.32rem;
}

.prose h3 {
  font-size: 1.12rem;
}

.prose h4 {
  font-size: 1rem;
  color: var(--text-soft);
}

.prose p {
  margin: 0 0 1.05rem;
  color: var(--text-soft);
}

.prose .prose-list {
  margin: 0 0 1.05rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.4rem;
}

.prose .prose-list li {
  color: var(--text-soft);
}

.prose .prose-list li::marker {
  color: var(--accent);
}

.prose blockquote {
  margin: 0 0 1.05rem;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
}

.prose blockquote p {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.prose hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose .code {
  margin: 0 0 1.05rem;
  padding: 0.9rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-soft);
  background: var(--well);
  border-radius: var(--radius);
  box-shadow: var(--well-shadow);
  overflow-x: auto;
}

.prose .code code {
  padding: 0;
  background: none;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
