/* ESBvaktin Debate Detail — Styles
 *
 * Prefix: dd-* (debate-detail)
 * Uses global CSS custom properties from style.css.
 */

/* ── Party colours (custom properties for reuse) ────────────────── */

.party-xd  { --party-color: #003897; }
.party-s   { --party-color: #e30613; }
.party-b   { --party-color: #007a33; }
.party-m   { --party-color: #003459; }
.party-c   { --party-color: #ff8c00; }
.party-v   { --party-color: #00843d; }
.party-p   { --party-color: #660099; }
.party-f   { --party-color: #c5a800; }
.party-hr  { --party-color: #009fe3; }
.party-other { --party-color: var(--grey, #6b7280); }

/* ── Layout ──────────────────────────────────────────────────────── */

.dd-debate {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

/* ── Header ──────────────────────────────────────────────────────── */

.dd-header {
  margin-bottom: 2rem;
}

.dd-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  line-height: 1.3;
  margin: 0 0 0.75rem;
}

.dd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.dd-meta-item {
  white-space: nowrap;
}

.dd-althingi-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.75rem;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.dd-althingi-link:hover {
  color: #fff;
  background: var(--accent);
}

/* ── Stats ───────────────────────────────────────────────────────── */

.dd-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.dd-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  text-align: center;
  min-width: 70px;
}

.dd-stat-num {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
}

.dd-stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* ── Party legend ───────────────────────────────────────────────── */

.dd-party-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.dd-party-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--party-color);
  color: #fff;
  white-space: nowrap;
}

.dd-party-pill.party-f {
  color: #1a1a1a;
}

/* ── Speakers — side-by-side layout ─────────────────────────────── */

.dd-speakers {
  margin-bottom: 2rem;
}

.dd-speakers-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dd-speakers-side h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
}

.dd-speaker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.dd-speaker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--party-color, var(--border));
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  transition: box-shadow var(--transition), border-color var(--transition);
}

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

.dd-speaker-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.dd-speaker-party {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--party-color);
  color: #fff;
  margin-bottom: 0.3rem;
}

.dd-speaker-party.party-f {
  color: #1a1a1a;
}

.dd-speaker-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Timeline — chat-style layout ───────────────────────────────── */

.dd-timeline {
  margin-bottom: 2rem;
}

.dd-timeline h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
}

.dd-date-divider {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  margin: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.dd-date-divider:first-child {
  margin-top: 0;
}

.dd-speech {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  max-width: 82%;
  border-bottom: none;
}

/* Coalition: left-aligned (default) */
.dd-speech--coalition {
  margin-right: auto;
}

/* Opposition: right-aligned, marker on right */
.dd-speech--opposition {
  margin-left: auto;
  flex-direction: row-reverse;
}

/* No side info: full-width centered */
.dd-speech:not(.dd-speech--coalition):not(.dd-speech--opposition) {
  max-width: 100%;
}

.dd-speech-marker {
  flex-shrink: 0;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--party-color, var(--accent));
}

.dd-speech-content {
  flex: 1;
  min-width: 0;
}

/* Opposition: right-align text */
.dd-speech--opposition .dd-speech-content {
  text-align: right;
}

.dd-speech--opposition .dd-speech-header {
  justify-content: flex-end;
}

.dd-speech--opposition .dd-speech-meta {
  justify-content: flex-end;
}

.dd-speech-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.dd-speech-speaker {
  font-size: 0.95rem;
}

.dd-speech-party {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--party-color);
  color: #fff;
  white-space: nowrap;
}

.dd-speech-party.party-f {
  color: #1a1a1a;
}

.dd-speech-type {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-style: italic;
}

.dd-speech-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* Excerpt — coalition (left border) */
.dd-speech-excerpt {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--party-color, var(--border));
  background: var(--bg-alt, var(--bg));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Excerpt — opposition (right border, left-align text for readability) */
.dd-speech--opposition .dd-speech-excerpt {
  border-left: none;
  border-right: 3px solid var(--party-color, var(--border));
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  text-align: left;
}

/* ── Expandable speeches ─────────────────────────────────────────── */

.dd-speech-expandable {
  /* Remove default disclosure triangle */
}

.dd-speech-expandable summary {
  list-style: none;
  cursor: pointer;
}

.dd-speech-expandable summary::-webkit-details-marker {
  display: none;
}

.dd-speech-expandable summary::marker {
  display: none;
  content: "";
}

/* Hint that excerpt is expandable */
.dd-speech-expandable summary.dd-speech-excerpt {
  position: relative;
}

.dd-speech-expandable summary.dd-speech-excerpt::after {
  content: "Smella til að lesa alla ræðuna";
  display: block;
  font-size: 0.7rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.dd-speech-expandable summary.dd-speech-excerpt:hover::after {
  opacity: 1;
}

/* When open: hide excerpt text, show collapse hint */
.dd-speech-expandable[open] summary.dd-speech-excerpt {
  font-size: 0;
  line-height: 0;
  padding: 0;
  border-left-width: 0;
  border-right-width: 0;
  background: none;
  min-height: 0;
}

.dd-speech-expandable[open] summary.dd-speech-excerpt::after {
  font-size: 0.7rem;
  line-height: 1.4;
  content: "Smella til að fella saman ↑";
  padding: 0.25rem 0;
  display: inline-block;
}

/* Full text styling */
.dd-speech-full {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
  padding: 0.75rem;
  border-left: 3px solid var(--party-color, var(--border));
  background: var(--bg-alt, var(--bg));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.35rem;
  cursor: pointer;
  text-align: left;
}

/* Opposition full text: right border */
.dd-speech--opposition .dd-speech-full {
  border-left: none;
  border-right: 3px solid var(--party-color, var(--border));
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.dd-speech-full p {
  margin: 0 0 0.6rem;
}

.dd-speech-full p:last-child {
  margin-bottom: 0;
}

/* ── Back link ───────────────────────────────────────────────────── */

.dd-back {
  padding: 1.5rem 0;
}

.dd-back a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.dd-back a:hover {
  text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .dd-title {
    font-size: 1.3rem;
  }

  .dd-speakers-sides {
    grid-template-columns: 1fr;
  }

  .dd-speakers-sides {
    grid-template-columns: 1fr;
  }

  .dd-speaker-grid {
    grid-template-columns: 1fr;
  }

  .dd-speech {
    max-width: 92%;
  }

  .dd-speech-header {
    flex-direction: column;
    gap: 0.2rem;
  }

  .dd-stats {
    justify-content: center;
  }
}
