/* ============================================================
   Java sub-pillar theme — "Blueprint Slate + Java Orange"
   Concept: nền xanh-xám lạnh như bản vẽ kỹ thuật (blueprint),
   điểm nhấn cam Java chính thức + xanh thép. Slab serif cho tiêu đề.
   Cảm giác: kỹ thuật, chắc chắn, enterprise — đối lập với
   nền kem ấm của Dart/Flutter/JavaScript/Python.
   ============================================================ */

:root {
  /* Backgrounds — cool slate, khác hẳn cream của 4 sub-pillar kia */
  --bg:           #eef2f7;
  --bg-card:      #ffffff;
  --bg-alt:       #dde5ee;

  /* Text */
  --text:         #1c2430;
  --text-soft:    #48566a;
  --text-muted:   #78869a;
  --ink:          #0b1220;

  /* Primary accent — cam Java chính thức */
  --accent:       #e76f00;
  --accent-deep:  #b35400;
  --accent-soft:  #fde3cc;

  /* Secondary accent — xanh thép Java */
  --java-blue:      #5382a1;
  --java-blue-deep: #35566e;
  --java-blue-soft: #d5e3ed;

  /* Highlight */
  --gold:         #a86b12;
  --gold-soft:    #f7e5c4;

  /* Borders */
  --border:       #ccd7e3;
  --border-soft:  #dde6ef;

  /* Fonts — Bitter (slab serif) làm chữ hiển thị, khác 4 sub-pillar kia */
  --font-body:    "Inter", "Helvetica Neue", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: "Bitter", "Roboto Slab", "Zilla Slab", Georgia, serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;

  /* Code block — xanh đen sâu, sắc lạnh */
  --code-bg:        #1a2130;
  --code-fg:        #dbe3ee;
  --code-inline-bg: #dfe8f1;
  --code-inline-fg: #8a4200;

  /* Syntax highlight — bảng màu hợp nền xanh đen */
  --syn-kw:    #ff9d5c;   /* keyword: class, public, static, return */
  --syn-type:  #6cc6f0;   /* type: int, String, List */
  --syn-str:   #b8d68a;   /* string literal */
  --syn-num:   #f4a3ee;   /* number literal */
  --syn-com:   #7b8899;   /* comment */
  --syn-fn:    #ffd166;   /* method name */
  --syn-op:    #c6d0dd;   /* operator */
  --syn-cls:   #6cc6f0;   /* class name */
  --syn-ann:   #ffb46a;   /* annotation @Override */
}

/* Bitter — slab serif cho tiêu đề */
@import url('https://fonts.googleapis.com/css2?family=Bitter:wght@500;600;700&display=swap');

/* Logo mark trong header */
.site-logo .mark.mark-java {
  background: linear-gradient(135deg, #e76f00 0%, #f89820 50%, #5382a1 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Hero riêng của Java */
.hero.java-hero {
  background:
    radial-gradient(ellipse 75% 55% at 50% 0%, rgba(231,111,0,0.10) 0%, transparent 68%),
    radial-gradient(ellipse 55% 45% at 20% 40%, rgba(83,130,161,0.10) 0%, transparent 65%),
    linear-gradient(to bottom, var(--bg), var(--bg));
}
.hero.java-hero h1 em {
  color: var(--accent-deep);
  font-style: normal;
  position: relative;
}
.hero.java-hero h1 em::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 6px;
  height: 12px;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 3px;
}

/* Vạch màu đầu chương */
.chapter-header {
  border-top: 4px solid var(--accent);
  padding-top: 36px;
}

/* Badge số chương */
.chapter-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 3px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* Heading — slab serif, chặt chẽ */
.prose h1, .chapter-header h1, .hero h1 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.prose h2 {
  border-bottom: 2px solid var(--border-soft);
  padding-bottom: 8px;
}

/* Quiz + exercise dùng màu cam Java */
.quiz-num { background: var(--accent-soft); color: var(--accent-deep); }
.exercise::before { background: var(--accent); }

/* Annotation token — đặc trưng Java (@Override, @FunctionalInterface) */
.tok-ann { color: var(--syn-ann); font-weight: 600; }

/* Code block kiểu terminal JShell */
.code-wrap.jshell .code-meta {
  background: var(--java-blue-soft);
  color: var(--java-blue-deep);
}
.code-wrap.jshell .code-meta::before {
  content: "jshell>";
  margin-right: 8px;
  font-weight: 700;
}

/* ---------- Component riêng: sơ đồ luồng biên dịch JVM ---------- */
.jvm-flow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin: 24px 0;
}
.jvm-flow .stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.jvm-flow .stage {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 12px;
  text-align: center;
}
.jvm-flow .stage.blue { border-left-color: var(--java-blue); }
.jvm-flow .stage-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.jvm-flow .stage-content {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.45;
}
.jvm-flow .caption {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text-soft);
  text-align: center;
}

/* ---------- Component riêng: cây phân cấp (Collection, Exception) ---------- */
.hierarchy {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text);
  overflow-x: auto;
}
.hierarchy .root  { color: var(--accent-deep); font-weight: 700; }
.hierarchy .iface { color: var(--java-blue-deep); font-weight: 600; }
.hierarchy .impl  { color: var(--text-soft); }
.hierarchy .note  { color: var(--text-muted); font-style: italic; }

/* ---------- Component riêng: khối "☕ Java-ism" ---------- */
.java-note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px 18px 56px;
  margin: 20px 0;
  position: relative;
}
.java-note::before {
  content: "☕";
  position: absolute;
  left: 16px; top: 15px;
  font-size: 1.5rem;
}
.java-note h4 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.06rem;
  color: var(--ink);
}
.java-note p:last-child { margin-bottom: 0; }

/* ---------- Component riêng: bảng độ phức tạp Big-O ---------- */
.bigo {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}
.bigo.good { background: #d8ecd8; color: #245c24; }   /* O(1), O(log n) */
.bigo.mid  { background: var(--gold-soft); color: #7a4d05; }  /* O(n) */
.bigo.bad  { background: #f6d8d8; color: #7d2222; }   /* O(n²) */

/* Inline code trong prose */
.prose p code, .prose li code, .prose td code {
  border-color: var(--java-blue-soft);
}

/* Thẻ sub-pillar Java trên trang Pillar 9 */
.subpillar-card.subpillar-java {
  --card-accent: var(--accent);
  background: linear-gradient(135deg, #ffffff 0%, #dbe5ef 100%);
}

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

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

/* Trích dẫn kiểu "quy tắc Java" */
.java-rule {
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  padding: 16px 22px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-family: var(--font-display);
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.6;
}
.java-rule strong { color: var(--ink); }
