/**
 * EaseCloud Brand System
 * Typography, Colors, and Design Tokens
 * Based on EaseCloud Brand Guidelines v2.0
 *
 * IMPORTANT: This file loads AFTER screen.css (which uses html{font-size:62.5%}).
 * All rem values use the 10px base (1rem = 10px).
 * Standard web rem (1.125rem) would be 11.25px here — so we multiply by 1.6×.
 */

/* ============================================
   TYPOGRAPHY IMPORTS
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@700;800;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap");

/* ============================================
   DESIGN TOKENS
   All rem values are at 10px base (62.5% html font-size)
   ============================================ */

:root {
  /* ── Brand Colors ──────────────────────────── */
  --color-brand: #4285f4;
  --color-brand-hover: #5a95f5;
  --color-brand-dark: #357ae8;

  /* ── Neutral Palette ──────────────────────── */
  --color-black: #0a0a0a;
  --color-white: #ffffff;

  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  /* ── Semantic Colors ──────────────────────── */
  --color-primary: #0a0a0a; /* text / foreground */
  --color-primary-contrast: #fafafa; /* inverse */
  --color-surface: #ffffff;
  --color-surface-alt: #f5f5f5;
  --color-border: #e5e5e5;
  --color-muted: #737373;

  /* ── Functional ───────────────────────────── */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.1);

  /* ── Font Families ────────────────────────── */
  --font-display: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  /* ── Font Weights ─────────────────────────── */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;

  /* ── Type Scale (10px base = 62.5% html)
     Formula: desired_px / 10 = rem value
     ──────────────────────────────────────── */
  --text-xs: 1.2rem; /* 12px */
  --text-sm: 1.4rem; /* 14px */
  --text-base: 1.6rem; /* 16px */
  --text-md: 1.7rem; /* 17px */
  --text-lg: 1.8rem; /* 18px */
  --text-xl: 2rem; /* 20px */
  --text-2xl: 2.4rem; /* 24px */
  --text-3xl: 3rem; /* 30px */
  --text-4xl: 3.6rem; /* 36px */
  --text-5xl: 4.4rem; /* 44px */
  --text-6xl: 5.2rem; /* 52px */
  --text-7xl: 6.4rem; /* 64px */

  /* ── Line Heights ─────────────────────────── */
  --leading-none: 1;
  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-loose: 1.8;

  /* ── Letter Spacing ───────────────────────── */
  --tracking-tighter: -0.03em;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* ── Spacing (4px base unit) ──────────────── */
  --space-1: 0.4rem; /* 4px  */
  --space-2: 0.8rem; /* 8px  */
  --space-3: 1.2rem; /* 12px */
  --space-4: 1.6rem; /* 16px */
  --space-5: 2rem; /* 20px */
  --space-6: 2.4rem; /* 24px */
  --space-8: 3.2rem; /* 32px */
  --space-10: 4rem; /* 40px */
  --space-12: 4.8rem; /* 48px */
  --space-16: 6.4rem; /* 64px */
  --space-20: 8rem; /* 80px */
  --space-24: 9.6rem; /* 96px */

  /* ── Border Radius ────────────────────────── */
  --radius-sm: 0.4rem; /* 4px  – badges */
  --radius-md: 0.6rem; /* 6px  – inputs */
  --radius-lg: 0.8rem; /* 8px  – default (buttons, cards) */
  --radius-xl: 1.2rem; /* 12px – large cards */
  --radius-2xl: 1.6rem; /* 16px – featured blocks */
  --radius-full: 9999px;

  /* ── Shadows ──────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.16);

  /* ── Transitions ──────────────────────────── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease);
  --transition-base: 250ms var(--ease);
  --transition-slow: 400ms var(--ease);

  /* ── Layout ───────────────────────────────── */
  --container-max: 1400px;
  --content-max: 720px;
  --wide-max: 1200px;

  /* ── Z-Index ──────────────────────────────── */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1050;
}

/* ── Dark Mode Semantic Overrides ──────────── */
.dark-mode {
  --color-primary: #f0f0f0;
  --color-primary-contrast: #0a0a0a;
  --color-surface: #111111;
  --color-surface-alt: #1a1a1a;
  --color-border: #2a2a2a;
  /* #a3a3a3 on dark bg (#151719) = 7.55:1 contrast — passes WCAG AA */
  --color-muted: #a3a3a3;
  --color-brand-hover: #6ba3f7;
}

/* ============================================
   BASE RESETS & BODY
   ============================================ */

html,
body {
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base); /* 16px – chrome/UI default */
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Global Heading Scale ───────────────────
   Correct values for 10px-base rem system.
   These fix the broken easecloud-brand values
   that were making h2 = 22.5px (wrong).
   ────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-primary);
}

h1,
.h1 {
  font-size: var(--text-6xl); /* 52px */
  font-weight: var(--weight-black);
}

h2,
.h2 {
  font-size: var(--text-4xl); /* 36px – was broken at 22.5px */
  font-weight: var(--weight-extrabold);
}

h3,
.h3 {
  font-size: var(--text-3xl); /* 30px – was broken at 18.75px */
  font-weight: var(--weight-bold);
}

h4,
.h4 {
  font-size: var(--text-2xl); /* 24px */
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-normal);
}

h5,
.h5 {
  font-size: var(--text-xl); /* 20px */
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-normal);
}

h6,
.h6 {
  font-size: var(--text-lg); /* 18px */
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-normal);
}

/* Code */
code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
}

/* ============================================
   ARTICLE / POST CONTENT TYPOGRAPHY
   The .gh-content class wraps all post body.
   screen.css sets paragraphs to 2rem (20px).
   We build a clear hierarchy above that.
   ============================================ */

/* -- Headings inside article content -------- */
.gh-content h2 {
  font-family: var(--font-display);
  font-size: 3.2rem; /* 32px — clear above 20px body */
  font-weight: var(--weight-extrabold);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--color-primary);
  margin-top: 3em;
  margin-bottom: 0.6em;
}

.gh-content h3 {
  font-family: var(--font-display);
  font-size: 2.6rem; /* 26px */
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-primary);
  margin-top: 2.5em;
  margin-bottom: 0.5em;
}

.gh-content h4 {
  font-family: var(--font-display);
  font-size: 2.2rem; /* 22px */
  font-weight: var(--weight-bold);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  margin-top: 2em;
  margin-bottom: 0.4em;
}

.gh-content h5 {
  font-family: var(--font-display);
  font-size: 2rem; /* 20px */
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

.gh-content h6 {
  font-family: var(--font-display);
  font-size: 1.8rem; /* 18px */
  font-weight: var(--weight-semibold);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* -- Body paragraphs & lists ---------------- */
/* screen.css already sets font-size: 2rem (20px) with higher specificity.
   We fine-tune readability. */
.gh-content > p,
.gh-content > ul,
.gh-content > ol,
.gh-content > dl {
  font-family: var(--font-body);
  font-size: 1.9rem; /* 19px — slightly tighter than Casper's 20px */
  font-weight: var(--weight-regular);
  line-height: 1.78;
  color: var(--color-primary);
}

/* -- Article links -------------------------- */
.gh-content a.btn-brand,
.gh-content a.btn-brand:hover,
.gh-content a.btn-brand:visited {
  color: white;
  text-decoration: none;
}

.gh-content a {
  color: var(--color-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(66, 133, 244, 0.4);
  transition:
    color var(--transition-fast),
    text-decoration-color var(--transition-fast);
}

.gh-content a:hover {
  color: var(--color-brand-hover);
  text-decoration-color: var(--color-brand-hover);
}

/* -- Blockquote ----------------------------- */
.gh-content > blockquote:not([class]) {
  font-family: var(--font-body);
  font-size: 2rem; /* 20px */
  font-style: italic;
  font-weight: var(--weight-regular);
  line-height: 1.7;
  color: var(--color-primary);
  padding: 0 0 0 2.4rem;
  border-left: 3px solid var(--color-brand);
  opacity: 0.85;
}

/* -- Inline code ---------------------------- */
.gh-content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: 400;
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  vertical-align: baseline;
}

/* Light mode inline code */
html:not(.dark-mode) .gh-content :not(pre) > code {
  background: #f0f6ff;
  border: 1px solid #d0e4ff;
  color: #1a56db;
}

/* Dark mode inline code */
html.dark-mode .gh-content :not(pre) > code {
  background: rgba(66, 133, 244, 0.12);
  border: 1px solid rgba(66, 133, 244, 0.2);
  color: #93bbfd;
}

/* -- Code blocks ---------------------------- */
.gh-content pre {
  font-family: var(--font-mono);
  font-size: 1.4rem; /* 14px */
  line-height: 1.65;
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

/* -- Strong / bold -------------------------- */
.gh-content strong {
  font-weight: var(--weight-semibold);
}

/* -- HR ------------------------------------ */
.gh-content > hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 4rem 0;
}

/* -- First heading margin fix --------------- */
.gh-content > h2:first-child,
.gh-content > h3:first-child {
  margin-top: 0;
}

/* ============================================
   ARTICLE HEADER & META
   ============================================ */

/* Article title – override screen.css clamp */
.article-title {
  font-family: var(--font-display) !important;
  font-size: clamp(3rem, 4.5vw, 5rem) !important; /* 30–50px */
  font-weight: var(--weight-black) !important;
  line-height: 1.1 !important;
  letter-spacing: -0.03em !important;
  color: var(--color-primary) !important;
}

/* Article excerpt */
.article-excerpt {
  font-family: var(--font-body);
  font-size: 1.9rem; /* 19px */
  font-weight: var(--weight-regular);
  line-height: 1.55;
  color: var(--color-muted);
  margin-top: 1.6rem;
}

/* Author name */
.author-name {
  font-family: var(--font-body);
  font-size: 1.4rem; /* 14px */
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  color: var(--color-primary);
}

/* Byline meta (date, reading time) */
.byline-meta-date,
.byline-reading-time {
  font-family: var(--font-body);
  font-size: 1.3rem; /* 13px */
  font-weight: var(--weight-medium);
  color: var(--color-muted);
}

/* Tag labels */
.article-tag a,
.post-card-primary-tag a {
  font-family: var(--font-display);
  font-size: 1.2rem; /* 12px */
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-brand) !important;
  text-decoration: none;
}

.post-card-primary-tag {
  color: var(--color-brand);
}

/* ============================================
   POST CARD COMPONENTS
   ============================================ */

/* Post card title */
.post-card-title {
  font-family: var(--font-display);
  font-size: 2.2rem; /* 22px */
  font-weight: var(--weight-extrabold);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

/* Post card excerpt */
.post-card-excerpt {
  font-family: var(--font-body);
  font-size: 1.5rem; /* 15px */
  font-weight: var(--weight-regular);
  line-height: 1.6;
  color: var(--color-muted);
}

/* Post card meta */
.post-card-meta,
.post-card-meta-author {
  font-family: var(--font-body);
  font-size: 1.3rem; /* 13px */
  font-weight: var(--weight-medium);
  color: var(--color-muted);
}

/* Post card tag label */
.post-card-tags {
  font-family: var(--font-display);
  font-size: 1.2rem; /* 12px */
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-brand);
}

/* Large post card title */
@media (min-width: 1001px) {
  .post-card-large .post-card-title {
    font-size: 3.6rem !important; /* 36px */
    font-weight: var(--weight-black) !important;
    letter-spacing: -0.03em !important;
    line-height: 1.1 !important;
  }
}

/* ============================================
   NAVIGATION
   ============================================ */

/* Nav links */
.gh-head-menu .nav a {
  font-family: var(--font-body);
  font-size: 1.5rem; /* 15px */
  font-weight: var(--weight-medium);
  letter-spacing: 0;
}

/* Breadcrumb */
.article-breadcrumb-item {
  font-family: var(--font-body);
  font-size: 1.3rem; /* 13px */
  font-weight: var(--weight-medium);
  color: var(--color-muted);
}

.article-breadcrumb-item a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.article-breadcrumb-item a:hover {
  color: var(--color-primary);
}

html.dark-mode .article-breadcrumb-item a:hover {
  color: var(--gray-50);
}

/* ============================================
   TABLE OF CONTENTS (sidebar)
   ============================================ */

.toc-sidebar {
  font-family: var(--font-body);
}

.toc-title {
  font-family: var(--font-display);
  font-size: 1.2rem; /* 12px */
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 1.4rem;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0;
  padding: 0;
}

.toc-list li + li {
  margin-top: 0.2rem;
}

.toc-link {
  display: block;
  font-family: var(--font-body);
  font-size: 1.3rem; /* 13px */
  font-weight: var(--weight-medium);
  line-height: 1.45;
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem 0.4rem 0;
  border-left: 2px solid transparent;
  padding-left: 1.2rem;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.toc-link:hover {
  color: var(--color-primary);
  border-left-color: var(--color-brand);
}

.toc-link.active {
  color: var(--color-brand);
  border-left-color: var(--color-brand);
  font-weight: var(--weight-semibold);
}

/* Nested TOC */
.toc-list .toc-list {
  padding-left: 1.2rem;
}

.toc-list .toc-list .toc-link {
  font-size: 1.2rem; /* 12px */
  color: var(--color-muted);
  opacity: 0.85;
}

/* ============================================
   BRAND BUTTON
   ============================================ */

.btn-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.1rem 2.2rem;
  font-family: var(--font-body);
  font-size: 1.5rem; /* 15px */
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  color: white;
  background: #1a56db; /* #fff on #1a56db = 6.18:1 ✅ (var(--color-brand)=#4285f4 = 3.56:1 ❌) */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition:
    background var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast);
}

.btn-brand:hover {
  background: #1e4fc2;
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

/* Ghost footer CTA placeholder text — override Casper's #979797 (2.92:1 ❌ on white) */
.footer-cta-input {
  color: #767676; /* on #ffffff = 4.54:1 ✅ */
}

.btn-brand:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Outline variant */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 2rem;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-outline:hover {
  background: var(--color-surface-alt);
  border-color: var(--gray-400);
  text-decoration: none;
}

.dark-mode .btn-outline {
  border-color: var(--gray-700);
}

.dark-mode .btn-outline:hover {
  background: var(--gray-800);
  border-color: var(--gray-600);
}

/* Button sizes */
.btn-sm {
  padding: 0.8rem 1.4rem;
  font-size: 1.3rem;
}

.btn-lg {
  padding: 1.4rem 2.8rem;
  font-size: 1.6rem;
}

/* ============================================
   POST CARD PLACEHOLDER (no feature image)
   ============================================ */

.post-card-image-placeholder-link {
  display: block;
}

.post-card-image-placeholder-link::after {
  padding-bottom: 0;
}

.post-card-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 300px;
  background: linear-gradient(135deg, #0d1117 0%, #0f1f3d 40%, #0a1628 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.post-card-image-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      ellipse at 30% 50%,
      rgba(66, 133, 244, 0.12) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 20%,
      rgba(26, 115, 232, 0.08) 0%,
      transparent 50%
    );
}

.post-card-image-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(66, 133, 244, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(66, 133, 244, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

.post-card-placeholder-tag {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(66, 133, 244, 0.75);
  background: rgba(66, 133, 244, 0.08);
  border: 1px solid rgba(66, 133, 244, 0.2);
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
}

/* Tag-based palettes */
.post-card-image-placeholder[data-tag="cloud-tips"],
.post-card-image-placeholder[data-tag*="cloud-tip"] {
  background: linear-gradient(135deg, #110d00 0%, #1f1400 40%, #150e00 100%);
}
.post-card-image-placeholder[data-tag="cloud-tips"]::before,
.post-card-image-placeholder[data-tag*="cloud-tip"]::before {
  background:
    radial-gradient(
      ellipse at 30% 50%,
      rgba(251, 146, 60, 0.14) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 20%,
      rgba(245, 158, 11, 0.08) 0%,
      transparent 50%
    );
}
.post-card-image-placeholder[data-tag="cloud-tips"]::after,
.post-card-image-placeholder[data-tag*="cloud-tip"]::after {
  background-image:
    linear-gradient(rgba(251, 146, 60, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 146, 60, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}
.post-card-image-placeholder[data-tag="cloud-tips"] .post-card-placeholder-tag,
.post-card-image-placeholder[data-tag*="cloud-tip"] .post-card-placeholder-tag {
  color: rgba(251, 146, 60, 0.85);
  background: rgba(251, 146, 60, 0.08);
  border-color: rgba(251, 146, 60, 0.2);
}

.post-card-image-placeholder[data-tag="trenches"],
.post-card-image-placeholder[data-tag*="trench"] {
  background: linear-gradient(135deg, #0e0914 0%, #180d2a 40%, #0e0717 100%);
}
.post-card-image-placeholder[data-tag="trenches"]::before,
.post-card-image-placeholder[data-tag*="trench"]::before {
  background:
    radial-gradient(
      ellipse at 30% 50%,
      rgba(139, 92, 246, 0.14) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 20%,
      rgba(109, 40, 217, 0.08) 0%,
      transparent 50%
    );
}
.post-card-image-placeholder[data-tag="trenches"]::after,
.post-card-image-placeholder[data-tag*="trench"]::after {
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}
.post-card-image-placeholder[data-tag="trenches"] .post-card-placeholder-tag,
.post-card-image-placeholder[data-tag*="trench"] .post-card-placeholder-tag {
  color: rgba(167, 139, 250, 0.85);
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.2);
}

.post-card-image-placeholder[data-tag="cloud-digest"],
.post-card-image-placeholder[data-tag*="digest"] {
  background: linear-gradient(135deg, #001410 0%, #002a20 40%, #001a14 100%);
}
.post-card-image-placeholder[data-tag="cloud-digest"]::before,
.post-card-image-placeholder[data-tag*="digest"]::before {
  background:
    radial-gradient(
      ellipse at 30% 50%,
      rgba(16, 185, 129, 0.14) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 20%,
      rgba(5, 150, 105, 0.08) 0%,
      transparent 50%
    );
}
.post-card-image-placeholder[data-tag="cloud-digest"]::after,
.post-card-image-placeholder[data-tag*="digest"]::after {
  background-image:
    linear-gradient(rgba(16, 185, 129, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}
.post-card-image-placeholder[data-tag="cloud-digest"]
  .post-card-placeholder-tag,
.post-card-image-placeholder[data-tag*="digest"] .post-card-placeholder-tag {
  color: rgba(52, 211, 153, 0.85);
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}

.post-card-image-placeholder[data-tag="learn"],
.post-card-image-placeholder[data-tag*="glossar"] {
  background: linear-gradient(135deg, #001018 0%, #001e2e 40%, #00141e 100%);
}
.post-card-image-placeholder[data-tag="learn"]::before,
.post-card-image-placeholder[data-tag*="glossar"]::before {
  background:
    radial-gradient(
      ellipse at 30% 50%,
      rgba(6, 182, 212, 0.14) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 20%,
      rgba(8, 145, 178, 0.08) 0%,
      transparent 50%
    );
}
.post-card-image-placeholder[data-tag="learn"]::after,
.post-card-image-placeholder[data-tag*="glossar"]::after {
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}
.post-card-image-placeholder[data-tag="learn"] .post-card-placeholder-tag,
.post-card-image-placeholder[data-tag*="glossar"] .post-card-placeholder-tag {
  color: rgba(34, 211, 238, 0.85);
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
}

/* ============================================
   DARK MODE — CONTENT SPECIFIC FIXES
   ============================================ */

/* Article content in dark mode */
html.dark-mode .gh-content > p,
html.dark-mode .gh-content > ul,
html.dark-mode .gh-content > ol,
html.dark-mode .gh-content > dl {
  color: #d4d4d4;
}

html.dark-mode .gh-content h2,
html.dark-mode .gh-content h3,
html.dark-mode .gh-content h4,
html.dark-mode .gh-content h5,
html.dark-mode .gh-content h6 {
  color: #f0f0f0;
}

html.dark-mode .gh-content > blockquote:not([class]) {
  color: #c0c0c0;
}

html.dark-mode .gh-content strong {
  color: #e8e8e8;
}

/* Selection highlight in dark mode */
html.dark-mode ::selection {
  background: rgba(66, 133, 244, 0.3);
  color: #fff;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-brand {
  color: var(--color-brand);
}
.text-primary {
  color: var(--color-primary);
}
.text-muted {
  color: var(--color-muted);
}
.text-success {
  color: var(--color-success);
}
.text-warning {
  color: var(--color-warning);
}
.text-error {
  color: var(--color-error);
}

.bg-brand {
  background-color: var(--color-brand);
}
.bg-surface {
  background-color: var(--color-surface);
}

.font-medium {
  font-weight: var(--weight-medium);
}
.font-semibold {
  font-weight: var(--weight-semibold);
}
.font-bold {
  font-weight: var(--weight-bold);
}
.font-extrabold {
  font-weight: var(--weight-extrabold);
}
.font-black {
  font-weight: var(--weight-black);
}

/* Card */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.dark-mode .card {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
}

/* ============================================
   GHOST PORTAL LAUNCHER — MOVE TO BOTTOM-LEFT
   Prevents overlap with HubSpot chat widget (bottom-right).
   ============================================ */

#ghost-portal-root iframe[title="portal-trigger"] {
  right: auto !important;
  left: 0px !important;
}

/* ============================================
   POST CARD IMAGE — contain + rounded corners
   Shows full image without cropping, matching
   how the feature image looks on the post page.
   ============================================ */

.post-card-image-link {
  border-radius: 16px;
  background: #1e2d5a; /* matches the image's own background colour */
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07); /* faint ring makes rounded corners visible on dark bg */
}

/* Override Casper's 55% aspect ratio to match the 2:1 post image dimensions (960×480).
   Exclude placeholder links — they control their own height via aspect-ratio on the inner div. */
.post-card-image-link:not(.post-card-image-placeholder-link)::after {
  padding-bottom: 50%;
}

.post-card-image {
  object-fit: contain;
}

/* ============================================
   LIGHT MODE — BODY BACKGROUND
   ============================================ */

html:not(.dark-mode) body {
  background-color: #ffffff;
  color: #0a0a0a;
}

/* ============================================
   MOBILE — HEADING HIERARCHY FIX
   On mobile, screen.css reduces article H1 (article-title) to ~30px
   while gh-content h2 can reach 32px — inversion must be corrected.
   ============================================ */

@media (max-width: 640px) {
  .article-title {
    font-size: clamp(2.8rem, 7vw, 3.6rem) !important;
  }
  .gh-content h2 {
    font-size: 2.2rem !important; /* 22px — clearly below article H1 */
  }
  .gh-content h3 {
    font-size: 1.9rem !important; /* 19px */
  }
}

/* ============================================
   DARK MODE — META TEXT CONTRAST FIX
   screen.css uses color-mod() which computes to
   #5f5f5f on dark backgrounds (2.81:1 — WCAG fail).
   Override with #a3a3a3 = 7.55:1 on #151719.
   ============================================ */

html.dark-mode .post-card-primary-tag,
html.dark-mode .post-card-tags,
html.dark-mode .post-card-meta,
html.dark-mode .post-card-meta > *,
html.dark-mode .post-card-meta-date,
html.dark-mode .post-card-meta-length,
html.dark-mode .post-card-excerpt,
html.dark-mode .byline-meta-content,
html.dark-mode .byline-meta-date,
html.dark-mode .byline-reading-time,
html.dark-mode .article-tag,
html.dark-mode .article-excerpt,
html.dark-mode .toc-link,
html.dark-mode .toc-list .toc-list .toc-link {
  color: #a3a3a3 !important;
}

/* Active / hover TOC link keeps brand color */
html.dark-mode .toc-link.active,
html.dark-mode .toc-link:hover {
  color: var(--color-brand) !important;
}

/* Article category tag links use brand color */
html.dark-mode .article-tag a,
html.dark-mode .post-card-primary-tag a,
html.dark-mode .post-card-tags a {
  color: var(--color-brand) !important;
}

/* ============================================
   REDUCED MOTION
   Respect user's OS preference to minimise
   animations. Preserves colour transitions.
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Keep opacity/color transitions for focus visibility */
  .skip-link,
  .easecloud-nav-icon-btn,
  .easecloud-nav-link,
  .btn-brand,
  .btn-outline {
    transition:
      color 0.01ms,
      background-color 0.01ms,
      opacity 0.01ms !important;
  }
}
