/* Street signage palette: sidewalk, sign face, asphalt, curb paint, regulatory red, bike lane */
:root {
  --sidewalk: #E9EBE7;
  --sign: #FFFFFF;
  --asphalt: #23292D;
  --asphalt-soft: #4E585E;
  --line: #C3C9C4;
  --curb: #F2C000;
  --stop: #B3261E;
  --stop-wash: #FBEAE8;
  --bikelane: #2E7D4F;
  --bikelane-wash: #E5F2EA;

  --font: 'Overpass', 'Helvetica Neue', Arial, sans-serif;

  /* Height of the on-screen keyboard, set from app.js via visualViewport */
  --keyboard: 0px;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 24px;
  scroll-padding-bottom: calc(24px + var(--keyboard));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--sidewalk);
  color: var(--asphalt);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Extra room so fields near the bottom can scroll above the keyboard */
  padding-bottom: var(--keyboard);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Test-mode banner: barricade stripes, in the document flow so it never overlaps the form */
.dry-run-banner {
  padding: 10px 16px;
  background: var(--curb);
  border-bottom: 6px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--asphalt) 0 10px, var(--curb) 10px 20px) 6;
  color: var(--asphalt);
  font-weight: 800;
  text-align: center;
}

.page {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
}

/* Header */
.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 24px;
}

.masthead-sign {
  flex: none;
  width: 52px;
  height: 52px;
  color: var(--stop);
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.masthead-sub {
  margin: 4px 0 0;
  color: var(--asphalt-soft);
  font-size: 0.94rem;
}

h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}

h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 800;
}

.hint {
  margin: 0 0 16px;
  color: var(--asphalt-soft);
  font-size: 0.94rem;
  line-height: 1.45;
}

/* Photo picker: the first and biggest thing on the page */
.photo-picker {
  position: relative;
  display: block;
  margin-bottom: 24px;
  border: 3px dashed var(--asphalt);
  border-radius: 8px;
  background: var(--sign);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.photo-picker:focus-within {
  outline: 4px solid var(--curb);
  outline-offset: 2px;
}

.photo-picker.has-photo {
  border-style: solid;
}

.photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 28px 20px;
  text-align: center;
}

.has-photo .photo-empty {
  display: none;
}

.photo-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
}

.photo-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.photo-hint {
  margin-top: 2px;
  color: var(--asphalt-soft);
  font-size: 0.94rem;
}

.photo-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--asphalt);
}

.photo-change {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 12px 4px;
  border-radius: 6px;
  background: var(--asphalt);
  color: var(--sign);
  font-size: 0.88rem;
  font-weight: 600;
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  min-width: 0;
}

label {
  margin-bottom: 6px;
  font-size: 0.94rem;
  font-weight: 600;
}

.optional {
  color: var(--asphalt-soft);
  font-weight: 400;
}

input[type="text"],
input[type="tel"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--sign);
  color: var(--asphalt);
  font-family: inherit;
  /* 17px keeps iOS from zooming on focus */
  font-size: 17px;
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
}

select {
  padding-right: 44px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2323292D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

input::placeholder,
textarea::placeholder {
  color: #858D88;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--asphalt-soft);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--asphalt);
  box-shadow: 0 0 0 4px var(--curb);
}

.reporter {
  margin: 8px 0 8px;
  padding: 0;
  border: 0;
}

.reporter legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 1.05rem;
  font-weight: 800;
}

/* Buttons */
button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.button-primary {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 16px 20px 13px;
  border: 0;
  border-radius: 6px;
  background: var(--asphalt);
  color: var(--sign);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.button-primary:hover {
  background: #343C41;
}

.button-primary:active {
  background: #000;
}

.button-quiet {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 12px 20px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--asphalt);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

button:focus-visible {
  outline: 4px solid var(--curb);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status line */
#result {
  display: none;
  margin-top: 16px;
  padding: 14px 16px 12px;
  border-left: 6px solid var(--asphalt);
  border-radius: 4px;
  background: var(--sign);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#result:not(:empty) {
  display: block;
}

#result[data-kind="progress"]::before {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 10px;
  border: 3px solid var(--line);
  border-top-color: var(--asphalt);
  border-radius: 50%;
  vertical-align: -0.05em;
  animation: spin 0.8s linear infinite;
}

#result[data-kind="error"] {
  border-left-color: var(--stop);
  background: var(--stop-wash);
  color: #7A1A14;
}

#result[data-kind="success"] {
  border-left-color: var(--bikelane);
  background: var(--bikelane-wash);
  color: #1D5434;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* Steps that appear after the form, in page flow so the keyboard can scroll them */
.step {
  margin-top: 20px;
  padding: 20px 16px;
  border: 2px solid var(--asphalt);
  border-radius: 8px;
  background: var(--sign);
}

.step > h2 + label {
  display: block;
  margin-top: 12px;
}

.review-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  margin: 12px 0 16px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--asphalt);
}

.coords {
  margin: 6px 0 16px;
  color: var(--asphalt-soft);
  font-size: 0.88rem;
}

.step .coords + .button-primary {
  margin-top: 20px;
}

.review-group {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.review-group .field:last-child {
  margin-bottom: 0;
}

.review-group .review-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  margin: 12px 0 16px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--asphalt);
}

.coords {
  margin-bottom: 0;
}

.review-value {
  margin: 0 0 12px;
  font-weight: 600;
}

.review-value:last-child {
  margin-bottom: 0;
}

#confirmName:empty::before,
#confirmPhone:empty::before {
  content: "Not provided";
  color: var(--asphalt-soft);
  font-weight: 400;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.review-actions {
  margin-top: 24px;
}

/* License plate: the one loud element. Both halves are plain, always-editable inputs. */
.plate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 340px;
  margin: 0 auto 4px;
  padding: 10px 14px 12px;
  border: 3px solid var(--asphalt);
  border-radius: 14px;
  background:
    radial-gradient(circle at 18px 18px, var(--asphalt) 3px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 18px) 18px, var(--asphalt) 3px, transparent 3.5px),
    var(--sign);
  box-shadow: inset 0 0 0 4px var(--sign), inset 0 0 0 6px var(--curb);
}

.plate input[type="text"] {
  min-height: 0;
  border: 2px solid transparent;
  background: transparent;
  text-align: center;
  text-transform: uppercase;
}

.plate input[type="text"]:hover {
  border-color: var(--line);
}

.plate input[type="text"]:focus {
  border-color: var(--asphalt);
  box-shadow: 0 0 0 3px var(--curb);
}

.plate .plate-state {
  width: 60%;
  margin: 0 auto;
  padding: 4px 8px 2px;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--stop);
}

.plate .plate-number {
  padding: 2px 8px 0;
  font-size: clamp(2rem, 11vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.plate-number::placeholder,
.plate-state::placeholder {
  color: #A7AEA9;
  letter-spacing: 0.04em;
  text-transform: none;
}

.plate-number::placeholder {
  font-size: 1.4rem;
}

/* Callouts inside a step: curb-yellow caution, or regulatory red for errors */
.notice {
  margin: 0 0 16px;
  padding: 10px 12px 8px;
  border-left: 6px solid var(--curb);
  border-radius: 4px;
  background: #FFF8D9;
  font-size: 0.94rem;
  line-height: 1.45;
}

.notice-error {
  border-left-color: var(--stop);
  background: var(--stop-wash);
  color: #7A1A14;
  font-weight: 600;
}

/* "Call it in yourself" link under the passcode field */
.step-alternative {
  margin: 16px 0 0;
  color: var(--asphalt-soft);
  font-size: 0.94rem;
  text-align: center;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--asphalt);
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Call script */
.call-script-dial {
  margin: 12px 0 4px;
  text-align: center;
  text-decoration: none;
  font-size: 1.25rem;
}

.call-steps {
  margin: 0;
  padding-left: 1.3em;
}

.call-steps li {
  margin-bottom: 8px;
}

.call-steps li:last-child {
  margin-bottom: 0;
}

.call-script-text {
  margin: 0;
  padding: 14px 16px 12px;
  border-left: 6px solid var(--curb);
  border-radius: 4px;
  background: var(--sidewalk);
  font-size: 1.1rem;
  line-height: 1.6;
  white-space: pre-line;
}

.notice-text {
  margin: 0;
}

.notice-action {
  margin: 4px 0 0;
  padding-left: 0;
  padding-right: 0;
  text-align: left;
}

/* Outcome: bike-lane green check when the report is done */
.outcome-sign {
  display: block;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  color: var(--bikelane);
}

#outcomeHeading:focus {
  outline: none;
}

.outcome-text {
  margin: 8px 0 0;
  line-height: 1.45;
}

.outcome-close {
  margin: 16px 0 0;
  padding: 12px 14px 10px;
  border-left: 6px solid var(--bikelane);
  border-radius: 4px;
  background: var(--bikelane-wash);
  color: #1D5434;
  font-weight: 600;
}

/* Footer holds the Ko-fi button in normal flow so it never covers inputs */
.page-footer {
  display: flex;
  justify-content: center;
  padding: 8px 16px max(24px, env(safe-area-inset-bottom));
}

@media (max-width: 359px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  h1 {
    font-size: 1.5rem;
  }
}

@media (min-width: 600px) {
  .page {
    padding-top: 48px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .step {
    padding: 24px;
  }

  .photo-empty {
    min-height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #result[data-kind="progress"]::before {
    animation: none;
    border-top-color: var(--line);
    border-color: var(--asphalt);
  }

  html {
    scroll-behavior: auto;
  }
}
