/* ============================================================
   "Calm Signal" — Design System
   srvrlss.dev
   ============================================================ */

/* ============================================================
   Design Tokens
   ============================================================ */

:root {
  /* Color Palette — Light Mode */
  --color-bg:        #F7F5F0;
  --color-surface:   #EFECE5;
  --color-ink:       #1A1A18;
  --color-muted:     #6B6860;
  --color-accent:    #2D6A4F;
  --color-accent-2:  #E76F51;
  --color-border:    #DDD9D0;
  --color-code-bg:   #1E1E1C;

  /* RGB triplets for rgba() usage */
  --color-surface-rgb: 239, 236, 229;
  --color-border-rgb:  221, 217, 208;
  --color-ink-rgb:     26, 26, 24;

  /* Typography */
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono:    'JetBrains Mono', 'Courier New', Courier, monospace;

  /* Layout */
  --max-width-post: 680px;
  --max-width-list: 860px;

  /* Transitions */
  --transition-color: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:        #0D1117;
    --color-surface:   #161B22;
    --color-ink:       #C9D1D9;
    --color-muted:     #8B949E;
    --color-accent:    #4D9375;
    --color-accent-2:  #E76F51;
    --color-border:    #30363D;
    --color-code-bg:   #0D1117;

    --color-surface-rgb: 22, 27, 34;
    --color-border-rgb:  48, 54, 61;
    --color-ink-rgb:     201, 209, 217;
  }
}

/* ============================================================
   Reset & Base
   ============================================================ */

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-color);
}

/* ============================================================
   Skip Link (Accessibility)
   ============================================================ */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--color-accent);
  color: #fff;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s ease;
}

.header-inner {
  max-width: var(--max-width-list);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;        /* Instrument Serif is display-weight at 400 */
  letter-spacing: -0.025em;
  color: var(--color-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.wordmark:hover {
  color: var(--color-accent);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--color-accent);
}

/* ============================================================
   Main Content
   ============================================================ */

#main-content {
  flex: 1;
  padding: 3rem 1.5rem;
}

/* ============================================================
   Homepage
   ============================================================ */

.home {
  max-width: var(--max-width-list);
  margin: 0 auto;
}

.anchor-statement {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--color-muted);
  margin-bottom: 3rem;
  line-height: 1.45;
  letter-spacing: -0.015em;
}

/* ============================================================
   Post List
   ============================================================ */

.post-list {
  max-width: var(--max-width-list);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.post-card:first-child {
  padding-top: 0;
}

.post-card:last-child {
  border-bottom: none;
}

.post-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.post-card h2 a {
  color: var(--color-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-card h2 a:hover {
  color: var(--color-accent);
}

.post-card time {
  font-size: 0.82rem;
  color: var(--color-muted);
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-body);
}

.post-card p {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-top: 0.4rem;
  line-height: 1.6;
}

/* "Lessons Learned" visual badge */
.lessons-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: rgba(var(--color-surface-rgb), 0.8);
  border: 1px solid rgba(45, 106, 79, 0.35);
  padding: 0.15em 0.55em;
  border-radius: 3px;
  margin-right: 0.5rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ============================================================
   Single Post — Meta
   ============================================================ */

.post {
  max-width: var(--max-width-post);
  margin: 0 auto;
}

.post-meta {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.post-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 0.85rem;
  color: var(--color-ink);
}

.post-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.post-info time {
  font-size: 0.82rem;
  color: var(--color-muted);
  font-family: var(--font-body);
}

.post-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-accent);
  background: rgba(var(--color-surface-rgb), 0.7);
  border: 1px solid var(--color-border);
  padding: 0.1em 0.5em;
  border-radius: 3px;
  text-decoration: none;
}

/* TLDR blockquote in post-meta */
.tldr {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  color: var(--color-muted);
  font-size: 0.95rem;
  font-style: italic;
  background: rgba(var(--color-surface-rgb), 0.5);
  border-radius: 0 4px 4px 0;
}

/* ============================================================
   Post Body — Typography
   ============================================================ */

.post-cover {
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 480px;
  object-fit: cover;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-body > * + * {
  margin-top: 1.25rem;
}

.post-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-top: 2.75rem;
  margin-bottom: 0.65rem;
  color: var(--color-ink);
  line-height: 1.3;
}

.post-body h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.post-body p {
  margin-bottom: 0;
}

.post-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

.post-body a:hover {
  color: var(--color-accent-2);
}

.post-body blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-muted);
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.post-body ul,
.post-body ol {
  padding-left: 1.6rem;
}

.post-body li {
  margin-bottom: 0.35rem;
}

/* Inline code */
.post-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-code-bg);
  color: #e6edf3;
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid rgba(var(--color-border-rgb), 0.3);
}

/* Code blocks — Glassmorphism */
.post-body pre {
  background: rgba(14, 14, 12, 0.92);
  border: 1px solid rgba(var(--color-border-rgb), 0.3);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  backdrop-filter: blur(8px) saturate(180%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  line-height: 1.65;
  color: #e6edf3;
}

/* Images */
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 1.5rem auto;
  border: 1px solid var(--color-border);
}

/* ============================================================
   Callout Shortcode — Glassmorphism
   ============================================================ */

.callout {
  position: relative;
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  border-radius: 0 8px 8px 0;
  background: rgba(var(--color-surface-rgb), 0.7);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  backdrop-filter: blur(8px) saturate(180%);
  border: 1px solid rgba(var(--color-border-rgb), 0.3);
  border-left: 3px solid var(--color-accent);
}

.callout-warning {
  border-left-color: var(--color-accent-2);
}

.callout-tip {
  border-left-color: var(--color-accent);
}

.callout-note {
  border-left-color: var(--color-muted);
}

.callout p {
  margin-bottom: 0;
}

.callout p + p {
  margin-top: 0.75rem;
}

/* ============================================================
   Video Shortcode
   ============================================================ */

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 2rem auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  max-width: 100%;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ============================================================
   Social Share
   ============================================================ */

.social-share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.share-label {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.social-share a,
.copy-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
  line-height: inherit;
}

.social-share a:hover,
.copy-link:hover {
  color: var(--color-accent-2);
}

/* ============================================================
   LinkedIn CTA
   ============================================================ */

.linkedin-cta {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: rgba(var(--color-surface-rgb), 0.5);
  font-size: 0.9rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.linkedin-cta a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  margin-top: auto;
  transition: border-color 0.2s ease;
}

.footer-inner {
  max-width: var(--max-width-list);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--color-muted);
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-nav a:hover {
  color: var(--color-accent);
}

/* ============================================================
   Mobile — 375px
   ============================================================ */

@media (max-width: 600px) {
  html {
    font-size: 17px;
  }

  .site-header {
    padding: 1rem;
  }

  #main-content {
    padding: 2rem 1rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .anchor-statement {
    font-size: 1.15rem;
    margin-bottom: 2rem;
  }

  .site-nav {
    gap: 1rem;
  }

  .site-nav a {
    font-size: 0.85rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .social-share {
    gap: 0.75rem;
  }

  .post-body pre {
    padding: 1rem;
    border-radius: 4px;
  }

  /* Prevent horizontal scroll at 375px */
  .post-body pre {
    font-size: 0.82rem;
  }
}

/* ============================================================
   Hero Image
   ============================================================ */

.hero-image {
  max-width: var(--max-width-list);
  margin: 0 auto 2rem;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.hero-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* ============================================================
   Tag Strip
   ============================================================ */

.tag-strip {
  max-width: var(--max-width-list);
  margin: 0 auto 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-chip {
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--color-accent);
  text-decoration: none;
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tag-chip:hover {
  background: rgba(45, 106, 79, 0.1);
}

/* ============================================================
   Latest Post Card Marker
   ============================================================ */

.post-card--latest {
  border-left: 3px solid var(--color-accent-2);
  padding-left: 0.75rem;
}
