/* ============================================================
   CONGRUENT.AI — "DEEP WATER" THEME
   Custom Ghost Theme CSS — v1.0.0

   This is the canonical stylesheet for the congruent-deep-water
   Ghost theme. It targets our own class names (not Casper's).
   ============================================================ */

:root {
  /* Deep Water Palette */
  --abyss: #0a1628;
  --deep: #0f2035;
  --current: #163152;
  --drift: #2a5a8a;
  --surface: #4a90b8;
  --foam: #7ec8e3;
  --salt: #c8dce8;
  --light: #e8f0f5;
  --bone: #f5f0eb;

  /* Warm counterpoints */
  --hemp: #c4a875;
  --ember: #d4845a;
  --rust: #8a5a3a;

  /* Typography */
  --font-display: 'Libre Baskerville', 'Georgia', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* Widths */
  --content-width: 720px;
  --wide-width: 1080px;

  /* Override Ghost's accent color */
  --ghost-accent-color: #7ec8e3;
}

/* ---- RESET & BASE ---- */

body {
  background-color: var(--abyss);
  color: var(--salt);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.72;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle depth — like looking through dark water */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(78, 144, 184, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(196, 168, 117, 0.03) 0%, transparent 60%);
}

/* Kill any Ghost/Casper elements that might bleed through */
.gh-head,
.gh-foot,
.gh-viewport > .gh-head,
.gh-viewport > footer {
  display: none !important;
}

/* ---- NAVIGATION ---- */

.site-nav {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--light);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.site-logo .mark {
  color: var(--hemp);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--drift);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.nav-current {
  color: var(--foam);
}

/* ---- HERO (Homepage) ---- */

.hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg) var(--space-xl);
  position: relative;
  z-index: 1;
}

.hero-kicker {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hemp);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 400;
  color: var(--light);
  line-height: 1.25;
  margin-bottom: var(--space-lg);
}

.hero h1 em {
  font-style: italic;
  color: var(--foam);
}

.hero-body {
  font-size: 1.125rem;
  color: var(--salt);
  line-height: 1.8;
  max-width: 580px;
}

.hero-body + .hero-body {
  margin-top: var(--space-md);
}

.sep {
  width: 60px;
  height: 1px;
  background: var(--current);
  margin: var(--space-xl) 0;
}

/* ---- POST FEED ---- */

.feed-header {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.feed-header h2 {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--drift);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.post-feed {
  max-width: var(--content-width);
  margin: var(--space-lg) auto 0;
  padding: 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid rgba(22, 49, 82, 0.6);
  text-decoration: none;
  display: block;
  transition: transform 0.2s ease;
}

.post-card:first-child {
  border-top: 1px solid rgba(22, 49, 82, 0.6);
}

.post-card:hover {
  transform: translateX(4px);
}

.post-card-meta {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--drift);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-xs);
}

.post-card-tag {
  color: var(--hemp);
  font-weight: 600;
}

.post-card h3 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 400;
  color: var(--light);
  line-height: 1.35;
  margin-bottom: var(--space-sm);
  transition: color 0.3s ease;
}

.post-card:hover h3 {
  color: var(--foam);
}

.post-card-excerpt {
  font-size: 0.9375rem;
  color: var(--drift);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- PAGINATION ---- */

.pagination {
  max-width: var(--content-width);
  margin: var(--space-lg) auto;
  padding: var(--space-lg) var(--space-lg) 0;
}

.pagination a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--drift);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
}

.pagination a:hover {
  color: var(--foam);
}

/* ---- ARTICLE PAGE ---- */

.article-header {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  position: relative;
  z-index: 1;
}

.article-tag {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hemp);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 400;
  color: var(--light);
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.article-meta {
  font-size: 0.875rem;
  color: var(--drift);
}

.article-meta time {
  color: var(--drift);
}

/* ---- ARTICLE BODY ---- */

.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-2xl);
  position: relative;
  z-index: 1;
}

.article-body p {
  margin-bottom: var(--space-md);
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--light);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  line-height: 1.3;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--light);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.article-body a {
  color: var(--foam);
  text-decoration: none;
  border-bottom: 1px solid rgba(126, 200, 227, 0.25);
  transition: border-color 0.2s ease;
}

.article-body a:hover {
  border-color: var(--foam);
}

.article-body strong {
  font-weight: 600;
  color: var(--light);
}

.article-body em {
  color: var(--bone);
}

.article-body blockquote {
  border-left: 2px solid var(--hemp);
  padding-left: var(--space-lg);
  margin: var(--space-lg) 0;
  color: var(--bone);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* Lists */
.article-body ul,
.article-body ol {
  padding-left: 1.5em;
  margin-bottom: var(--space-md);
}

.article-body li {
  margin-bottom: var(--space-xs);
}

/* Code blocks */
.article-body pre {
  background: rgba(10, 22, 40, 0.7);
  border: 1px solid var(--current);
  border-radius: 4px;
  padding: var(--space-lg);
  overflow-x: auto;
  margin: var(--space-lg) 0;
  font-family: var(--font-code);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--salt);
}

.article-body code {
  font-family: var(--font-code);
  font-size: 0.875em;
  background: rgba(22, 49, 82, 0.4);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--foam);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Images in articles */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: var(--space-lg) 0;
}

/* HR */
.article-body hr {
  border: none;
  height: 1px;
  background: var(--current);
  margin: var(--space-xl) 0;
}

/* Tables */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.9375rem;
}

.article-body th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--current);
  color: var(--light);
  font-weight: 600;
}

.article-body td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid rgba(22, 49, 82, 0.4);
}

/* ---- GRAPH BADGE ---- */

.graph-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--current);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--drift);
  text-decoration: none;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.graph-badge:hover {
  border-color: var(--surface);
  color: var(--foam);
}

.graph-badge svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* ---- FOOTER ---- */

.site-footer {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(22, 49, 82, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}

.footer-left {
  font-size: 0.8125rem;
  color: var(--drift);
  line-height: 1.7;
}

.footer-left .company-name {
  font-family: var(--font-display);
  color: var(--salt);
  font-size: 0.875rem;
}

.pbc-badge {
  font-size: 0.75rem;
  color: var(--hemp);
  letter-spacing: 0.06em;
}

.footer-right {
  display: flex;
  gap: var(--space-lg);
}

.footer-right a {
  font-size: 0.8125rem;
  color: var(--drift);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-right a:hover {
  color: var(--foam);
}

/* ---- GHOST PORTAL OVERRIDES ---- */

/* Style the floating subscribe button if Ghost Portal is enabled */
.gh-portal-triggerbtn-iframe {
  /* Hide or restyle — uncomment to hide completely: */
  /* display: none !important; */
}

/* ---- RESPONSIVE ---- */

@media (max-width: 640px) {
  .site-nav {
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start;
  }

  .nav-links {
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .hero {
    padding-top: var(--space-xl);
  }

  .site-footer {
    flex-direction: column;
    gap: var(--space-lg);
    align-items: flex-start;
  }
}
