/* Open letters: the letter page (/news/<slug>, served from posts/) and its
   teaser card for the news page. Loaded only by those pages; builds on site.css. */

/* .btn sets display, which beats the [hidden] attribute; the letter page
   hides its CTA and "Show all" buttons with it. */
.btn[hidden] { display: none; }

/* ---------- Hero ---------- */
.letter-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: 32px;
}
.page-hero .letter-hero-count { margin: 0; font-size: 17px; opacity: 1; }
.letter-hero-count strong { color: var(--js-green); font-size: 22px; }
/* Title beside the photo, then the at-a-glance summary and the call to
   action across the full width. On narrow screens the photo drops to the
   end so the summary is the first thing read. */
.letter-hero.page-hero-split .page-hero-inner {
  grid-template-columns: 1.15fr 1fr;
  grid-template-areas: "text photo" "summary summary" "actions actions";
  gap: 48px 56px;
}
.letter-hero-text { grid-area: text; }
.letter-hero-text p { margin: 0; }
.letter-hero-figure { grid-area: photo; margin: 0; }
.letter-hero .letter-hero-actions { grid-area: actions; margin-top: 0; }
/* Licence credit under the photo (CC BY-SA requires it). */
.letter-hero-figure figcaption {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}
.letter-hero-figure figcaption a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* Without a photo the hero stacks: title, summary, call to action. */
.letter-hero:not(.page-hero-split) .letter-summary { margin: 40px 0 32px; }

.letter-summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: rgba(255, 255, 255, 0.07);
  border-top: 4px solid var(--js-green);
}
.letter-summary-col { padding: 32px 36px 36px; }
.letter-summary-col + .letter-summary-col { border-left: 1px solid rgba(255, 255, 255, 0.14); }
.letter-summary h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: var(--tracking-tight);
  color: #fff;
}
.letter-summary ul { list-style: none; margin: 0; padding: 0; }
.letter-summary li {
  position: relative;
  margin: 0;
  padding-left: 26px;
  font-size: 17px;
  line-height: 1.55;
  color: #fff;
}
.letter-summary li + li { margin-top: 12px; }
.letter-summary li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 10px;
  height: 10px;
  background: var(--js-green);
}
/* The ask: arrows instead of squares. */
.letter-summary-ask li::before {
  width: 12px;
  height: 12px;
  top: 0.5em;
  background: none;
  border-top: 3px solid var(--js-green);
  border-right: 3px solid var(--js-green);
  transform: rotate(45deg);
  left: -2px;
}
.letter-hero-photo {
  display: block;
  width: 100%;
  height: auto;
  border-top: 4px solid var(--js-green);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

/* ---------- Letter ---------- */
.letter-section {
  background: var(--bg-2);
  padding: 80px 48px 96px;
}

.letter {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  padding: 56px 64px 64px;
  box-shadow: 0 1px 2px rgba(58, 46, 85, 0.06), 0 12px 32px rgba(58, 46, 85, 0.08);
}
.letter p {
  margin: 0 0 1em;
  font-size: 17px;
  line-height: 1.65;
  color: var(--js-purple);
}
.letter a { color: var(--js-purple); text-underline-offset: 3px; overflow-wrap: anywhere; }
.letter-to {
  margin: 0 0 28px;
  font-style: normal;
  font-size: 17px;
  line-height: 1.55;
  color: var(--js-purple);
}
.letter .letter-signoff { margin: 40px 0 8px; }
.letter .letter-signature {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
}
.letter .letter-role { margin: 0 0 16px; color: var(--js-purple-300); }
.letter .letter-cosigners { margin: 0; color: var(--js-purple-300); font-style: italic; }
/* The co-signatories' names sit in the letter, under John's signature. */
.letter .signatory-list { margin: 24px 0 0; }
.letter #signatory-more { margin-top: 24px; }
.letter .signatory-unnamed { margin: 24px 0 0; font-size: 16px; }

/* ---------- Signing form ---------- */
.letter-sign { margin: 0; }
.letter-form { border: 1px solid var(--js-purple-050); box-shadow: 0 12px 32px rgba(58, 46, 85, 0.08); }
.letter-form h3 {
  margin: 6px 0 4px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
  color: var(--js-purple);
}
.letter-form-lead { margin: 0; font-size: 15px; line-height: 1.5; color: var(--js-purple-300); }
.field-hint { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--js-purple-300); }

/* Publish / don't-publish choice. */
.field-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.field-choice legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--js-purple-300);
}
/* The option labels and radios sit inside .field, so undo the caps label
   style and full-width text-input style site.css gives .field children. */
.field-choice .choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--js-grey-300);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  color: var(--js-purple);
  cursor: pointer;
}
.field-choice .choice + .choice { margin-top: 8px; }
.field-choice .choice:has(input:checked) { border-color: var(--js-green); background: rgba(20, 200, 120, 0.06); }
.field-choice input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  padding: 0;
  border: 0;
  -webkit-appearance: auto;
          appearance: auto;
  accent-color: var(--js-green);
  cursor: pointer;
}
.field-choice.has-error .choice { border-color: #c0392b; }
.field-choice.has-error legend { color: #c0392b; }

.letter-thanks { display: flex; flex-direction: column; gap: 12px; outline: none; }
.letter-thanks h3 { margin: 0; }
.letter-thanks .article-share { align-self: flex-start; margin: 4px 0 0; }

/* ---------- Signatories ---------- */
.letter-signatories { background: #fff; padding: 80px 48px 96px; }
.letter-signatories-inner { max-width: 820px; margin: 0 auto; }
.letter-signatories h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 3vw, 36px);
  letter-spacing: var(--tracking-tight);
  color: var(--js-purple);
}
.letter-signatories-intro { margin: 0 0 32px; font-size: 17px; line-height: 1.6; color: var(--js-purple); }
.signatory-list {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  columns: 2 240px;
  column-gap: 48px;
}
.signatory-list li {
  break-inside: avoid;
  padding: 10px 0;
  border-bottom: 1px solid var(--js-purple-050);
}
.sig-name { display: block; font-weight: 600; color: var(--js-purple); }
.sig-ward { display: block; font-size: 13px; color: var(--js-purple-300); }
/* Signers who chose not to be named: counted in one line, never listed.
   A soft mint pill with an "eye off" icon. */
.signatory-unnamed {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 14px 20px 14px 14px;
  border: 1px solid var(--js-green-100);
  border-radius: 14px;
  background: #f1fbf6;
  font-size: 16px;
  line-height: 1.5;
  color: var(--js-purple);
}
.signatory-unnamed[hidden] { display: none; }
.signatory-unnamed-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--js-green-100);
  color: var(--js-green-700);
}

/* ---------- News-page teaser ---------- */
.letter-feature {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 56px;
  padding: 40px 44px;
  background: var(--js-purple);
  border-top: 4px solid var(--js-green);
  color: #fff;
  text-decoration: none;
}
.letter-feature h3 {
  margin: 8px 0 10px;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
  color: #fff;
}
.letter-feature p { margin: 0; max-width: 620px; font-size: 16px; line-height: 1.55; opacity: 0.85; }
.letter-feature-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; flex-shrink: 0; }
.letter-feature-count { font-size: 15px; white-space: nowrap; }
.letter-feature-count strong { color: var(--js-green); font-size: 24px; }
@media (hover: hover) {
  .letter-feature:hover .btn { filter: brightness(1.06); }
}
/* On the news page the card is the section's only content. Purple text on
   the green button: white on this green fails contrast (WCAG 1.4.3). */
.news .letter-feature { margin-bottom: 0; }
.letter-feature .btn-accent,
.letter-hero .btn-accent { color: var(--js-purple); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .letter-hero.page-hero-split .page-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "text" "summary" "actions" "photo";
    gap: 32px;
  }
  .letter-hero-figure { max-width: 640px; }
  .letter-summary { grid-template-columns: minmax(0, 1fr); }
  .letter-summary-col + .letter-summary-col { border-left: 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
}
@media (max-width: 720px) {
  .letter-section { padding: 32px 16px 56px; }
  .letter-summary-col { padding: 24px 20px 28px; }
  .letter-summary h2 { font-size: 20px; }
  .letter-summary li { font-size: 16px; }
  .letter { padding: 32px 20px 40px; }
  .letter p, .letter-to { font-size: 16px; line-height: 1.7; }
  .letter-form { padding: 28px 20px; }
  .letter-signatories { padding: 48px 16px 64px; }
  .letter-feature { flex-direction: column; align-items: flex-start; padding: 28px 24px; gap: 20px; }
  .letter-feature-cta { align-items: flex-start; }
}

/* Contrast (WCAG 1.4.3): the brand green fails on white at text sizes, so
   the signing panel uses purple for its eyebrow, links and button, as the
   Royal Mail form does. */
.letter-form .eyebrow { color: var(--js-purple-300); }
.letter-form a { color: var(--js-purple); text-decoration: underline; text-underline-offset: 3px; }
