/*
 * Scarecrow default theme, derived from anticap.makersfield.co.
 * Colours, font and tilt come from custom properties set per petition
 * (petition.json -> branding), so a re-skin never touches this file.
 */

:root {
  --sc-bg: #000;
  --sc-fg: #f60;
  --sc-accent: #f60;
  --sc-on-accent: #000;
  --sc-error-bg: #300;
  --sc-focus: #f60;
  --sc-font: system-ui, sans-serif;
  --sc-tilt: 1;
  --sc-measure: 900px;
  --sc-gutter: 1.5rem;
  --sc-border: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  background: var(--sc-bg);
  color: var(--sc-fg);
  font-family: var(--sc-font);
  font-size: 1.125rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.wrap {
  max-width: var(--sc-measure);
  margin: 0 auto;
  padding-left: var(--sc-gutter);
  padding-right: var(--sc-gutter);
}

/* ---- Type ------------------------------------------------------------ */

h1, h2, h3 { font-weight: 700; line-height: 1.2; }
h1 {
  font-size: 2.25rem;
  margin: 2rem 0 1.5rem;
  transform: rotate(calc(var(--sc-tilt) * -0.5deg));
}
h2 {
  font-size: 1.75rem;
  margin: 2.5rem 0 1rem;
}
h3 { font-size: 1.35rem; margin-bottom: 0.75rem; }
p, ul, ol, table { margin-bottom: 1.25rem; }
ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }
strong { font-weight: 700; }

a {
  color: var(--sc-fg);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 4px; }

.pitch { font-size: 1.3rem; font-weight: 700; }
.small, .hint, .counter { font-size: 1rem; }

/* Zine tilts, one per section. Set tilt to false in petition.json to flatten. */
.petition-text h2:nth-of-type(odd) { transform: rotate(calc(var(--sc-tilt) * 0.6deg)); }
.petition-text h2:nth-of-type(even) { transform: rotate(calc(var(--sc-tilt) * -0.7deg)); }

/* ---- Focus: always visible, never colour alone ------------------------ */

:focus-visible {
  outline: 3px solid var(--sc-focus);
  outline-offset: 3px;
}
main:focus, section:focus { outline: none; }

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -10rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--sc-accent);
  color: var(--sc-on-accent);
  font-weight: 700;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Header and footer ----------------------------------------------- */

.site-header { border-bottom: 2px solid var(--sc-fg); }
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.nav ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; list-style: none; padding: 0; margin: 0; }
.nav li { margin: 0; }
.nav a {
  display: inline-block;
  padding: 0.5rem 0;
  font-weight: 700;
  text-decoration: none;
}
.nav a[aria-current] { text-decoration: underline; }
.nav-brand { font-size: 1.25rem; margin-right: auto; }
.lang-switch { width: 100%; }

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 2px solid var(--sc-fg);
  text-align: center;
  font-size: 1rem;
}
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 1.5rem; }
.site-footer a { display: inline-block; padding: 0.5rem 0; }

/* ---- Boxes ------------------------------------------------------------ */

.box {
  border: var(--sc-border) solid var(--sc-fg);
  padding: 1.25rem;
  margin: 2rem 0;
}
.box > :last-child, .error-summary > :last-child { margin-bottom: 0; }
.count { transform: rotate(calc(var(--sc-tilt) * 0.6deg)); }
.count-line { font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.privacy-note { transform: rotate(calc(var(--sc-tilt) * -0.3deg)); }
.privacy-note ul { list-style: none; padding: 0; }
.privacy-note li { position: relative; padding-left: 1.25rem; }
.privacy-note li::before { content: "•"; position: absolute; left: 0; font-weight: 700; }
.share { transform: rotate(calc(var(--sc-tilt) * -0.4deg)); }
.share-url { font-size: 1.2rem; font-weight: 700; }

/* ---- Buttons ---------------------------------------------------------- */

.button, .button-link {
  display: inline-block;
  min-height: 3rem;
  padding: 0.75rem 2rem;
  border: 0;
  background: var(--sc-accent);
  color: var(--sc-on-accent);
  font: inherit;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.4;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.button { width: 100%; }
.button:disabled { opacity: 0.6; cursor: wait; }

/* ---- Form ------------------------------------------------------------- */

.sign { scroll-margin-top: 1rem; }
.sign-form { margin-top: 1.5rem; }
.field { margin: 0 0 1.5rem; }
.field label, .field legend {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.field .hint { margin-bottom: 0.5rem; }

input[type="text"], input[type="email"], textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--sc-fg);
  border-radius: 0;
  background: var(--sc-bg);
  color: var(--sc-fg);
  font: inherit;
  font-size: 1.125rem; /* 18px: no zoom-on-focus on iOS */
  -webkit-appearance: none;
  appearance: none;
}
textarea { min-height: 7rem; resize: vertical; }
.input-zip { max-width: 10rem; }

fieldset.field { border: 0; }
.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.choice input {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.2rem;
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-content: center;
  border: 2px solid var(--sc-fg);
  background: var(--sc-bg);
  cursor: pointer;
}
.choice input[type="radio"] { border-radius: 50%; }
.choice input::before {
  content: "";
  width: 1rem;
  height: 1rem;
  transform: scale(0);
  background: var(--sc-accent);
}
.choice input[type="radio"]::before { border-radius: 50%; }
.choice input[type="checkbox"]::before { clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.choice input:checked::before { transform: scale(1); }
.has-error .choice input { border-width: 4px; }
.choice label { font-weight: 400; margin: 0; padding: 0.25rem 0; cursor: pointer; }
.opt-in { flex-wrap: wrap; }
.opt-in label { font-weight: 700; flex: 1; }
.opt-in .hint { flex-basis: 100%; padding-left: 2.5rem; }

/* Errors: a thicker border plus a text message, so it's never colour alone. */
.has-error input[type="text"], .has-error input[type="email"], .has-error textarea {
  border-width: 4px;
}
.error-message {
  font-weight: 700;
  background: var(--sc-error-bg);
  border-left: 4px solid var(--sc-fg);
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
}
.error-summary {
  background: var(--sc-error-bg);
  border: 4px solid var(--sc-fg);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.error-summary a { font-weight: 700; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pow-status { min-height: 1.7em; margin-top: 0.75rem; }
.counter { margin-top: 0.25rem; }

/* ---- Tables ----------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--sc-fg); vertical-align: top; }
thead th { border-bottom-width: 2px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.names { list-style: none; padding: 0; columns: 2 12rem; }

/* ---- Longer pages ----------------------------------------------------- */

.prose h1 { margin-top: 2rem; }
.prose h2 { font-size: 1.5rem; margin-top: 2rem; }
.message-page { padding-top: 1rem; }

/* ---- Larger screens --------------------------------------------------- */

@media (min-width: 40em) {
  :root { --sc-gutter: 3rem; }
  body { font-size: 1.25rem; }
  h1 { font-size: 3.5rem; margin-top: 3rem; }
  h2 { font-size: 2.25rem; }
  .box, .error-summary { padding: 2rem; }
  .field-row { display: flex; gap: 1rem; }
  .field-row > .field { flex: 1; }
  .field-row > .field:has(.input-zip) { flex: 0 0 10rem; }
  .button { width: auto; }
  .lang-switch { width: auto; }
}

/* Hover wiggle from the AC3 site, only for people who don't mind motion. */
@media (prefers-reduced-motion: no-preference) {
  .button, .button-link, .nav a { transition: transform 0.1s; }
  .button:hover:not(:disabled), .button-link:hover { transform: rotate(-2deg) scale(1.05); }
  .nav a:hover { transform: rotate(-2deg) scale(1.1); }
}

@media (forced-colors: active) {
  .button, .button-link { border: 2px solid ButtonText; }
  .error-message, .error-summary { border-color: CanvasText; }
  .choice input { border-color: CanvasText; }
  .choice input::before { background: CanvasText; }
}

@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .sign-form, .button-link { display: none; }
  * { transform: none !important; }
}
