/* stylelint-disable property-no-unknown */

/* The note above the timeline: icon, then text, on one line, as the old alert banner's
   body laid it out. The box itself is <site-callout>. */
.banner .callout-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;

  /* The old banner body started 16px in from the left padding. */
  margin-inline-start: var(--swc-spacing-300);
}

/* The old banner's text paragraph had its own margins (18px above, 20px below, 16px at the end), not the
   browser's 1em. */
.banner .callout-row p {
  margin-block: 18px 20px;
  margin-inline-end: var(--swc-spacing-300);
}

.timeline-card iconify-icon {
  font-size: 2rem;
  margin-right: 1.5rem;
}

/* structure */
.timeline-card svg {

  --site-heading-margin-end: 0;
  --site-heading-margin-start: 0;
  --gb: var(--swc-indigo-900);
  --ireland: var(--swc-green-600);
  --magical: var(--swc-fuchsia-600);
  --religious: var(--swc-orange-600);
  --scotland: var(--swc-cyan-600);
  --england: var(--swc-red-900);
  --generic: var(--swc-brown-800);
  display: block;
  font-optical-sizing: auto;
  height: auto;
  margin-top: 3px;
  width: 100%;
}

/* Was --mod-heading-serif-font-family on the card. Gen2's .swc-Heading--serif sets its font
   on the heading element, where an inherited value cannot override it, so the family is
   set on the headings themselves. */
div.timeline-card .swc-Heading--serif {
  --swc-heading-font-family: "EB Garamond", serif;
}

div.timeline-card svg .swc-Heading--sizeM, div.timeline-card svg .swc-Body--sizeM, div.timeline-card svg .swc-Detail--sizeM {
  --swc-heading-font-size: 12px;
  --swc-body-font-size: 12px;
  --swc-detail-font-size: 12px;
}

div.timeline-card svg .swc-Heading--sizeS, div.timeline-card svg .swc-Body--sizeS, div.timeline-card svg .swc-Detail--sizeS {
  --swc-heading-font-size: 10px;
  --swc-body-font-size: 10px;
  --swc-detail-font-size: 10px;
}

foreignObject div.swc-Body {
  --site-body-margin-end: 0;
}

foreignObject div.swc-Body.description, foreignObject div.swc-Body.sources {
  text-align: left;
}

foreignObject div.swc-Body.description blockquote {
  margin-block: 1px;
  margin-inline: 2em 0;
}

div.swc-Body ul {
  margin-block: 0;
  padding-inline: 2em 0;
  text-align: left;
}

div.swc-Body li.swc-Body {
  margin-block: 0;
}

/* Type-based colors. The hard-coded hex fallbacks these carried were reached in
   practice, because the tokens named beside them (--spectrum-semantic-*-color-default,
   --spectrum-global-color-blue-600) belong to the retired Spectrum 1 token system and
   are defined nowhere. The current names below are theme-aware, so no fallback: a
   future rename should show up as a missing colour, not as a value frozen in light
   mode. */
.birth {
  color: var(--swc-positive-color-900);
}

.death {
  color: var(--swc-negative-color-900);
}

.other {
  color: var(--swc-blue-900);
}

/* qualifiers */
.estimated.range, .estimated {
  stroke-dasharray: 4 3;
}

.calculated.range, .calculated {
  stroke-dasharray: 2 2;
}

/* attributes of the people associated with events */
.color-female {

  --gender-shade: var(--color-female);
  color: var(--color-female);
}

.color-male {

  --gender-shade: var(--color-male);
  color: var(--color-male);
}

iconify-icon.color-female {
  color: var(--color-female);
}

iconify-icon.color-male {
  color: var(--color-male);
}

iconify-icon.return {
  display: inline-block;
  max-height: 1em;
  max-width: 0.5em;
}

/* category based styling */

.england {
  --category-color: var(--england);
}

.scotland {
  --category-color: var(--scotland);
}

.gb {
  --category-color: var(--gb);
}

.ireland {
  --category-color: var(--ireland);
}

.magical {
  --category-color: var(--magical);
}

.religious {
  --category-color: var(--religious);
}

.generic {
  --category-color: var(--generic);
}

.mundane:not(.england, .scotland, .ireland, .gb, .religious) {
  --category-color: var(--generic);
}

/* defaults */

line, circle {
  stroke: var(--category-color);
}

.edge {
  stroke: var(--category-color);
  stroke-width: 2;
}

.edge path {
  fill: none;
  stroke: var(--category-color);
}

.node {
  fill: none;
  stroke: var(--category-color);
  stroke-width: 2;
}

.node rect {
  fill: var(--category-color);
  fill-opacity: 0.1;
}

.timeline.node-label {
  align-items: baseline;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 99%;
  overflow: hidden;
  overflow-wrap: break-word;
  padding: 2px;
  place-content: center flex-start;
  stroke-width: 1;
  text-wrap: pretty;
  width: 99%;
}

.timeline.detail-edge {
  stroke: var(--category-color);
  stroke-dasharray: 1, 1;
  stroke-linecap: round;
  stroke-width: 0.75px;
}

.timeline.node-label div {
  text-align: center;
  width: 100%;
}
