/*
 * Candidature nella comunità.
 * Rules are scoped to #candidature and its dedicated card-reading dialog.
 * Existing Fjalla One / Roboto, colour tokens, photographs and page gutters
 * are inherited; this file neither changes global tokens nor requires JS.
 */

#candidature {
  --candidate-title: clamp(1.75rem, 1.4rem + 1.15vw, 2.5rem);
  --candidate-name: clamp(1.875rem, 1.5rem + 1.4vw, 2.75rem);
  --candidate-word: clamp(.875rem, .84rem + .15vw, 1rem);
  --candidate-wash: color-mix(in srgb, var(--highlight) 13%, var(--paper));
  --candidate-lilac: color-mix(in srgb, var(--violet) 8%, var(--paper));
  --candidate-ring: color-mix(in srgb, var(--magenta) 52%, var(--paper));
  --candidate-ring-lilac: color-mix(in srgb, var(--violet) 64%, var(--paper));
  position: relative;
  isolation: isolate;
  color: var(--ink);
  background: var(--paper);
  background-image: linear-gradient(180deg,
    var(--paper) 0%, var(--candidate-lilac) 34%,
    var(--candidate-wash) 58%, var(--paper) 100%);
}

/* Additional candidatures: the supplied cards remain intact. */
#candidature .candidate-team-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  margin-top: var(--space-6);
  padding: var(--space-5) var(--space-1);
  min-height: 80px;
  border-top: 1px solid var(--candidate-ring-lilac);
  color: var(--ink);
  text-decoration: none;
}

#candidature .candidate-team-link > span:first-child {
  min-width: 0;
}

#candidature .candidate-team-link .eyebrow {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--secondary-ink);
}

#candidature .candidate-team-link strong {
  font-size: var(--text-base);
  line-height: 1.5;
  font-weight: 700;
}

#candidature .candidate-team-link > span:last-child {
  color: var(--blue);
  font-size: var(--text-lg);
}

#candidature .candidate-team-link:hover strong {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .2em;
}

#candidature .candidate-team-link:active {
  color: var(--blue);
}

#candidature .candidate-team-section {
  min-width: 0;
  margin-top: clamp(var(--space-12), 6vw, var(--space-20));
  padding-top: clamp(var(--space-8), 4vw, var(--space-12));
  border-top: 1px solid var(--candidate-ring-lilac);
  scroll-margin-top: 8rem;
}

#candidature .candidate-vice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(var(--space-8), 6vw, var(--space-20));
}

#candidature .team-vice-copy,
#candidature .team-gallery-heading > div {
  min-width: 0;
}

#candidature .team-vice-copy > .eyebrow,
#candidature .team-gallery-heading .eyebrow {
  margin-bottom: var(--space-4);
  color: var(--secondary-ink);
}

#candidature .candidate-team-section h3 {
  font-size: var(--candidate-title);
  line-height: 1.25;
  color: var(--blue);
  margin: 0;
}

#candidature .candidate-vice-card .team-card-name {
  margin-top: var(--space-8);
  font-size: var(--candidate-name);
}

#candidature .candidate-vice-card > .team-card-open {
  width: min(100%, 400px);
  justify-self: center;
}

#candidature .team-card-open {
  display: block;
  min-width: 0;
  max-width: 100%;
  color: var(--blue);
  text-decoration: none;
}

#candidature .team-card-open img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--circulation-radius);
  background: var(--surface);
}

#candidature .team-card-open-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 44px;
  padding: var(--space-3) var(--space-1);
  font-size: var(--text-sm);
  line-height: 1.5;
  font-weight: 700;
}

#candidature .team-card-open:hover .team-card-open-label {
  text-decoration: underline;
  text-underline-offset: .2em;
}

#candidature .team-card-open:hover img {
  border-color: var(--blue);
}

#candidature .team-card-open:active .team-card-open-label {
  color: var(--ink);
}

#candidature .team-gallery-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

#candidature .team-gallery-help {
  margin-top: var(--space-4);
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.6;
}

#candidature .team-gallery-controls {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-3);
  padding-bottom: var(--space-1);
}

#candidature .team-gallery-controls[hidden] {
  display: none;
}

#candidature .team-gallery-controls .icon-button {
  width: 48px;
  height: 48px;
  color: var(--blue);
  border-color: var(--candidate-ring-lilac);
}

#candidature .team-gallery-controls .icon-button:active:not(:disabled) {
  color: var(--ink);
  background: var(--candidate-lilac);
}

#candidature .team-gallery-controls .icon-button:disabled,
#candidate-card-dialog button:disabled {
  opacity: 1;
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface);
  cursor: default;
}

#candidature .team-card-gallery {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * var(--space-6)) / 3.2);
  gap: var(--space-6);
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: var(--space-1) var(--space-1) var(--space-6);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--space-1);
  scrollbar-color: var(--blue) var(--surface);
  scrollbar-width: thin;
  list-style: none;
}

#candidature .team-card-gallery > li {
  min-width: 0;
  max-width: none;
  scroll-snap-align: start;
}

#candidature .team-card-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.3rem + .65vw, 1.875rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  margin: var(--space-3) 0 0;
  overflow-wrap: anywhere;
}

#candidature .team-card-role {
  margin-top: var(--space-2);
  max-width: 42ch;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--secondary-ink);
  overflow-wrap: anywhere;
}

#candidature .team-card-transcript {
  margin-top: var(--space-4);
  font-size: var(--text-base);
  line-height: 1.7;
}

#candidature .team-card-transcript summary {
  min-height: 44px;
  padding-block: var(--space-3);
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .2em;
}

#candidature.candidate-cards-ready .team-card-transcript {
  display: none;
}

#candidature .team-card-keywords,
#candidate-card-dialog .team-card-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-6) 0;
  padding: 0;
  list-style: none;
}

#candidature .team-card-keywords > li,
#candidate-card-dialog .team-card-keywords > li {
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#candidature .team-card-transcript blockquote,
#candidate-card-dialog blockquote {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.8;
}

#candidature .candidate-team-link:focus-visible,
#candidature .team-card-open:focus-visible,
#candidature .team-gallery-controls button:focus-visible,
#candidate-card-dialog :is(a, button):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

#candidate-card-dialog {
  width: min(1120px, calc(100% - 32px));
  max-height: min(92dvh, 1100px);
  margin: auto;
  overflow-y: auto;
  border-radius: var(--circulation-radius);
}

#candidate-card-dialog .dialog-top .eyebrow {
  font-size: var(--text-xs);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

#candidate-card-dialog .candidate-card-body {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  grid-template-areas: "heading image" "reading image";
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: var(--space-6) var(--space-8);
  padding: var(--space-8);
}

#candidate-card-dialog .candidate-card-heading {
  grid-area: heading;
}

#candidate-card-dialog .candidate-card-figure {
  grid-area: image;
}

#candidate-card-dialog .candidate-card-reading {
  grid-area: reading;
}

#candidate-card-dialog .candidate-card-body > * {
  min-width: 0;
}

#candidate-card-dialog .candidate-card-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--circulation-radius-small);
  background: var(--surface);
}

#candidate-card-dialog .candidate-card-figure img[hidden],
#candidate-card-dialog [hidden] {
  display: none;
}

#candidate-card-dialog figcaption,
#candidate-card-dialog .candidate-card-source-note {
  margin-top: var(--space-4);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

#candidate-card-dialog h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.25vw, 2.125rem);
  line-height: 1.3;
  color: var(--blue);
  margin: 0 0 var(--space-3);
}

#candidate-card-dialog #candidate-card-role {
  color: var(--secondary-ink);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

#candidate-card-dialog #candidate-card-text {
  margin-top: 0;
  font-size: var(--text-base);
  line-height: 1.8;
}

#candidate-card-dialog #candidate-card-text .team-card-keywords {
  margin-top: 0;
}

#candidate-card-dialog #candidate-card-original {
  max-width: 100%;
  margin-top: var(--space-3);
  color: var(--blue);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

#candidate-card-dialog .candidate-card-navigation {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-4) var(--space-8);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

#candidate-card-dialog .candidate-card-navigation .text-button {
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--blue);
}

#candidate-card-dialog .candidate-card-navigation .text-button:disabled {
  color: var(--muted);
}

#candidate-card-dialog #candidate-card-position {
  flex-shrink: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1050px) {
  #candidature .team-card-gallery {
    grid-auto-columns: calc((100% - var(--space-6)) / 2.2);
  }
}

@media (max-width: 760px) {
  #candidate-card-dialog .candidate-card-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "image" "reading";
    grid-template-rows: auto auto auto;
    padding: var(--space-6);
    gap: var(--space-6);
  }

  #candidate-card-dialog .candidate-card-figure {
    max-width: 520px;
    width: 100%;
    margin-inline: auto;
  }

  #candidate-card-dialog .candidate-card-navigation {
    padding-inline: var(--space-6);
  }
}

@media (max-width: 600px) {
  #candidature .candidate-vice-card {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  #candidature .candidate-vice-card .team-card-name {
    margin-top: var(--space-6);
  }

  #candidature .team-card-gallery {
    grid-auto-columns: calc((100% - var(--space-4)) / 1.08);
    gap: var(--space-4);
  }

  #candidature .team-gallery-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--space-4);
  }

  #candidature .team-gallery-controls {
    margin-left: auto;
  }

  #candidate-card-dialog .dialog-top {
    padding: var(--space-4);
  }

  #candidate-card-dialog .candidate-card-body {
    padding: var(--space-4);
  }

  #candidate-card-dialog .candidate-card-navigation {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
  }

  #candidate-card-dialog .candidate-card-navigation .text-button {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: var(--space-2) var(--space-1);
    overflow-wrap: anywhere;
  }

  #candidate-card-dialog .candidate-card-navigation .text-button > span {
    display: none;
  }

  #candidate-card-dialog #candidate-card-position {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

[data-contrast="high"] #candidature .candidate-team-link,
[data-contrast="high"] #candidature .candidate-team-section,
[data-contrast="high"] #candidature .team-gallery-controls .icon-button {
  border-color: var(--line);
}

@media (forced-colors: active) {
  #candidature .team-card-open img {
    border-color: CanvasText;
  }

  #candidate-card-dialog {
    border: 2px solid CanvasText;
  }
}

@media print {
  #candidature .team-gallery-controls,
  #candidature .team-card-open-label,
  #candidature .candidate-team-link {
    display: none;
  }

  #candidature .team-card-gallery {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-columns: auto;
    overflow: visible;
  }

  #candidature .team-card-gallery > li {
    break-inside: avoid;
  }
}

#candidature::after {
  content: none;
}

#candidature .section-heading {
  margin-bottom: var(--space-8);
}

#candidature .candidate-community {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(var(--space-8), 6vw, var(--space-20));
  align-items: start;
  margin-bottom: var(--space-8);
}

#candidature .candidate-community > *,
#candidature .candidate-list > *,
#candidature .candidate-copy,
#candidature .candidate-visual {
  min-width: 0;
}

#candidature .candidate-common-message h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--candidate-title);
  line-height: 1.25;
  color: var(--blue);
}

#candidature .candidate-common-purpose h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--circulation-title);
  line-height: 1.3;
  color: var(--secondary-ink);
}

#candidature .candidate-community p {
  max-width: 59ch;
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--ink);
}

#candidature .candidate-common-purpose p {
  max-width: 44ch;
}

#candidature .candidate-common-purpose .source-link {
  max-width: 100%;
  margin-top: var(--space-2);
  padding-block: var(--space-3);
  font-size: var(--text-sm);
  min-height: 44px;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: .2em;
  overflow-wrap: anywhere;
}

/* One continuous composition, with neither independent cards nor connectors.
 * The words use normal flow: longer words and enlarged text can wrap freely.
 */
#candidature .candidate-list {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(var(--space-8), 6vw, var(--space-20));
  margin-top: 0;
  isolation: isolate;
}

#candidature .candidate-list::before {
  content: "";
  display: block;
  z-index: -1;
  position: absolute;
  top: 5rem;
  left: 13%;
  right: 13%;
  height: clamp(12rem, 23vw, 22rem);
  border: 1px solid var(--candidate-ring-lilac);
  border-radius: 50%;
  transform: rotate(-9deg);
  pointer-events: none;
}

#candidature .candidate.candidate-profile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#candidature .candidate-visual {
  margin-bottom: var(--space-8);
}

#candidature .candidate-words {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-6);
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  list-style: none;
  font-family: var(--font-body);
  font-size: var(--candidate-word);
  line-height: 1.6;
  color: var(--secondary-ink);
}

#candidature .candidate-words > li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

#candidature .candidate-words-top {
  justify-content: space-between;
  padding-block: var(--space-4) var(--space-5);
}

#candidature .candidate-words-bottom {
  justify-content: flex-end;
  padding-block: var(--space-5) 0;
  padding-right: var(--space-4);
}

#candidature .candidate-profile:nth-child(2) .candidate-words-bottom {
  justify-content: flex-start;
  padding-left: var(--space-4);
  padding-right: 0;
}

#candidature .candidate-words-top > li:first-child::before,
#candidature .candidate-words-bottom > li:last-child::after {
  content: "";
  flex: 0 0 var(--space-2);
  width: var(--space-2);
  height: var(--space-2);
  border: 1px solid var(--candidate-ring-lilac);
  border-radius: 50%;
}

/* Keep the full, real photographs at their natural 3:2 and 1:1 ratios.
 * The square is inset on a shared 3:2 stage, not cropped to match Luciano.
 */
#candidature .candidate-portrait {
  position: relative;
  display: grid;
  align-items: end;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  margin: 0;
  overflow: visible;
  background: transparent;
}

#candidature .candidate-portrait img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  margin: 0;
  background: var(--surface);
  border-radius: var(--circulation-radius) var(--circulation-radius-photo)
    var(--circulation-radius) var(--circulation-radius);
  clip-path: none;
  mask-image: none;
}

#candidature .candidate-profile:nth-child(2) .candidate-portrait img {
  width: 66.666667%;
  margin: 0 auto;
  border-radius: var(--circulation-radius-photo) var(--circulation-radius)
    var(--circulation-radius) var(--circulation-radius);
}

#candidature .portrait-ring {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  width: var(--space-16);
  height: var(--space-16);
  aspect-ratio: 1;
  right: var(--space-2);
  left: auto;
  bottom: calc(-1 * var(--space-3));
  border: 2px solid var(--candidate-ring);
  border-radius: 50%;
}

#candidature .portrait-ring > span {
  position: absolute;
  width: var(--space-12);
  height: var(--space-12);
  left: calc(-1 * var(--space-5));
  bottom: var(--space-2);
  border: 2px solid var(--candidate-ring-lilac);
  border-radius: 50%;
}

#candidature .candidate-profile:nth-child(2) .portrait-ring {
  width: var(--space-16);
  right: auto;
  left: 12%;
  bottom: calc(-1 * var(--space-3));
  border-color: var(--candidate-ring-lilac);
}

#candidature .candidate-profile:nth-child(2) .portrait-ring > span {
  left: var(--space-10);
  border-color: var(--candidate-ring);
}

#candidature .candidate-copy {
  position: relative;
}

#candidature .candidate-copy > .eyebrow {
  color: var(--secondary-ink);
  font-size: var(--text-xs);
  letter-spacing: .045em;
  line-height: 1.6;
}

#candidature .candidate-copy > h3 {
  margin: var(--space-3) 0 0;
  font-size: var(--candidate-name);
  line-height: 1.25;
  color: var(--blue);
  overflow-wrap: anywhere;
}

#candidature .candidate-bio {
  margin-top: var(--space-5);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--ink);
}

#candidature .candidate-bio p,
#candidature .candidate-biography-body p {
  max-width: 62ch;
}

#candidature .candidate-bio p + p {
  margin-top: var(--space-3);
}

/* Native details retain keyboard support, discoverable state and no-JS use.
 * The introductions above stay visible; only the longer continuation closes.
 */
#candidature .candidate-biography {
  margin-top: var(--space-6);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#candidature .candidate-biography > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
  padding: var(--space-4) var(--space-2) var(--space-4) 0;
  list-style: none;
  cursor: pointer;
  color: var(--blue);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.6;
  border-radius: var(--radius-sm);
  transition: color 180ms ease;
}

#candidature .candidate-biography > summary > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

#candidature .candidate-summary-context {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.6;
  color: var(--muted);
}

#candidature .candidate-biography > summary::-webkit-details-marker {
  display: none;
}

#candidature .candidate-biography > summary::after {
  content: "";
  flex: 0 0 .625rem;
  width: .625rem;
  height: .625rem;
  margin-right: var(--space-2);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

#candidature .candidate-biography[open] > summary::after {
  transform: rotate(225deg);
}

#candidature .candidate-biography > summary:hover,
#candidature .source-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .2em;
}

#candidature .candidate-biography > summary:active,
#candidature .source-link:active {
  color: var(--secondary-ink);
}

#candidature :is(summary, a):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

#candidature .candidate-biography-body {
  padding: var(--space-2) 0 var(--space-6);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--ink);
}

#candidature .candidate-biography-body h4 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}

#candidature .candidate-timeline {
  padding: 0 0 0 var(--space-6);
  margin: 0;
  list-style: none;
}

#candidature .candidate-timeline > li {
  position: relative;
  max-width: none;
  padding: 0 0 var(--space-6) var(--space-2);
}

#candidature .candidate-timeline > li:last-child {
  padding-bottom: 0;
}

#candidature .candidate-timeline > li::before {
  content: "";
  position: absolute;
  top: .5em;
  left: calc(-1 * var(--space-5));
  width: var(--space-2);
  height: var(--space-2);
  border: 1px solid var(--secondary-ink);
  border-radius: 50%;
}

#candidature .candidate-timeline > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(.5em + var(--space-2));
  bottom: -.5em;
  left: calc(-1 * var(--space-4) - .5px);
  width: 1px;
  background: var(--line);
}

#candidature .candidate-timeline-date {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.6;
  color: var(--secondary-ink);
  font-variant-numeric: tabular-nums;
}

#candidature .candidate-theme + .candidate-theme {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

/* Earlier stacking prevents narrow biography columns. No fixed text heights. */
@media (max-width: 900px) {
  #candidature .candidate-list::before { display: none; }
  #candidature .candidate-community {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
  }

  #candidature .candidate-community p {
    max-width: 62ch;
  }

  #candidature .candidate-list {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-12);
  }

  #candidature .candidate-visual {
    margin-bottom: var(--space-6);
  }

  #candidature .candidate-portrait {
    aspect-ratio: auto;
  }

  #candidature .candidate-profile:nth-child(2) .candidate-portrait img {
    width: 78%;
  }

  #candidature .candidate-profile:nth-child(2) .portrait-ring {
    left: 6%;
  }

  #candidature .candidate-words {
    gap: var(--space-2) var(--space-4);
  }

  #candidature .candidate-words-top {
    justify-content: flex-start;
    padding-block: var(--space-3) var(--space-4);
  }

  #candidature .candidate-words-bottom {
    padding-top: var(--space-5);
  }
}

@media (max-width: 380px) {
  #candidature .candidate-copy > h3 {
    font-size: clamp(1.75rem, 1.5rem + 1vw, 2rem);
  }

  #candidature .candidate-timeline {
    padding-left: var(--space-5);
  }
}

/* Match the existing appearance / accessibility controls without changing them. */
[data-theme="dark"] #candidature {
  --candidate-wash: color-mix(in srgb, var(--highlight) 6%, var(--paper));
  --candidate-lilac: color-mix(in srgb, var(--violet) 7%, var(--paper));
  --candidate-ring: color-mix(in srgb, var(--magenta) 70%, var(--paper));
  --candidate-ring-lilac: color-mix(in srgb, var(--violet) 75%, var(--paper));
}

[data-contrast="high"] #candidature {
  --candidate-wash: var(--paper);
  --candidate-lilac: var(--paper);
  --candidate-ring: var(--line);
  --candidate-ring-lilac: var(--line);
  background-image: none;
}

[data-contrast="high"] #candidature .candidate-biography,
[data-contrast="high"] #candidature .candidate-theme + .candidate-theme {
  border-color: var(--ink);
}

[data-motion="reduced"] #candidature *,
[data-motion="reduced"] #candidature *::before,
[data-motion="reduced"] #candidature *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  #candidature *,
  #candidature *::before,
  #candidature *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  #candidature {
    background: Canvas;
    color: CanvasText;
  }

  #candidature .portrait-ring,
  #candidature .candidate-words > li::before,
  #candidature .candidate-words > li::after {
    display: none;
  }

  #candidature :is(h2, h3, h4, p, .candidate-words) {
    color: CanvasText;
  }

  #candidature .source-link {
    color: LinkText;
  }

  #candidature .candidate-biography > summary {
    color: ButtonText;
  }

  #candidature .candidate-biography,
  #candidature .candidate-theme + .candidate-theme,
  #candidature .candidate-timeline > li::before {
    border-color: CanvasText;
  }

  #candidature .candidate-timeline > li::after {
    background: CanvasText;
  }

  #candidature :is(summary, a):focus-visible {
    outline-color: Highlight;
  }
}

@media print {
  #candidature {
    background: transparent;
  }

  #candidature .portrait-ring {
    display: none;
  }

  #candidature .candidate-portrait,
  #candidature .candidate-timeline > li,
  #candidature .candidate-theme {
    break-inside: avoid;
  }
}

/* Stessa dimensione per le nuove card quadrate, anche su mobile. */
#candidature .candidate-profile:nth-child(2) .candidate-portrait img {
  width: 100%;
  height: auto;
  margin: 0;
}
