/* Accessible, mobile-first styling for older / low-confidence users:
   large text, high contrast, generous spacing, big tap targets. */

:root {
  --bg: #f7f6f2;
  --card: #ffffff;
  --ink: #1c1c1c;
  --muted: #4a4a4a;
  --line: #c9c9c4;
  --accent: #1f5e3a; /* deep green, strong contrast on white */
  --accent-ink: #ffffff;
  --accent-dark: #16472b;
  --focus: #0b5cad;
  --warn: #8a2b06;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 112.5%; /* ~18px base */
  /* Keep anchor jumps (e.g. the "Skip to content" link) clear of the sticky header. */
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.55;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 30; /* above the sticky header so it stays visible when focused */
}
.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  position: sticky; /* keeps the title + "Learn about the project" reachable while scrolling */
  top: 0;
  z-index: 20; /* above page content, below the skip-link (30) and the Learn overlay (50) */
}
.site-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

/* A quiet outlined button in the header bar that opens the reference layer. */
.learn-trigger {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-ink);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  min-height: 44px;
  cursor: pointer;
}
.learn-trigger:hover {
  background: rgba(255, 255, 255, 0.12);
}
.learn-trigger:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
h2 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.5rem;
}

.intro,
.nudge {
  color: var(--muted);
  margin-top: 0;
}
.nudge {
  background: #eef4ee;
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 6px;
}

/* ---- Body copy with inline links ---- */
.body-copy p {
  color: var(--muted);
  margin: 0 0 0.85rem;
}
.body-copy p:last-child {
  margin-bottom: 0;
}
.body-copy a {
  color: var(--focus);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.body-copy a:hover {
  text-decoration-thickness: 2px;
}
.body-copy a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Form fields ---- */
.field {
  margin: 0 0 1.6rem;
  border: 0;
  padding: 0;
}
.field-label,
legend.field-label {
  display: block;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  padding: 0;
}
.field-help {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.optional-tag {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.9rem;
}

input[type="text"],
textarea {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.75rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
textarea {
  resize: vertical;
}
input[type="text"]:focus,
textarea:focus,
.option:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

/* Radio / checkbox options rendered as large tappable rows */
.options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  min-height: 44px;
}
.option input {
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.1rem;
  flex: 0 0 auto;
}
.option:has(input:checked) {
  border-color: var(--accent);
  background: #eef4ee;
}
.option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.option-text {
  font-size: 1.05rem;
}
.option-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.style-paste {
  margin-top: 0.8rem;
}
.style-paste label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  padding: 0.8rem 1.2rem;
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-big {
  font-size: 1.15rem;
  padding: 0.95rem 1.4rem;
}
.btn-hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
}
.btn-secondary {
  background: #fff;
  color: var(--accent-dark);
  border-color: var(--accent);
}
.btn-secondary:hover {
  background: #eef4ee;
}
.btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
  align-items: center;
}

/* ---- Draft + word count ---- */
.draft-box {
  font-size: 1.1rem;
  line-height: 1.6;
  min-height: 16rem;
}
.word-count {
  font-weight: 700;
  margin: 0.4rem 0 0;
}
.word-count.over {
  color: var(--warn);
}

.send-steps {
  padding-left: 1.3rem;
}
.send-steps li {
  margin-bottom: 0.45rem;
}

.details {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}
.details summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0.5rem 0;
}
.subject-line {
  background: #f1f1ec;
  padding: 0.7rem 0.8rem;
  border-radius: 6px;
  word-break: break-word;
}
.live-note {
  color: var(--muted);
}

/* ---- Status / loading ---- */
.status {
  margin: 0 0 1rem;
  padding: 0;
  font-weight: 700;
}
.status.show {
  padding: 0.85rem 1rem;
  border-radius: 8px;
}
.status.loading {
  background: #eaf1f7;
  color: #0b3a63;
}
.status.error {
  background: #fbeae5;
  color: var(--warn);
}

.site-footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.app-version {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  opacity: 0.75;
}
.length-hint {
  margin: 0;
}

/* Honeypot — kept out of view and out of the tab order */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- "Learn about the project" slide-over ---- */
/* Full-screen panel that slides in from the right over the form. One obvious exit
   (the back arrow), full reading width, no swipe gesture to discover. */
.learn-open {
  overflow: hidden; /* lock the background while the panel is open */
}
.learn-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
}
.learn-overlay[hidden] {
  display: none;
}
.learn-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: learn-slide-in 0.22s ease-out;
}
@keyframes learn-slide-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.learn-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  flex: 0 0 auto;
}
.learn-back {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-ink);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
}
.learn-back:hover {
  background: rgba(255, 255, 255, 0.12);
}
.learn-back:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.learn-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.learn-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* No top padding: the sticky tabs pin flush under the bar. The intro carries
     the top spacing instead (below), so nothing peeks above the pinned tabs. */
  padding: 0 1rem 2.5rem;
  max-width: 44rem;
  width: 100%;
  margin: 0 auto;
}
.learn-intro {
  color: var(--muted);
  margin: 1.25rem 0;
}

/* Tabs */
.learn-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  position: sticky; /* keep the tabs reachable while scrolling the content */
  top: 0;
  z-index: 1; /* paint above the content blocks that follow in the DOM */
  background: var(--bg); /* solid, so scrolling content doesn't show through */
}
.learn-tab {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  cursor: pointer;
}
.learn-tab[aria-selected="true"] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}
.learn-tab:hover {
  color: var(--accent-dark);
}
.learn-tab:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.learn-tabpanel:focus-visible {
  outline: none;
}

/* Content blocks */
.learn-h {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.5rem;
}
.learn-h:first-child {
  margin-top: 0;
}
.learn-p {
  margin: 0 0 0.85rem;
}
.learn-list {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.learn-list li {
  margin-bottom: 0.5rem;
}
.learn-qa {
  border-left: 4px solid var(--line);
  padding: 0.1rem 0 0.1rem 0.9rem;
  margin: 0 0 1.1rem;
}
.learn-q {
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.learn-a {
  margin: 0;
  color: var(--muted);
}
.learn-note {
  background: #eef4ee;
  border-left: 4px solid var(--accent);
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin: 0 0 1.1rem;
  color: var(--muted);
}
.learn-figure {
  margin: 0 0 1.25rem;
}
.learn-video,
.learn-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #000;
}
.learn-caption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}
.learn-more {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

/* Links inside the panel match the body-copy link treatment. */
.learn-body a {
  color: var(--focus);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.learn-body a:hover {
  text-decoration-thickness: 2px;
}
.learn-body a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
  .learn-panel {
    animation: none;
  }
}

/* ---- Redirect interstitial (public/redirect.html) ---- */
.redirect-main {
  max-width: 40rem;
}
.redirect-reminder {
  background: #fdecea;
  border: 2px solid #b3261e;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin: 0 0 1.5rem;
}
.redirect-reminder-text {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
}
.redirect-reminder-text strong {
  font-weight: 800;
}

/* Countdown CTA: the whole button is a progress bar that recedes over 10s.
   The track (button background) is the darker green; the fill is the lighter
   green with a bright leading edge, so the receding boundary is easy to see.
   White label reads clearly on both greens. */
.countdown-btn {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  text-align: center;
  color: var(--accent-ink);
  background: var(--accent-dark);
  border: 2px solid var(--accent);
  border-radius: 10px;
  min-height: 56px;
  padding: 1rem 1.2rem;
  cursor: pointer;
}
.countdown-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
  /* Leading edge: a near-black green line that advances left to right. */
  border-right: 3px solid #06160d;
  z-index: 0;
}
.countdown-label {
  position: relative;
  z-index: 1;
}
.countdown-btn:hover {
  background: #0f3a22;
}
.countdown-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.countdown-btn[disabled] {
  opacity: 0.7;
  cursor: default;
}
.countdown-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.6rem 0 0;
  text-align: center;
}
