/* ===== LEGALISH GHOST THEME ===== */

:root {
  --bg: #111113;
  --bg-card: #1a1a1f;
  --bg-card-hover: #222228;
  --bg-elevated: #252530;
  --text: #e8e6e3;
  --text-secondary: #9a9a9f;
  --text-muted: #6a6a70;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --accent-glow: rgba(255, 107, 53, 0.15);
  --link: #64b5f6;
  --link-hover: #90caf9;
  --tag-bg: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.1);
  --green: #66bb6a;
  --yellow: #ffd54f;
  --purple: #b39ddb;
  --pink: #f48fb1;
  --cyan: #4dd0e1;
  --header-bg: rgba(17, 17, 19, 0.92);
}

[data-theme="light"] {
  --bg: #f5f3ef;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf8;
  --bg-elevated: #f0eeea;
  --text: #1a1a1f;
  --text-secondary: #4a4a52;
  --text-muted: #8a8a92;
  --accent: #e05a25;
  --accent-hover: #c84d1e;
  --accent-glow: rgba(224, 90, 37, 0.1);
  --link: #2a6a9a;
  --link-hover: #1a4a7a;
  --tag-bg: rgba(0,0,0,0.04);
  --border: rgba(0,0,0,0.07);
  --border-strong: rgba(0,0,0,0.12);
  --green: #2e7d32;
  --yellow: #f9a825;
  --purple: #7b1fa2;
  --pink: #c2185b;
  --cyan: #00838f;
  --header-bg: rgba(245, 243, 239, 0.92);
}

/* Light mode tag overrides */
[data-theme="light"] .tag-scotus { color: #7b6a00; border-color: rgba(123,106,0,0.25); background: rgba(249,168,37,0.1); }
[data-theme="light"] .tag-ip { color: #00695c; border-color: rgba(0,105,92,0.25); background: rgba(0,131,143,0.1); }
[data-theme="light"] .tag-first-amendment, [data-theme="light"] .tag-1a { color: #6a1b9a; border-color: rgba(106,27,154,0.25); background: rgba(123,31,162,0.1); }
[data-theme="light"] .tag-criminal { color: #ad1457; border-color: rgba(173,20,87,0.25); background: rgba(194,24,91,0.1); }
[data-theme="light"] .tag-tech, [data-theme="light"] .tag-tech-law { color: #2e7d32; border-color: rgba(46,125,50,0.25); background: rgba(46,125,50,0.1); }
[data-theme="light"] .tag-politics { color: #bf360c; border-color: rgba(191,54,12,0.25); background: rgba(224,90,37,0.1); }
[data-theme="light"] .ad-lynch { background: linear-gradient(135deg, #ffffff 0%, #faf8f4 100%); border-color: var(--border-strong); }
[data-theme="light"] .newsletter-card { background: linear-gradient(135deg, rgba(224,90,37,0.06), rgba(224,90,37,0.02)); }
[data-theme="light"] .post:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

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

::selection { background: var(--accent); color: white; }

body, .site-header, .post, .sidebar-card, .ad-lynch, .ad-google, .ad-inline, .cta-bar, .site-footer {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
  margin-right: 0.5rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.logo span { font-style: italic; font-weight: 400; color: var(--text-secondary); }

nav { display: flex; align-items: center; gap: 0.3rem; }

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  transition: all 0.15s;
}

nav a:hover { color: var(--text); background: var(--tag-bg); }
nav a.active { color: var(--accent); background: var(--accent-glow); }

.nav-divider { width: 1px; height: 20px; background: var(--border-strong); margin: 0 0.3rem; }

.theme-toggle {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  margin-left: 0.2rem;
}

.theme-toggle:hover { background: var(--border-strong); transform: scale(1.08); }

/* ===== HERO ===== */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 1.8rem;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.hero-tagline {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.hero-byline { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.3rem 0.65rem;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.hero-chip strong { color: var(--text-secondary); font-weight: 600; }
.hero-chip .dot { color: var(--accent); }

/* ===== CTA BAR ===== */
.cta-bar {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  background: var(--bg-card);
}

.cta-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.cta-item { display: flex; align-items: center; gap: 0.6rem; }

.cta-item-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.cta-lynch { background: var(--accent); color: white; }
.cta-lynch:hover { background: var(--accent-hover); transform: translateY(-1px); }

.cta-newsletter { display: flex; gap: 0.35rem; }

.cta-newsletter input {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
  width: 180px;
  transition: border-color 0.15s;
}

.cta-newsletter input::placeholder { color: var(--text-muted); }
.cta-newsletter input:focus { border-color: var(--accent); }

.cta-newsletter button {
  padding: 0.45rem 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.cta-newsletter button:hover { background: var(--accent-hover); }

/* ===== MAIN LAYOUT ===== */
.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* ===== FEED ===== */
.feed { display: flex; flex-direction: column; gap: 2px; }

.date-group { display: flex; align-items: center; gap: 0.75rem; padding: 1.2rem 0 0.6rem; }
.date-group:first-child { padding-top: 0; }
.date-label { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.date-line { flex: 1; height: 1px; background: var(--border); }

/* ===== POST CARD ===== */
.post {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.3rem;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.post:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

.post-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid;
}

/* Tag colors */
.tag-scotus { color: var(--yellow); border-color: rgba(255,213,79,0.25); background: rgba(255,213,79,0.08); }
.tag-ip { color: var(--cyan); border-color: rgba(77,208,225,0.25); background: rgba(77,208,225,0.08); }
.tag-first-amendment, .tag-1a { color: var(--purple); border-color: rgba(179,157,219,0.25); background: rgba(179,157,219,0.08); }
.tag-criminal { color: var(--pink); border-color: rgba(244,143,177,0.25); background: rgba(244,143,177,0.08); }
.tag-tech, .tag-tech-law { color: var(--green); border-color: rgba(102,187,106,0.25); background: rgba(102,187,106,0.08); }
.tag-politics { color: var(--accent); border-color: rgba(255,107,53,0.25); background: rgba(255,107,53,0.08); }

.post-source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.post-source::before { content: '↗'; color: var(--link); font-size: 0.7rem; }

.post-time { font-size: 0.68rem; color: var(--text-muted); margin-left: auto; }

.post h2 {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.post h2 a { color: var(--text); text-decoration: none; transition: color 0.12s; }
.post h2 a:hover { color: var(--link); }

.post-body { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.65; }

.post-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.post-action {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.12s;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.post-action:hover { color: var(--text-secondary); }

.post-action svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }

.post-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: all 0.12s;
}
.post-read-more:hover { color: var(--accent-hover); gap: 0.5rem; }

/* ===== FULL POST ===== */
.post-full { max-width: 720px; }

.post-full-header { margin-bottom: 2rem; }

.post-full-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.post-full-source {
  color: var(--link);
  text-decoration: none;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
}
.post-full-source:hover { color: var(--link-hover); }

.post-full-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.post-full-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.post-full-content h2 {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.4rem;
  margin: 2rem 0 0.8rem;
  color: var(--text);
}

.post-full-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.6rem;
  color: var(--text);
}

.post-full-content p { margin-bottom: 1.2rem; }

.post-full-content a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.post-full-content a:hover { color: var(--link-hover); }

.post-full-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.2rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-muted);
}

.post-full-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.post-full-content code {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--tag-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-full-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.share-label { font-size: 0.8rem; color: var(--text-muted); margin-right: 0.5rem; }

.share-link {
  font-size: 0.8rem;
  color: var(--link);
  text-decoration: none;
  margin-right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.share-link:hover { color: var(--link-hover); }

/* ===== IN-FEED AD ===== */
.ad-inline {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.ad-inline-label { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.5; margin-bottom: 0.3rem; }

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 72px;
  align-self: start;
}

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
}

.sidebar-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

/* Lynch LLP Ad */
.ad-lynch {
  background: linear-gradient(135deg, #1a1a1f 0%, #1f1f28 100%);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 1.3rem;
  position: relative;
  overflow: hidden;
}

.ad-lynch::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--yellow)); }
.ad-lynch-label { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); opacity: 0.6; margin-bottom: 0.8rem; }

.ad-lynch-name {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.ad-lynch p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.9rem; }

.ad-lynch-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s;
}
.ad-lynch-cta:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* Newsletter */
.newsletter-card {
  background: linear-gradient(135deg, rgba(255,107,53,0.08), rgba(255,107,53,0.02));
  border-color: rgba(255,107,53,0.15);
}
.newsletter-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.8rem; }

.newsletter-form { display: flex; gap: 0.4rem; }

.newsletter-form input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}
.newsletter-form input::placeholder { color: var(--text-muted); }
.newsletter-form input:focus { border-color: var(--accent); }

.newsletter-form button {
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.newsletter-form button:hover { background: var(--accent-hover); }

/* About */
.about-card p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.55; margin-bottom: 0.6rem; }
.about-links { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.about-links a { font-size: 0.8rem; color: var(--link); text-decoration: none; display: flex; align-items: center; gap: 0.3rem; transition: color 0.12s; }
.about-links a:hover { color: var(--link-hover); }
.about-links a::before { content: '→'; color: var(--text-muted); font-size: 0.7rem; }

/* Google Ad */
.ad-google {
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.3rem;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.5rem 0;
}

.pagination-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  transition: all 0.15s;
}
.pagination-btn:hover { background: var(--accent-glow); }

.pagination-info { font-size: 0.8rem; color: var(--text-muted); }

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  color: var(--text-muted);
}

.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer-left .footer-name { font-family: 'Libre Baskerville', serif; font-weight: 700; color: var(--text-secondary); }
.footer-left .footer-name span { font-style: italic; font-weight: 400; }
.footer-tagline { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; opacity: 0.6; }
.footer-links { display: flex; gap: 1.2rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.78rem; transition: color 0.12s; }
.footer-links a:hover { color: var(--text-secondary); }

/* ===== GHOST REQUIRED CLASSES ===== */
.kg-width-wide {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.kg-width-full {
  max-width: none;
  margin-left: calc(-1 * var(--gap, 1.5rem));
  margin-right: calc(-1 * var(--gap, 1.5rem));
}

.kg-width-full img {
  width: 100%;
}

.kg-image-card,
.kg-gallery-card,
.kg-embed-card,
.kg-bookmark-card {
  margin: 1.5rem 0;
}

.kg-image-card img {
  max-width: 100%;
  border-radius: 8px;
}

.kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: var(--text);
}

.kg-bookmark-content {
  padding: 1rem;
  flex: 1;
}

.kg-bookmark-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.kg-bookmark-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kg-bookmark-thumbnail img {
  width: 200px;
  height: 100%;
  object-fit: cover;
}

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.post { animation: slideIn 0.3s ease-out both; }
.post:nth-child(2) { animation-delay: 0.03s; }
.post:nth-child(3) { animation-delay: 0.06s; }
.post:nth-child(4) { animation-delay: 0.09s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 850px) {
  .main-container { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

@media (max-width: 700px) {
  .cta-bar-inner { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .cta-item { justify-content: space-between; }
  .cta-newsletter input { flex: 1; width: auto; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 1rem; }
  .main-container { padding: 0 1rem; padding-top: 1rem; }
  .hero { padding: 1.5rem 1rem; }
  .nav-divider { display: none; }
  nav a { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
  .post { padding: 1rem; }
  .post h2 { font-size: 1.05rem; }
  .post-full-title { font-size: 1.5rem; }
}
