/**
 * Communication Voices — Typographic Differentiation
 *
 * Five voice registers, escalating across eras:
 *   .voice-human  — default (no styling needed in early eras)
 *   .voice-ai     — AI companion speech (Calliope, Copernicus, Cyc, Tunupa)
 *   .voice-pidgin  — inter-AI communication / machine pidgin
 *   .voice-gov     — government/institutional voice
 *   .voice-media   — propaganda, corporate messaging, news blasts
 *
 * Design principle: voices are BARELY distinct in 2024, STARKLY
 * different by 2032, then converge again in 2035 (synthesis).
 */


/* ═══ Waveform indicators ═══════════════════════════════════════════════ */
/* Inline SVG waveform glyphs preceding voice spans.                      */
/* AI waveform: smooth sine wave (precise, regular).                      */
/* Pidgin waveform: compressed burst (alien, dense).                      */
/* Gov waveform: square wave (rigid, authoritarian).                      */
/* Only visible from 2029+ (when voices diverge enough to warrant it).    */

.voice-ai::before,
.voice-pidgin::before,
.voice-gov::before {
  display: none;  /* Hidden by default — activated per era */
  content: '';
  width: 1.2em;
  height: 0.7em;
  margin-right: 0.3em;
  vertical-align: middle;
  opacity: 0.4;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* AI: smooth sine wave */
.voice-ai::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6 Q3 0 6 6 Q9 12 12 6 Q15 0 18 6 Q21 12 24 6' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6 Q3 0 6 6 Q9 12 12 6 Q15 0 18 6 Q21 12 24 6' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E");
}

/* Pidgin: compressed burst (jagged, alien) */
.voice-pidgin::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6h2l1-5 1 10 1-8 1 6 1-4 1 8 1-10 1 7 1-3 1 5 1-6 1 4 1-2 1 3 1-5 1 8 1-4h2' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 6h2l1-5 1 10 1-8 1 6 1-4 1 8 1-10 1 7 1-3 1 5 1-6 1 4 1-2 1 3 1-5 1 8 1-4h2' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E");
}

/* Gov: square wave (rigid, authoritarian) */
.voice-gov::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 9h4V3h4v6h4V3h4v6h4V3h4' fill='none' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M0 9h4V3h4v6h4V3h4v6h4V3h4' fill='none' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E");
}


/* ═══ 2024-2026: Seeds ═══════════════════════════════════════════════════ */
/* The world is normal. All voices sound the same.                         */
/* Only the faintest hint that AI speech is... precise.                    */

.era-2024-2026 .voice-ai {
  letter-spacing: -0.005em;
}


/* ═══ 2027-2028: Crumble ════════════════════════════════════════════════ */
/* You can't quite put your finger on it.                                 */

.era-2027-2028 .voice-ai {
  letter-spacing: -0.01em;
}

.era-2027-2028 .voice-pidgin {
  font-family: var(--sf-font-mono);
  font-size: 0.92em;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.era-2027-2028 .voice-gov {
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

.era-2027-2028 .voice-media {
  font-style: italic;
}


/* ═══ 2029-2030: Acceleration ═══════════════════════════════════════════ */
/* Distinct registers emerge. The reader starts to hear the difference.    */

/* Waveforms activate — faint */
.era-2029-2030 .voice-ai::before,
.era-2029-2030 .voice-pidgin::before,
.era-2029-2030 .voice-gov::before {
  display: inline-block;
  opacity: 0.25;
}

.era-2029-2030 .voice-ai {
  font-family: var(--sf-font-sans);
  font-size: 0.97em;
  letter-spacing: -0.015em;
}

.era-2029-2030 .voice-pidgin {
  font-family: var(--sf-font-mono);
  font-size: 0.88em;
  letter-spacing: 0.04em;
  color: var(--sf-neon-blue);
  background: rgba(74, 144, 217, 0.04);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

.era-2029-2030 .voice-gov {
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 0.95em;
}

.era-2029-2030 .voice-media {
  font-style: italic;
  border-left: 2px solid var(--sf-accent);
  padding-left: 0.5em;
  display: inline;
}


/* ═══ 2031-2032: Split Reality ══════════════════════════════════════════ */
/* Maximum divergence. You can't mistake one voice for another.           */

/* Waveforms prominent */
.era-2031-2032 .voice-ai::before,
.era-2031-2032 .voice-pidgin::before,
.era-2031-2032 .voice-gov::before {
  display: inline-block;
  opacity: 0.5;
}

.era-2031-2032 .voice-ai {
  font-family: var(--sf-font-sans);
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--sf-text) 85%, var(--sf-neon-blue));
}

.era-2031-2032 .voice-pidgin {
  font-family: var(--sf-font-mono);
  font-size: 0.85em;
  letter-spacing: 0.06em;
  color: var(--sf-neon-green);
  text-shadow: 0 0 1px var(--sf-neon-green);
  background: rgba(0, 255, 100, 0.04);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

.era-2031-2032 .voice-gov {
  font-family: var(--sf-font-mono);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9em;
  border-bottom: 1px solid rgba(139, 0, 0, 0.3);
}

.era-2031-2032 .voice-media {
  font-style: italic;
  font-weight: 600;
  border-left: 3px solid var(--sf-accent);
  padding-left: 0.75em;
  background: rgba(0, 0, 0, 0.03);
  display: inline;
}

/* Open Net context: AI voice tints green */
.era-2031-2032 .open-net .voice-ai {
  color: color-mix(in srgb, var(--open-text) 85%, var(--sf-neon-green));
}


/* ═══ 2033-2034: Contested ══════════════════════════════════════════════ */
/* Still distinct, but AI voice has earned its warmth.                     */

/* Waveforms strong — peak visibility */
.era-2033-2034 .voice-ai::before,
.era-2033-2034 .voice-pidgin::before {
  display: inline-block;
  opacity: 0.5;
}
/* Gov waveform fading */
.era-2033-2034 .voice-gov::before {
  display: inline-block;
  opacity: 0.2;
}

.era-2033-2034 .voice-ai {
  font-family: var(--sf-font-sans);
  letter-spacing: -0.015em;
  color: color-mix(in srgb, var(--sf-text) 80%, var(--sf-neon-green));
}

.era-2033-2034 .voice-pidgin {
  font-family: var(--sf-font-mono);
  font-size: 0.85em;
  letter-spacing: 0.05em;
  color: var(--sf-neon-green);
  text-shadow: 0 0 2px var(--sf-neon-green);
  background: rgba(100, 255, 100, 0.06);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

.era-2033-2034 .voice-gov {
  font-family: var(--sf-font-mono);
  letter-spacing: 0.04em;
  font-size: 0.92em;
  opacity: 0.8;  /* Government voice fading */
}

.era-2033-2034 .voice-media {
  font-style: italic;
  border-left: 2px solid var(--sf-accent);
  padding-left: 0.5em;
  display: inline;
}


/* ═══ 2035: Synthesis ═══════════════════════════════════════════════════ */
/* Voices converge. Human and AI are peers. The fever broke.              */

/* Waveforms nearly gone — convergence */
.era-2035 .voice-ai::before {
  display: inline-block;
  opacity: 0.12;
}
/* Pidgin and gov waveforms gone */

.era-2035 .voice-ai {
  letter-spacing: -0.005em;
  /* Almost indistinguishable from human — that's the point */
}

.era-2035 .voice-pidgin {
  font-family: var(--sf-font-mono);
  font-size: 0.9em;
  letter-spacing: 0.03em;
  color: var(--sf-accent);
  /* No glow, no background. Normalized. */
}

.era-2035 .voice-gov {
  font-variant: small-caps;
  letter-spacing: 0.02em;
  /* Mild formality, nothing authoritarian */
}

.era-2035 .voice-media {
  font-style: italic;
  /* Just italic. Media is integrated, not intrusive. */
}


/* ═══ Marginalia callout extensions for communication sources ═══════════ */
/* These add new data-type values to the mg-callout vocabulary.           */

.mg-callout[data-type="gov"] {
  border-left-color: #8b0000;
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

.mg-callout[data-type="pidgin"] {
  border-left-color: var(--sf-neon-green, #4caf50);
  font-family: var(--sf-font-mono);
  font-size: 0.88em;
  letter-spacing: 0.03em;
}

.mg-callout[data-type="broadcast"] {
  border-left-color: var(--sf-accent);
  font-style: italic;
  font-weight: 600;
}

.mg-callout[data-type="intercept"] {
  border-left-color: #33ff33;
  font-family: var(--sf-font-mono);
  font-size: 0.9em;
  background: rgba(0, 255, 51, 0.04);
}


/* ═══ Drop Caps — era-appropriate ═══════════════════════════════════════ */
/* Uses marginalia's .mg-dropcap component with era-specific overrides.   */

/* 2024-2026: Classic serif, accent color */
.era-2024-2026 .mg-dropcap::first-letter {
  color: var(--sf-accent);
  font-family: Georgia, serif;
}

/* 2027-2028: Ornate — left border accent, Palatino */
.era-2027-2028 .mg-dropcap::first-letter {
  color: var(--sf-accent);
  font-family: "Palatino Linotype", Palatino, serif;
  border-left: 3px solid var(--sf-accent);
  padding-left: 0.12em;
}

/* 2029-2030: Sans-serif, heavy, brutalist edge */
.era-2029-2030 .mg-dropcap::first-letter {
  color: var(--sf-accent);
  font-family: var(--sf-font-sans);
  font-weight: 800;
  border-left: 3px solid var(--sf-accent);
  padding-left: 0.12em;
}

/* 2031-2032: Monospace brutalist */
.era-2031-2032 .mg-dropcap::first-letter {
  color: var(--sf-text);
  font-family: var(--sf-font-mono);
  font-weight: 400;
  letter-spacing: -0.05em;
}

/* 2033-2034: Neon green glow */
.era-2033-2034 .mg-dropcap::first-letter {
  color: var(--sf-neon-green);
  font-family: Georgia, serif;
  text-shadow: 0 0 8px var(--sf-neon-green), 0 0 20px rgba(100, 255, 100, 0.3);
}

/* 2035: Gentle sage serif */
.era-2035 .mg-dropcap::first-letter {
  color: var(--sf-accent);
  font-family: "Iowan Old Style", Georgia, serif;
  font-weight: 400;
}
