/* Distrito Cultura · estilos
   Sin fuentes web ni recursos de terceros: todo se sirve desde tu dominio. */

:root {
  color-scheme: light dark;

  /* Base: mar del Cantábrico y papel de cartel */
  --paper: #f3f6f5;
  --surface: #ffffff;
  --ink: #0f2b36;
  --ink-2: #47606b;
  --line: #d3dcda;
  --line-strong: #8fa5a8;
  --boya: #d4481f;
  --on-boya: #ffffff;
  --focus: #0f2b36;

  --mast-bg: #0f2b36;
  --mast-fg: #f3f6f5;
  --mast-fg-2: #b8cbd0;

  /* Categorías */
  --c-musica: #2563a8;
  --c-teatro: #a63d2f;
  --c-cine: #6a4c9c;
  --c-infantil: #b87d00;
  --c-danza: #b83c78;
  --c-arte: #2a8068;
  --c-talleres: #5f6f78;
  --c-otro: #5f6f78;

  --display: "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1a20;
    --surface: #122830;
    --ink: #e7f0ef;
    --ink-2: #9fb5ba;
    --line: #25414a;
    --line-strong: #5b7a83;
    --boya: #f26b3f;
    --on-boya: #1a0a04;
    --focus: #e7f0ef;

    --mast-bg: #081318;
    --mast-fg: #e7f0ef;
    --mast-fg-2: #9fb5ba;

    --c-musica: #6aa3e8;
    --c-teatro: #e77c6b;
    --c-cine: #a98be0;
    --c-infantil: #e3b341;
    --c-danza: #e577a8;
    --c-arte: #5cc0a0;
    --c-talleres: #94a5ad;
    --c-otro: #94a5ad;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: 20px;
}

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

.skip {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-decoration: none;
}
.skip:focus { top: 12px; }

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

/* ---------- Cabecera ---------- */

.masthead {
  background: var(--mast-bg);
  color: var(--mast-fg);
  padding-block: 20px 36px;
}

.brand {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--mast-fg);
  text-decoration: none;
  padding-block: 4px;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 0.7em; height: 0.7em;
  margin-right: 0.5em;
  border-radius: 50%;
  background: var(--boya);
  vertical-align: -0.02em;
}

.masthead__title {
  margin-top: 28px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.015em;
  max-width: 14ch;
  text-wrap: balance;
}

.masthead__lede {
  margin-top: 16px;
  max-width: 46ch;
  color: var(--mast-fg-2);
  font-size: 1.0625rem;
}

/* ---------- Filtros ---------- */

.controls {
  padding-block: 20px 8px;
  border-bottom: 1px solid var(--line);
}

.controls__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.field { min-width: 0; }
.field--search { flex: 1 1 260px; }
.field--city { flex: 0 1 220px; }

input[type="search"],
select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  appearance: none;
  -webkit-appearance: none;
}

select {
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 19px, calc(100% - 14px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input[type="search"]::placeholder { color: var(--ink-2); opacity: 1; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.toggle span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.chip:hover,
.toggle span:hover { border-color: var(--ink); }

.chip[aria-pressed="true"],
.toggle input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.chip__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cat, var(--c-otro));
  flex: none;
}
.chip[aria-pressed="true"] .chip__dot { box-shadow: 0 0 0 2px var(--paper); }

.chip__n {
  font-size: 0.8125rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.toggle { display: inline-flex; }
.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.toggle input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Estado ---------- */

.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 18px 4px;
  color: var(--ink-2);
  min-height: 3.2rem;
}

.linklike {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.loading { padding-block: 12px 40px; }
.loading__text { margin-top: 12px; color: var(--ink-2); }
.loading__slow { margin-top: 8px; max-width: 52ch; }

.skeleton { display: grid; gap: 10px; }
.skeleton i {
  display: block;
  height: 64px;
  border-radius: var(--radius);
  background: var(--line);
  opacity: 0.6;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton i { animation: pulso 1.4s ease-in-out infinite; }
  .skeleton i:nth-child(2) { animation-delay: 0.15s; }
  .skeleton i:nth-child(3) { animation-delay: 0.3s; }
  @keyframes pulso { 50% { opacity: 0.25; } }
}

.notice {
  margin-block: 16px 40px;
  padding: 18px 20px;
  max-width: 60ch;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-left: 6px solid var(--boya);
  border-radius: var(--radius);
}
.notice p + .btn { margin-top: 14px; }

[hidden] { display: none !important; }

/* ---------- Agenda por días ---------- */

.day {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  column-gap: 28px;
  padding-block: 28px 12px;
  border-top: 1px solid var(--line);
}
.day:first-child { border-top: 0; }

.day__head {
  position: sticky;
  top: 16px;
  align-self: start;
}

.day__num {
  display: inline-block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.5rem, 7vw, 5.25rem);
  line-height: 0.9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.day__label { margin-top: 6px; color: var(--ink-2); line-height: 1.3; }
.day__weekday { display: block; color: var(--ink); font-weight: 600; }

.day.is-today .day__num {
  padding: 0.06em 0.14em 0.02em;
  background: var(--boya);
  color: var(--on-boya);
}

.events { display: grid; gap: 10px; align-content: start; }

/* ---------- Evento ---------- */

.event {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--cat, var(--c-otro));
  border-radius: var(--radius);
}

.event.is-past { opacity: 0.74; }

.event summary {
  display: grid;
  grid-template-columns: minmax(76px, max-content) minmax(0, 1fr) auto;
  grid-template-areas: "time main price";
  gap: 4px 16px;
  align-items: start;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.event summary::-webkit-details-marker { display: none; }
.event summary::marker { content: ""; }
.event summary:hover .event__title { text-decoration: underline; text-underline-offset: 3px; }

.event__time { grid-area: time; }
.time {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.time--tbc {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: var(--ink-2);
  padding-top: 3px;
}

.event__main { grid-area: main; min-width: 0; }
.event__title {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.event__meta {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.event__cat { display: block; margin-top: 4px; font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.event__cat i {
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cat, var(--c-otro));
}
.event__flag { margin-left: 10px; font-weight: 400; color: var(--ink-2); }

.event__aside {
  grid-area: price;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  text-align: right;
}
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.price--ask { font-weight: 400; color: var(--ink-2); font-size: 0.9375rem; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
}
.tag--free { background: var(--ink); color: var(--paper); }
.tag--out { border: 1.5px solid var(--boya); color: var(--ink); }

.chev {
  width: 18px; height: 18px;
  flex: none;
  stroke: var(--ink-2);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (prefers-reduced-motion: no-preference) {
  .chev { transition: transform 0.15s ease; }
}
.event[open] .chev { transform: rotate(180deg); }

.event__body {
  padding: 0 16px 16px 108px;
}
.event__desc { max-width: 62ch; }
.event__addr { margin-top: 8px; color: var(--ink-2); font-size: 0.9375rem; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.15); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); filter: none; }

/* ---------- Pie ---------- */

.foot {
  margin-top: 40px;
  padding-block: 28px 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.foot p { max-width: 62ch; }
.foot p + p { margin-top: 6px; }

/* ---------- Móvil ---------- */

@media (max-width: 720px) {
  .wrap { padding-inline: 16px; }

  .masthead { padding-block: 14px 28px; }
  .masthead__title { margin-top: 20px; }

  .day {
    grid-template-columns: minmax(0, 1fr);
    padding-block: 22px 8px;
  }
  .day__head {
    position: static;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
  }
  .day__label { margin-top: 0; }
  .day__num { font-size: 3.5rem; }

  .event summary {
    grid-template-columns: minmax(58px, max-content) minmax(0, 1fr);
    grid-template-areas:
      "time main"
      "time price";
    padding: 12px 12px 12px 14px;
  }
  .time { font-size: 1.5rem; }
  .event__aside { justify-content: flex-start; text-align: left; margin-top: 2px; }
  .event__body { padding: 0 14px 16px 14px; }
  .actions .btn { flex: 1 1 100%; }
}

/* En móvil, los filtros ocupan poco: búsqueda arriba, ciudad y "solo gratis" en una
   fila, y "cuándo" y categorías en tiras que se desplazan de lado. */
@media (max-width: 720px) {
  .controls { padding-block: 16px 4px; }
  .controls__row { gap: 8px; margin-bottom: 10px; }
  .field--search { flex: 1 1 100%; }
  .field--city { flex: 1 1 0; }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: -16px;
    padding: 2px 16px 6px;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}
