/* ==========================================
   Allegory of the Trade — Shared Styles
   ========================================== */

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

:root {
  --text: #1a1a1a;
  --text-light: #6b6b6b;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --border: #e8e8e8;
  --accent: #2c2c2c;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --max-width: 1120px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================
   NAVIGATION
   ========================================== */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-logo {
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.nav-badge {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--accent);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }

/* Mobile hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: 0.2s;
}

/* ==========================================
   HERO
   ========================================== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem 2.5rem;
}
.hero h1 {
  font-family: 'Lora', serif;
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.hero p {
  font-size: 1.05rem;
  color: var(--text-light);
  max-width: 560px;
}

/* ==========================================
   MAIN GRID (posts + sidebar)
   ========================================== */
.main-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: start;
}

/* ==========================================
   POSTS (left column)
   ========================================== */
.posts { min-width: 0; }
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}
.post-card {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.2s;
}
.post-card:first-of-type { border-top: 1px solid var(--border); }
.post-card:hover { opacity: 0.75; }
.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.post-tag,
.full-post-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  background: var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}
.full-post-tag {
  margin-bottom: 0.75rem;
}
.post-date {
  font-size: 0.8rem;
  color: var(--text-light);
}
.post-card h2 {
  font-family: 'Lora', serif;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}
.post-card p {
  font-size: 0.92rem;
  color: var(--text-light);
  line-height: 1.6;
}
.read-more {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  padding-bottom: 1px;
  transition: opacity 0.2s;
}
.read-more:hover { opacity: 0.6; }

/* No posts message */
.no-posts-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}
.no-posts-msg a { color: var(--accent); }

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}
.sidebar-card h3 {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Portfolio widget */
.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}
.portfolio-header h3 { margin-bottom: 0; }
.portfolio-total {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
}
.holding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.holding:last-child { border-bottom: none; }
.holding-left { display: flex; flex-direction: column; }
.holding-ticker {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.holding-name {
  font-size: 0.72rem;
  color: var(--text-light);
}
.holding-right { text-align: right; }
.holding-value {
  font-size: 0.85rem;
  font-weight: 500;
}
.holding-change {
  font-size: 0.72rem;
  font-weight: 500;
}
.up { color: var(--green); }
.down { color: var(--red); }

/* Watchlist */
.watch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.watch-item:last-child { border-bottom: none; }
.watch-ticker {
  font-size: 0.85rem;
  font-weight: 600;
}
.watch-price {
  font-size: 0.82rem;
  color: var(--text-light);
}
.watch-change {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Market Pulse */
.pulse-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.pulse-item:last-child { border-bottom: none; }
.pulse-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.15rem;
}
.pulse-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.pulse-value {
  font-size: 0.9rem;
  font-weight: 600;
}
.pulse-change {
  font-size: 0.78rem;
  font-weight: 500;
}

/* Loading states */
.loading-placeholder {
  font-size: 0.82rem;
  color: var(--text-light);
  padding: 0.75rem 0;
  text-align: center;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.last-updated {
  font-size: 0.65rem;
  color: #aaa;
  text-align: right;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f0f0f0;
}

/* ==========================================
   FULL POST OVERLAY
   ========================================== */
.full-post-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
}
.full-post-overlay.open { display: block; }
.full-post-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}
.full-post-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-light);
  text-decoration: none;
  margin-bottom: 2rem;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: color 0.2s;
}
.full-post-back:hover { color: var(--text); }
.full-post-title {
  font-family: 'Lora', serif;
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}
.full-post-date {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}
.full-post-body {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #333;
}
.full-post-body p { margin-bottom: 1.15rem; }
.full-post-body h2,
.full-post-body h3 {
  font-family: 'Lora', serif;
  margin: 1.75rem 0 0.75rem;
}
.full-post-body h2 { font-size: 1.4rem; }
.full-post-body h3 { font-size: 1.15rem; }
.full-post-body strong { font-weight: 600; }
.full-post-body em { font-style: italic; }
.full-post-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.25rem;
  margin: 1.25rem 0;
  color: var(--text-light);
  font-style: italic;
}
.full-post-body ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.full-post-body li { margin-bottom: 0.3rem; }
.full-post-body hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ==========================================
   ABOUT SECTION
   ========================================== */
.about {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}
.about-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2.5rem;
}
.about-card h3 {
  font-family: 'Lora', serif;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}
.about-card p {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* ==========================================
   NEWSLETTER
   ========================================== */
.newsletter {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 5rem;
}
.newsletter-box {
  text-align: center;
  padding: 3rem 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
}
.newsletter-box h3 {
  font-family: 'Lora', serif;
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}
.newsletter-box p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}
.beehiiv-form-wrapper {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
}
footer p {
  font-size: 0.8rem;
  color: var(--text-light);
}
.footer-links { margin-top: 0.5rem; }
.footer-links a {
  font-size: 0.8rem;
  color: var(--text-light);
  text-decoration: none;
  margin: 0 0.75rem;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); }

/* ==========================================
   SCOREBOARD
   ========================================== */
.scoreboard-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}
.scoreboard-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.scoreboard-meta-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.scoreboard-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
}
.scoreboard-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.scoreboard-methodology {
  font-size: 0.72rem;
  color: var(--text-light);
}
.scoreboard-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
}
.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.scoreboard-table thead {
  background: #f5f5f5;
  border-bottom: 2px solid var(--border);
}
.scoreboard-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  white-space: nowrap;
}
.scoreboard-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.scoreboard-table tbody tr:last-child td {
  border-bottom: none;
}
.scoreboard-table tbody tr:hover {
  background: #fafafa;
}
.col-rank {
  width: 3rem;
  text-align: center !important;
  font-weight: 600;
  color: var(--text-light);
}
.col-company {
  min-width: 180px;
}
.col-ticker strong {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.col-mcap, .col-score, .col-months {
  text-align: right !important;
}
.col-return {
  text-align: right !important;
  font-weight: 600;
}
.col-added {
  color: var(--text-light);
}
.scoreboard-footer-note {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.scoreboard-footer-note p {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.6;
}
.scoreboard-footer-note .scoreboard-cta {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.scoreboard-footer-note a {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.scoreboard-footer-note a:hover {
  opacity: 0.7;
}

/* ==========================================
   SCOREBOARD BREAKDOWN DROPDOWN
   ========================================== */
.scoreboard-row:hover {
  background: #f5f5f5;
}
.scoreboard-row.expanded {
  background: #f0f0f0;
}
.expand-hint {
  font-size: 0.65rem;
  color: var(--text-light);
  margin-left: 0.35rem;
  transition: transform 0.2s;
  display: inline-block;
}
.scoreboard-row.expanded .expand-hint {
  transform: rotate(180deg);
}
.breakdown-row {
  display: none;
}
.breakdown-row.open {
  display: table-row;
}
.breakdown-row td {
  padding: 0 !important;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}
.breakdown-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
}
.breakdown-item {
  min-width: 0;
}
.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
}
.breakdown-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
}
.breakdown-score {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-light);
}
.breakdown-bar-track {
  width: 100%;
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}
.breakdown-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.breakdown-note {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.45;
}

/* ==========================================
   RESPONSIVE — TABLET
   ========================================== */
@media (max-width: 860px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .sidebar-card {
    flex: 1;
    min-width: 250px;
  }
}

/* ==========================================
   RESPONSIVE — MOBILE
   ========================================== */
@media (max-width: 640px) {
  .menu-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 1rem;
  }
  .nav-links.open { display: flex; }
  .hero { padding: 2.5rem 1.25rem 1.5rem; }
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 0.95rem; }
  .main-grid { padding: 1rem 1.25rem 3rem; }
  .sidebar { flex-direction: column; }
  .sidebar-card { min-width: unset; }

  /* Newsletter mobile */
  .newsletter { padding: 0 1.25rem 3rem; }
  .newsletter-box { padding: 2rem 1.25rem; }
  .newsletter-box h3 { font-size: 1.15rem; }
  .newsletter-box p { font-size: 0.85rem; margin-bottom: 1rem; }
  .beehiiv-form-wrapper { max-width: 100%; }
  .beehiiv-form-wrapper iframe { width: 100% !important; max-width: 100% !important; }

  /* About mobile */
  .about { padding: 0 1.25rem 3rem; }
  .about-card { padding: 1.75rem 1.25rem; }

  /* Scoreboard mobile */
  .breakdown-panel { grid-template-columns: 1fr; gap: 1rem; padding: 1rem 1.25rem; }
  .scoreboard-section { padding: 0 1.25rem 3rem; }
  .scoreboard-meta { flex-direction: column; gap: 0.25rem; }
  .scoreboard-methodology { font-size: 0.68rem; }
  .scoreboard-table { font-size: 0.78rem; }
  .scoreboard-table th { padding: 0.6rem 0.5rem; font-size: 0.65rem; }
  .scoreboard-table td { padding: 0.7rem 0.5rem; }
  .col-company { min-width: 130px; }
  .scoreboard-footer-note { padding: 1rem; }
  .scoreboard-footer-note p { font-size: 0.72rem; }
  .scoreboard-footer-note .scoreboard-cta { font-size: 0.78rem; }

  /* Footer mobile */
  footer { padding: 1.5rem 1.25rem; }
}
