/* diff.css — reusable side-by-side diff layout + Darcula syntax rendering.
 * Standalone stylesheet for displaying two-column code diffs.
 *
 * Design constraints:
 * - 100% em and % centric units — zero px anywhere.
 * - Pure flexbox flow — zero overflow: hidden/auto/scroll hacks.
 * - IntelliJ Darcula palette matching java.css constructs. */

/* ============================================================================
 * Side-by-side diff layout — pure flexbox.
 * Left = before (context + deletions), right = after (context + additions).
 * Uses flex-basis with em units and flex-wrap for fluid responsiveness.
 * ========================================================================== */

.diff-pair {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.6em;
  margin: 0.8em 0;
  width: 100%;
  box-sizing: border-box;
}

.diff-pair > pre {
  flex: 1 1 20em;
  box-sizing: border-box;
  margin: 0;
}

@media (max-width: 50em) {
  .diff-pair {
    flex-direction: column;
  }
}

/* Column labels — positioned in the pre's top-right corner */
.diff-pair > pre.diff-left::after,
.diff-pair > pre.diff-right::after {
  position: absolute;
  top: 0.4em;
  right: 0.8em;
  font-size: 0.65em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.45;
}

.diff-pair > pre.diff-left::after {
  content: 'before';
  color: #a5d6a7;
}

.diff-pair > pre.diff-right::after {
  content: 'after';
  color: #a5d6a7;
}


/* ============================================================================
 * Diff block — Darcula dark background matching the site's terminal chrome.
 * Em-based borders and padding; white-space pre-wrap ensures natural code
 * flow without horizontal overflow hacks.
 * ========================================================================== */

pre.diff {
  position: relative;
  background: #2b2b2b;
  color: #a9b7c6;
  border: 0.08em solid #3c3f41;
  border-radius: 0.4em;
  padding: 1.6em 1em 0.8em;
  font-family: 'Roboto Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82em;
  line-height: 1.5;
  tab-size: 4;
  box-shadow: none;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Suppress phosphor terminal prompt on diff blocks */
pre.diff::before {
  content: none;
}

pre.diff > code {
  color: #a9b7c6;
  background: transparent;
  padding: 0;
  border: none;
}


/* ============================================================================
 * Diff line types — deletion / addition / hunk header / file path.
 * Tinted backgrounds with contrast against the Darcula #2b2b2b base.
 * ========================================================================== */

pre.diff .hunk {
  color: #5dfdcb;
  font-style: italic;
  display: block;
}

pre.diff .del {
  color: #a9b7c6;
  background: rgba(255, 50, 50, 0.15);
  display: block;
}

pre.diff .add {
  color: #a9b7c6;
  background: rgba(50, 205, 50, 0.12);
  display: block;
}

pre.diff .file {
  color: #ffc66d;
  font-weight: 600;
  display: block;
}


/* ============================================================================
 * Darcula syntax palette — scoped to pre.diff.
 * Identical token names and colors as java.css (pre[data-lang="java"]) so
 * the diff reads like the IDE that produced the code.
 * ========================================================================== */

pre.diff .keyword    { color: #cc7832; }
pre.diff .type       { color: #7fb3c8; }
pre.diff .annotation { color: #bbb529; }
pre.diff .string     { color: #6a8759; }
pre.diff .comment    { color: #808080; font-style: italic; }
pre.diff .number     { color: #6897bb; }
pre.diff .constant   { color: #9876aa; font-style: italic; }
pre.diff .module     { color: #629755; font-style: italic; }
