/* Tema neutro de CSIRTAmericas. Cada evento puede reemplazar los colores de :root y el logo con
   su propio tema (apps/events/theme.py), validado por contraste WCAG AA. Los botones llevan texto
   oscuro sobre el degradé de acento. Contraste verificado con axe-core (deploy/a11y/run.sh). */

@font-face {
  font-display: swap;
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 100 900;
  src: url("../brand/montserrat-latin-wght-normal.50b140b1e97d.woff2") format("woff2");
}

:root {
  --navy-deep: #0f1f3d;
  --navy: #142a52;
  --navy-ink: #0b1238;
  --teal: #1d4f7a;
  --green: #3fa9f5;
  --lime: #7fd1ff;
  --sky: #58b0fb;
  --cyan: #3fffff;
  --text: #ffffff;
  --muted: #c9d3f0;
  --link: #a8dcff;
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(88, 176, 251, 0.35);
  --band: linear-gradient(90deg, var(--green), var(--lime));
  color-scheme: dark;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  /* Color de base para la parte de una página larga que queda fuera del degradé fijo. */
  background: var(--navy);
  /* Sin esto, Chrome en Android agranda solo algunos bloques de texto según su largo y las opciones
     de varios renglones quedan con otro tamaño de letra que las de uno. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(ellipse 60% 35% at 50% 0%, rgba(63, 255, 255, 0.16), transparent 70%),
    linear-gradient(140deg, var(--navy-deep) 0%, var(--navy) 55%, var(--teal) 130%);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

main {
  margin: 0 auto;
  min-height: 100vh;
  padding: 1.25rem;
  width: min(100%, 42rem);
}

.brand {
  margin: 0 0 1rem;
}

.wordmark {
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  margin: 0;
  text-align: center;
  text-transform: uppercase;
}

.wordmark span {
  color: var(--sky);
}

.wordmark .wordmark-quiz {
  background: var(--band);
  border-radius: 0.3rem;
  color: var(--navy-ink);
  padding: 0 0.4rem;
}

.brand img {
  border-radius: 0.75rem;
  box-shadow: 0 0 2.5rem rgba(63, 255, 255, 0.18);
  display: block;
  height: auto;
  margin: 0 auto;
  width: min(100%, 20rem);
}

h1,
h2,
h3,
h4 {
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  margin: 0.5rem 0 1rem;
}

h1::after {
  background: var(--band);
  border-radius: 0.2rem;
  content: "";
  display: block;
  height: 0.3rem;
  margin-top: 0.5rem;
  width: 4.5rem;
}

h2 {
  color: var(--sky);
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

p,
li,
dd {
  color: var(--text);
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

section,
article,
details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  margin-block: 1rem;
  padding: 0.75rem 1rem;
}

button,
input,
select,
a.action {
  font: inherit;
  min-height: 44px;
}

button,
a.action {
  align-items: center;
  background: var(--band);
  border: 0;
  border-radius: 0.6rem;
  color: var(--navy-ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
  text-transform: uppercase;
}

button:hover,
a.action:hover {
  filter: brightness(1.08);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

input,
select {
  /* Campos claros: el ícono del calendario y los controles nativos se dibujan oscuros. */
  color-scheme: light;
  background: #ffffff;
  border: 2px solid var(--sky);
  border-radius: 0.5rem;
  color: var(--navy-ink);
  max-width: 100%;
  padding: 0.55rem;
  width: 100%;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--green);
  /* Dentro de la opción (flex) no debe achicarse cuando el texto ocupa varios renglones. */
  flex-shrink: 0;
  height: 1.4rem;
  margin: 0 0.6rem 0 0;
  min-height: 0;
  width: 1.4rem;
}

label:has(input[type="radio"]),
label:has(input[type="checkbox"]) {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  display: flex;
  min-height: 48px;
  padding: 0.5rem 0.75rem;
}

label:has(input:checked) {
  border-color: var(--lime);
  box-shadow: inset 0 0 0 1px var(--lime);
}

form,
details {
  margin-block: 1rem;
}

[role="alert"],
[role="status"] {
  background: rgba(140, 198, 63, 0.14);
  border-left: 0.3rem solid var(--lime);
  border-radius: 0.4rem;
  padding: 0.6rem 0.8rem;
}

/* Avisos tras guardar (templates/_messages.html): fondos sólidos oscuros con texto blanco y un ícono
   claro con texto navy, todos por encima de 7:1. Quedan pegados arriba al desplazarse. */
.flash-stack {
  display: grid;
  gap: 0.5rem;
  margin-block: 1rem;
  position: sticky;
  top: 0.5rem;
  z-index: 20;
}

.flash-stack .flash {
  --flash-accent: #7fd1ff;
  align-items: center;
  animation: flash-in 240ms ease-out;
  background: #12365f;
  border: 1px solid var(--flash-accent);
  border-left: 0.45rem solid var(--flash-accent);
  border-radius: 0.6rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
  color: #ffffff;
  display: flex;
  font-size: 1.1rem;
  font-weight: 600;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
}

.flash-stack .flash::before {
  align-items: center;
  background: var(--flash-accent);
  border-radius: 50%;
  color: var(--navy-ink);
  content: "i";
  display: inline-flex;
  flex: none;
  font-size: 1rem;
  font-weight: 800;
  height: 1.8rem;
  justify-content: center;
  width: 1.8rem;
}

.flash-stack .flash p {
  flex: 1;
  margin: 0;
}

.flash-stack .flash-success {
  --flash-accent: #5ee08f;
  background: #12402c;
}

.flash-stack .flash-success::before {
  content: "✓";
}

.flash-stack .flash-error {
  --flash-accent: #ff9b9b;
  background: #4d1620;
}

.flash-stack .flash-warning {
  --flash-accent: #ffc857;
  background: #4a3708;
}

.flash-stack .flash-error::before,
.flash-stack .flash-warning::before {
  content: "!";
}

.flash-stack .flash-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 0.5rem;
  color: #ffffff;
  flex: none;
  font-size: 1.4rem;
  line-height: 1;
  min-width: 44px;
  padding: 0;
}

.flash-stack .flash-close[hidden] {
  display: none;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flash-stack .flash {
    animation: none;
  }
}

button.danger {
  background: #ff9b9b;
  color: var(--navy-ink);
}

dl dt {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
}

dl dd {
  font-weight: 700;
  margin: 0 0 0.5rem;
}

main li > a {
  align-items: center;
  display: inline-flex;
  min-height: 44px;
  padding-inline: 0.25rem;
}

.language-switch {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  justify-content: flex-end;
  margin: 0 0 1rem;
}

.language-switch label {
  color: var(--muted);
  font-size: 0.85rem;
}

.language-switch select {
  width: auto;
}

.language-switch button {
  padding-inline: 0.8rem;
}

.band {
  background: var(--band);
  border-radius: 0.4rem;
  color: var(--navy-ink);
  display: inline-block;
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  text-transform: uppercase;
}

.qr {
  margin: 1.5rem auto;
  text-align: center;
}

.qr svg {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 0 3rem rgba(63, 255, 255, 0.25);
  display: block;
  height: auto;
  margin: 0 auto;
  padding: 0.5rem;
  width: min(100%, 22rem);
}

.qr figcaption {
  color: var(--muted);
  font-weight: 700;
  margin-top: 0.75rem;
  word-break: break-all;
}

/* Gestión: pantallas más anchas, con tablas y formularios largos. */
body.manage main {
  width: min(100%, 72rem);
}

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

.manage-nav {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
}

.manage-nav a {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  min-height: 44px;
  text-decoration: none;
}

.manage-nav a:hover {
  text-decoration: underline;
}

.manage-nav form {
  margin: 0 0 0 auto;
}

body.manage .brand img {
  width: min(100%, 16rem);
}

table {
  border-collapse: collapse;
  width: 100%;
}

@media (max-width: 43rem) {
  table {
    display: block;
    overflow-x: auto;
  }
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--sky);
  font-size: 0.85rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: var(--card);
}

code {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.3rem;
  overflow-wrap: anywhere;
  padding: 0.1rem 0.35rem;
}

textarea {
  background: #ffffff;
  border: 2px solid var(--sky);
  border-radius: 0.5rem;
  color: var(--navy-ink);
  font: inherit;
  max-width: 100%;
  padding: 0.55rem;
  width: 100%;
}

input[type="file"] {
  background: var(--card);
  color: var(--text);
  color-scheme: dark;
}

input[type="datetime-local"] {
  cursor: pointer;
}

.helptext {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
}

.errorlist {
  background: rgba(255, 120, 120, 0.15);
  border-left: 0.3rem solid #ff9b9b;
  border-radius: 0.4rem;
  color: #ffd2d2;
  list-style: none;
  padding: 0.5rem 0.8rem;
}

form p > label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

form p:has(> input[type="checkbox"]) {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

form p:has(> input[type="checkbox"]) > label {
  margin: 0;
  order: 2;
}

td form,
li form {
  display: inline;
  margin: 0;
}

@media (min-width: 43rem) {
  main {
    min-height: auto;
    padding-block: 2rem;
  }
}

@media print {
  body.print-sheet {
    background: #ffffff;
    color: #000000;
  }

  .print-sheet main {
    width: 100%;
  }

  .print-sheet h1,
  .print-sheet .qr figcaption {
    color: #000000;
  }

  .print-sheet .qr svg {
    box-shadow: none;
    width: 70%;
  }

  .no-print {
    display: none;
  }
}

/* "Tu respuesta": la marca por opción va también en texto, el color solo acompaña. */
.your-answer ul {
  list-style: none;
  padding-left: 0;
}

.your-answer li {
  border-left: 0.3rem solid var(--line);
  margin-block: 0.3rem;
  padding-left: 0.6rem;
}

.your-answer .option-correct {
  border-left-color: var(--lime);
}

.your-answer .option-partial {
  border-left-color: #ffd27f;
}

.your-answer .option-incorrect {
  border-left-color: #ff9b9b;
}

.your-answer .option-mark {
  color: var(--muted);
}

/* Preguntas de la ronda: cuáles ya respondió el asistente y cuánto falta para el cierre. */
.question-list li {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  justify-content: space-between;
}

.question-list li.answered a {
  color: var(--muted);
}

.answered-mark {
  color: var(--cyan);
  font-weight: 700;
}

.pending-mark {
  color: var(--muted);
  font-size: 0.9em;
}

.countdown {
  background: var(--band);
  border-radius: 0.4rem;
  color: var(--navy-ink);
  display: inline-block;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  padding: 0.3rem 0.8rem;
}
