/* ============================================================
   Python sub-pillar theme — "Calm Paper + Python Blue"
   Concept: off-white paper, python blue accent, python yellow highlight.
   Calm, thinking, focused — matches Python's clarity-oriented philosophy.
   ============================================================ */

:root {
  /* Backgrounds */
  --bg:           #f5f1e8;
  --bg-card:      #fffdf7;
  --bg-alt:       #ebe5d3;

  /* Text */
  --text:         #1f2630;
  --text-soft:    #4a5260;
  --text-muted:   #7a8290;
  --ink:          #0a1018;

  /* Primary accent (Python blue — official logo color) */
  --accent:       #306998;
  --accent-deep:  #1e4a6e;
  --accent-soft:  #d2e0eb;

  /* Secondary accent (Python yellow — logo highlight) */
  --py-yellow:    #c98e08;
  --py-yellow-deep: #946a05;
  --py-yellow-soft: #f6e6b8;

  /* Highlight gold (warm calm) */
  --gold:         #b07d10;
  --gold-soft:    #f0e0b8;

  /* Borders */
  --border:       #ddd3bb;
  --border-soft:  #e8dfc6;

  /* Fonts */
  --font-body:    "Inter", "Helvetica Neue", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Source Serif 4", "Source Serif Pro", "Crimson Pro", "EB Garamond", Georgia, serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;

  /* Code block (dark blue-grey, Atom One Dark inspired but warmer) */
  --code-bg:        #1e2533;
  --code-fg:        #e6ddc8;
  --code-inline-bg: #ece2c6;
  --code-inline-fg: #5a4010;

  /* Syntax highlight tokens (works on dark blue-grey code-bg) */
  --syn-kw:    #f0a060;   /* keyword (def, class, return, import) */
  --syn-type:  #88c5e8;   /* type name (int, str, List, Optional) */
  --syn-str:   #c8d99a;   /* string literal */
  --syn-num:   #f4a3ee;   /* number literal */
  --syn-com:   #8a8a98;   /* comment */
  --syn-fn:    #ffd476;   /* function name */
  --syn-op:    #d6cab0;   /* operator */
  --syn-cls:   #88c5e8;   /* class name */
  --syn-dec:   #ffb46a;   /* decorator @something */
}

/* Source Serif 4 — variable serif, calm reading */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap');

/* Python logo mark in header */
.site-logo .mark.mark-py {
  background: linear-gradient(135deg, #306998 0%, #ffd43b 50%, #306998 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Python-specific hero treatment */
.hero.py-hero {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(48,105,152,0.10) 0%, transparent 70%),
    linear-gradient(to bottom, var(--bg), var(--bg));
}
.hero.py-hero h1 em {
  color: var(--accent);
  font-style: italic;
  position: relative;
  font-family: var(--font-display);
}
.hero.py-hero h1 em::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 4px;
  height: 10px;
  background: var(--py-yellow-soft);
  z-index: -1;
  border-radius: 4px;
}

/* Chapter accent stripe */
.chapter-header {
  border-top: 4px solid var(--accent);
  padding-top: 36px;
}

/* Chapter number badge */
.chapter-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* Display heading — Source Serif 4 optical-size */
.prose h1, .chapter-header h1, .hero h1 {
  font-variation-settings: "opsz" 60;
}
.prose h2 { font-variation-settings: "opsz" 32; }
.prose h3, .prose h4 { font-variation-settings: "opsz" 18; }

/* Quiz number Python-blue by default */
.quiz-num { background: var(--accent-soft); color: var(--accent); }
.exercise::before { background: var(--accent); }

/* Code block — Python REPL style banner */
.code-wrap.repl .code-meta {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.code-wrap.repl .code-meta::before {
  content: ">>>";
  margin-right: 8px;
  font-weight: 700;
}

/* Pyodide playground widget (Python in browser) */
.py-playground {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  overflow: hidden;
}
.py-playground-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-deep);
  font-weight: 600;
}
.py-playground-label .run-btn {
  background: var(--accent);
  color: var(--bg-card);
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.py-playground-label .run-btn:hover { background: var(--accent-deep); }
.py-playground textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 18px;
  background: var(--code-bg);
  color: var(--code-fg);
  border: none;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.py-playground .output {
  background: #161c28;
  color: #c8d99a;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 12px 18px;
  border-top: 1px solid #2a3445;
  white-space: pre-wrap;
  min-height: 40px;
  max-height: 220px;
  overflow-y: auto;
}
.py-playground .output.error { color: #f0a8a8; }
.py-playground .output.loading { color: #e0c878; font-style: italic; }
.py-playground .output.empty { color: #6a7080; font-style: italic; }

/* Comprehension visualizer */
.comprehension-viz {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
}
.comprehension-viz .steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 14px 0;
}
.comprehension-viz .step {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.comprehension-viz .step-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.comprehension-viz .step-content {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
}

/* Pillar card variations on Pillar 9 index */
.subpillar-card.subpillar-py {
  --card-accent: var(--accent);
  background: linear-gradient(135deg, #fffdf7 0%, #e8e0c5 100%);
}

/* Pretty inline code in Python prose */
.prose p code, .prose li code {
  border-color: var(--gold-soft);
}

/* Python feature block */
.py-feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 20px 0;
  position: relative;
  padding-left: 56px;
}
.py-feature::before {
  content: "🐍";
  position: absolute;
  left: 14px; top: 16px;
  font-size: 1.6rem;
}
.py-feature h4 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  color: var(--ink);
}
.py-feature p:last-child { margin-bottom: 0; }

/* Footer accent */
.site-footer {
  background: linear-gradient(to bottom, var(--bg), var(--bg-alt));
}

/* Hero typography enhancement */
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Zen of Python quote styling */
.zen-quote {
  background: var(--bg-card);
  border-left: 4px solid var(--py-yellow);
  padding: 16px 22px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-soft);
  font-size: 1.04rem;
  line-height: 1.65;
}
.zen-quote::before {
  content: "“";
  color: var(--py-yellow);
  font-size: 2rem;
  font-weight: 700;
  vertical-align: -8px;
  margin-right: 4px;
}

/* Decorator highlight (Python-specific) */
.tok-dec { color: var(--syn-dec); font-weight: 600; }
