/* WeedPassport · local review room. Phone first; no external fonts, images or network assets. */

:root {
  --cream: #F2EBD9;
  --cream-deep: #E8DFC8;
  --paper: #FBF7EE;
  --forest: #1E3A2B;
  --forest-soft: #2F5240;
  --plum: #4E2340;
  --plum-soft: #F1E2EA;
  --lemon: #E4DC31;
  --ink: #1B231E;
  --muted: #55605A;
  --line: #CFC4A8;
  --radius: 14px;
  --radius-small: 10px;
  --touch: 44px;
  --gap: clamp(1rem, 3vw, 1.75rem);
  --font: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --focus: 0 0 0 3px var(--cream), 0 0 0 6px var(--plum);
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

img,
video {
  max-width: 100%;
}

a {
  color: var(--forest);
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

main:focus,
[tabindex="-1"]:focus {
  outline: none;
  box-shadow: none;
}

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

/* ---------------------------------------------------------------- skip link & masthead */

.skip {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 10;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-small);
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus,
.skip:focus-visible {
  top: 0.75rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: max(0.9rem, env(safe-area-inset-top)) max(1.1rem, env(safe-area-inset-right)) 0.9rem max(1.1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: block;
  width: clamp(9.5rem, 38vw, 13rem);
  height: auto;
}

.masthead-tag {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead .link-button {
  margin-left: auto;
}

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 0.5rem;
  border: 0;
  border-radius: var(--radius-small);
  background: none;
  color: var(--forest);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.link-button:hover {
  color: var(--plum);
}

/* ---------------------------------------------------------------- layout & type */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--gap) max(1.1rem, env(safe-area-inset-right)) calc(var(--gap) * 2) max(1.1rem, env(safe-area-inset-left));
}

.view {
  min-width: 0;
}

.hero {
  max-width: 40rem;
  padding-block: clamp(0.5rem, 4vw, 2.5rem);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.9rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--forest);
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.display {
  margin: 0 0 1rem;
  color: var(--forest);
  font-size: clamp(2.7rem, 9vw, 5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.display.small {
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.lede {
  margin: 0 0 1.5rem;
  max-width: 36rem;
  font-size: clamp(1.125rem, 2.6vw, 1.3rem);
  line-height: 1.5;
}

.fine {
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--plum);
  border-radius: var(--radius-small);
  background: var(--plum-soft);
  color: var(--plum);
  font-weight: 600;
}

.code {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 6px;
  background: var(--lemon);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
}

.intro-list {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.intro-list li {
  position: relative;
  margin: 0 0 0.75rem;
  padding-left: 1.6rem;
}

.intro-list li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.6em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--forest);
}

.section-title {
  margin: 2.25rem 0 0.75rem;
  color: var(--forest);
  font-size: 1.4rem;
  line-height: 1.2;
}

/* ---------------------------------------------------------------- cards & forms */

.card {
  padding: clamp(1.1rem, 3.5vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.login {
  display: grid;
  gap: 0.6rem;
  max-width: 26rem;
}

.login .button {
  margin-top: 0.4rem;
}

label,
legend {
  font-weight: 600;
  color: var(--ink);
}

input[type="text"],
input[type="password"],
textarea {
  display: block;
  width: 100%;
  min-height: var(--touch);
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 16px); /* avoid iOS zoom on focus */
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input[type="text"]:focus-visible,
input[type="password"]:focus-visible,
textarea:focus-visible {
  border-color: var(--forest);
}

input[aria-invalid="true"] {
  border-color: var(--plum);
}

.questions {
  display: grid;
  gap: 1.4rem;
  min-width: 0;
}

.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > label {
  display: block;
  margin-bottom: 0.4rem;
}

legend {
  float: left; /* lets the legend wrap and sit inside the fieldset flow */
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
}

legend + * {
  clear: both;
}

.req,
.opt {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.req {
  color: var(--plum);
}

.opt {
  color: var(--muted);
  font-weight: 600;
}

.hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field > .hint:last-child {
  margin: 0.4rem 0 0;
}

.counter {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.field-error {
  margin: 0.45rem 0 0;
  color: var(--plum);
  font-size: 0.92rem;
  font-weight: 700;
}

.field-error::before {
  content: "! ";
}

/* Radio scales: real inputs stay in the accessibility tree but are visually hidden;
   the visible label carries the hit area, focus ring and selected state. */

.scale,
.choices {
  display: grid;
  gap: 0.5rem;
}

.scale {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choices {
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
}

.choices.stack {
  grid-template-columns: 1fr;
}

.scale input,
.choices input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.scale label,
.choices label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: #fff;
  color: var(--forest);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.scale label {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.choices.stack label {
  justify-content: flex-start;
  text-align: left;
}

.scale label:hover,
.choices label:hover {
  border-color: var(--forest);
}

.scale input:checked + label,
.choices input:checked + label {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--cream);
}

.scale input:focus-visible + label,
.choices input:focus-visible + label {
  box-shadow: var(--focus);
}

.scale input[aria-invalid="true"] + label,
.choices input[aria-invalid="true"] + label {
  border-color: var(--plum);
}

/* ---------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--touch);
  padding: 0.65rem 1.35rem;
  border: 2px solid var(--forest);
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.button.primary {
  background: var(--forest);
  color: var(--cream);
}

.button.primary:hover {
  background: var(--forest-soft);
  border-color: var(--forest-soft);
}

.button.ghost {
  background: transparent;
  color: var(--forest);
}

.button.ghost:hover {
  background: var(--cream-deep);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.primary:disabled:hover {
  background: var(--forest);
  border-color: var(--forest);
}

.button.ghost:disabled:hover {
  background: transparent;
}

.hero > .button {
  margin-top: 0.5rem;
}

.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
}

.nav-buttons .button {
  flex: 1 1 9rem;
}

.questions > .fine {
  margin: -0.5rem 0 0;
}

[aria-busy="true"] {
  cursor: progress;
}

/* ---------------------------------------------------------------- progress steps */

.steps {
  margin: 0 calc(-1 * max(1.1rem, env(safe-area-inset-left))) 0.5rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.steps ol {
  display: flex;
  gap: 0.5rem;
  width: max-content;
  margin: 0;
  padding: 0.35rem max(1.1rem, env(safe-area-inset-left)) 0.6rem;
  list-style: none;
}

.steps li {
  scroll-snap-align: start;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 5.6rem;
  min-height: var(--touch);
  padding: 0.4rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper);
  color: var(--forest);
  font: inherit;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.step:hover {
  border-color: var(--forest);
}

.step-label {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-state {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.step.done {
  border-color: var(--forest);
}

.step.done .step-state {
  color: var(--forest);
  font-weight: 600;
}

.step.done .step-state::before {
  content: "✓ ";
}

.step.missing {
  border-style: dashed;
  border-color: var(--plum);
}

.step.missing .step-state {
  color: var(--plum);
  font-weight: 600;
}

.step.final-step {
  border-color: var(--plum);
}

.step[aria-current="step"] {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--cream);
}

.step[aria-current="step"] .step-state {
  color: var(--lemon);
}

.progress {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- screening */

.screening {
  display: grid;
  gap: var(--gap);
  min-width: 0;
}

.player {
  width: 100%;
  max-width: calc(65vh * 9 / 16);
  max-width: calc(65svh * 9 / 16);
  margin: 0 auto;
  min-width: 0;
}

.player video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  max-height: 65vh;
  max-height: 65svh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--forest);
}

.player figcaption {
  margin-top: 0.6rem;
  color: var(--forest);
  font-weight: 700;
  text-align: center;
}

.player .notice {
  aspect-ratio: 9 / 16;
  max-height: 65vh;
  max-height: 65svh;
  display: flex;
  align-items: center;
  margin: 0;
}

/* ---------------------------------------------------------------- final step & statuses */

.final {
  max-width: 44rem;
}

.summary-box {
  padding: 1rem 1.1rem;
  border: 2px solid var(--plum);
  border-radius: var(--radius-small);
  background: var(--plum-soft);
  color: var(--plum);
}

.summary-box p {
  margin: 0 0 0.4rem;
  font-weight: 700;
}

.summary-box ul {
  margin: 0;
  padding-left: 1.2rem;
}

.summary-box .link-button {
  padding: 0;
  color: var(--plum);
}

.status {
  min-height: 1.5em;
  margin: 0;
  font-weight: 600;
}

.status:empty {
  min-height: 0;
}

.status[data-kind="error"] {
  color: var(--plum);
}

.status[data-kind="pending"] {
  color: var(--muted);
}

.status[data-kind="success"] {
  color: var(--forest);
}

/* ---------------------------------------------------------------- admin */

.admin-head {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.admin-head .lede {
  margin-bottom: 0.75rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}

.table-wrap:focus-visible {
  box-shadow: var(--focus);
}

.results {
  width: 100%;
  min-width: 40rem;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.results caption {
  padding: 0.85rem 1rem 0.4rem;
  color: var(--forest);
  font-weight: 700;
  text-align: left;
}

.results th,
.results td {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.results thead th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.results tbody th {
  color: var(--forest);
  font-weight: 700;
}

.results tbody tr:nth-child(even) {
  background: rgba(30, 58, 43, 0.04);
}

.results tbody:empty::after {
  content: "Sin datos todavía.";
  display: block;
  padding: 0.8rem 1rem;
  color: var(--muted);
}

.comments {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.comments li {
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--forest);
  border-radius: var(--radius-small);
  background: var(--paper);
}

.comments li.empty {
  border-left-color: var(--line);
  color: var(--muted);
}

.comment-meta {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.comment-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- footer */

.footer {
  flex-shrink: 0;
  padding: 1rem max(1.1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1.1rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.footer p {
  margin: 0;
}

/* ---------------------------------------------------------------- larger screens */

@media (min-width: 900px) {
  .steps {
    margin-inline: 0;
  }

  .steps ol {
    padding-inline: 0;
  }

  .screening {
    grid-template-columns: minmax(0, calc(65vh * 9 / 16)) minmax(0, 1fr);
    align-items: start;
  }

  .player {
    position: sticky;
    top: 1rem;
    max-width: calc(65vh * 9 / 16);
    margin: 0;
  }

  .player video,
  .player .notice {
    max-height: 65vh;
  }
}

/* ---------------------------------------------------------------- preferences */

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

@media (forced-colors: active) {
  .scale input:checked + label,
  .choices input:checked + label,
  .step[aria-current="step"] {
    outline: 3px solid CanvasText;
  }

  .scale input:focus-visible + label,
  .choices input:focus-visible + label,
  :focus-visible {
    outline: 3px solid Highlight;
  }
}
