/* Txistus Peiolín — sistema visual propio.
   Serif editorial (Fraunces) para titulares + sans del sistema para texto.
   Paleta: papel, vino, oliva y ochre. Sin frameworks, sin emojis. */

:root {
  --paper: #f5f0e6;
  --paper-2: #ece4d4;
  --surface: #fffdf8;
  --ink: #211b15;
  --ink-soft: #6b6155;
  --line: #e1d7c4;
  --line-strong: #d3c6ae;

  --wine: #7a2f3a;
  --wine-deep: #5f2530;
  --gold: #a9772a;
  --gold-soft: #c79a45;
  --olive: #4f5a3f;
  --ok: #3a6b4a;
  --err: #a3342b;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(33, 27, 21, 0.06);
  --shadow-lift: 0 10px 30px rgba(33, 27, 21, 0.12);
  --maxw: 1060px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--wine);
  text-decoration: none;
}

a:hover {
  color: var(--wine-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- Header / nav ---- */
.site-header {
  background: var(--surface);
  border-top: 3px solid var(--wine);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  background-color: var(--wine);
  -webkit-mask: url("../images/txistu.ebfbafa8cf56.png") center / contain no-repeat;
  mask: url("../images/txistu.ebfbafa8cf56.png") center / contain no-repeat;
  transform: translateY(0.1em);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.main-nav a {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--paper-2);
  text-decoration: none;
}

.main-nav .nav-cta {
  color: var(--wine);
  border: 1px solid var(--line-strong);
  margin-left: 0.3rem;
}

.main-nav .nav-cta:hover {
  border-color: var(--wine);
  background: var(--surface);
  color: var(--wine);
}

/* Hamburger toggle (oculto en escritorio) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 38px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-backdrop {
  display: none;
}

@keyframes nav-fade {
  from {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 41;
  }

  body.nav-open .site-header {
    z-index: 50;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 38;
    background: rgba(20, 15, 10, 0.45);
    animation: nav-fade 0.2s ease;
  }

  .nav-backdrop[hidden] {
    display: none;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 39;
    width: min(80vw, 290px);
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(33, 27, 21, 0.18);
    padding: 4.9rem 1.1rem 1.4rem;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }

  .main-nav.open {
    transform: translateX(0);
  }

  .main-nav a {
    padding: 0.85rem 0.7rem;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--ink);
  }

  .main-nav a:hover {
    background: var(--paper-2);
  }

  .main-nav .nav-cta {
    margin: 0.7rem 0 0;
    text-align: center;
    color: #fff;
    background: var(--wine);
    border-color: var(--wine);
  }

  body.nav-open {
    overflow: hidden;
  }
}

.main-content {
  flex: 1 0 auto;
  padding-top: 2.2rem;
  padding-bottom: 4rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 1.5rem 0;
  letter-spacing: 0.02em;
}

/* ---- Typography ---- */
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem);
}

h2 {
  font-size: 1.45rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

.muted {
  color: var(--ink-soft);
}

.measure {
  max-width: 62ch;
}

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--wine);
  margin: 0 0 0.4rem;
}

.section-title {
  margin-top: 2.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}

.page-head h1 {
  margin: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  border: 1px solid var(--wine);
  background: var(--wine);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.93rem;
  letter-spacing: 0.01em;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.05s ease;
  line-height: 1.25;
}

.btn:hover {
  background: var(--wine-deep);
  border-color: var(--wine-deep);
  color: #fff;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--wine);
  color: var(--wine);
}

.btn-muted {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-muted:hover {
  background: var(--line);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-danger {
  background: transparent;
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, var(--line));
}

.btn-danger:hover {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}

.btn-sm {
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
  text-align: center;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}

/* ---- Cards & grid ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem;
}

/* Tarjetas que son enlaces (clicables al completo) */
a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

a.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
  text-decoration: none;
}

a.card:active {
  transform: translateY(0);
}

.card-group .group-cover {
  height: 120px;
  margin: -1.3rem -1.4rem 1rem;
  background: var(--paper-2) center / cover no-repeat;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line);
}

.card-group h2 {
  color: var(--ink);
  margin-bottom: 0.35rem;
}

a.card-group:hover h2 {
  color: var(--wine);
}

/* Stretched link: el enlace del título cubre toda la tarjeta. */
.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---- Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--wine);
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.stat-averages {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.avg-card {
  flex: 1;
  min-width: 150px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-align: center;
}

.avg-card .stat-label {
  color: var(--gold-soft);
}

.avg-num {
  display: block;
  font-family: var(--serif);
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--gold-soft);
  line-height: 1;
}

.avg-num small {
  font-size: 1rem;
  opacity: 0.7;
}

.awards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.award {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.award-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--wine);
}

.award-value {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

a.award-value:hover {
  color: var(--wine);
}

/* Bar charts */
.bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bar {
  display: grid;
  grid-template-columns: minmax(80px, 28%) 1fr auto;
  align-items: center;
  gap: 0.7rem;
}

.bar-label {
  font-size: 0.88rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 12px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--wine), var(--gold));
  border-radius: 999px;
}

.bar-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
  min-width: 1.5rem;
  text-align: right;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.grid {
  display: grid;
  gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Rejilla más densa para las tarjetas de recomendación. */
.grid-recs {
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}

.section-head h2 {
  margin: 0;
}

.map-search {
  position: relative;
}

.map-search input {
  width: 100%;
}

.map-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: 240px;
  overflow: auto;
}

.map-suggestions[hidden] {
  display: none;
}

.map-suggestions li {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink);
}

.map-suggestions li:hover {
  background: var(--paper-2);
}

/* ---- Tag input (categorías con chips + autocompletado) ---- */
.tag-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chips:empty {
  display: none;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.3rem 0.25rem 0.65rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.tag-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: var(--paper);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.tag-chip-x:hover {
  background: var(--wine);
}

.tag-field {
  position: relative;
}

.tag-field input {
  width: 100%;
}

.tag-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: 240px;
  overflow: auto;
}

.tag-suggestions[hidden] {
  display: none;
}

.tag-suggestions li {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}

.tag-suggestions li:hover {
  background: var(--paper-2);
}

.grid .card h2 {
  margin-bottom: 0.35rem;
}

.grid .card h2 a {
  color: var(--ink);
}

.grid .card h2 a:hover {
  color: var(--wine);
}

/* Recommendation card */
.rec-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.rec-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.rec-card .rec-photo {
  position: relative;
  height: 132px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.rec-slide {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.rec-slide.active {
  opacity: 1;
}

.rec-card .rec-body {
  padding: 0.8rem 0.95rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.rec-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.rec-sub {
  font-size: 0.82rem;
}

.rec-card h3 a {
  color: var(--ink);
}

.rec-card h3 a:hover {
  color: var(--wine);
}

.rec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: center;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.rec-card .rec-actions {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 0.4rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.rec-card .rec-actions form {
  display: inline;
}

/* Small uppercase field labels for detail pages */
.field-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

/* ---- Badges & stars ---- */
.badge {
  display: inline-block;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.badge-peio {
  background: var(--ink);
  color: var(--gold-soft);
  border-color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 700;
}

.badge-admin {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
}

.badge-price {
  color: var(--olive);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stars {
  color: var(--gold);
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}

.stars .empty {
  color: var(--line-strong);
}

/* ---- Forms ---- */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
  max-width: 600px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="url"],
.form input[type="number"],
.form input[type="password"],
.form input[type="datetime-local"],
.form input[type="file"],
.form select,
.form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
}

.form textarea {
  resize: vertical;
  min-height: 5rem;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(122, 47, 58, 0.13);
}

.form .helptext {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.form .errorlist {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  color: var(--err);
  font-size: 0.84rem;
}

.form-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Messages ---- */
.messages {
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.message {
  padding: 0.75rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-soft);
  background: var(--surface);
  font-size: 0.93rem;
}

.message-success {
  border-left-color: var(--ok);
}

.message-error,
.message-danger {
  border-left-color: var(--err);
}

.message-warning {
  border-left-color: var(--gold);
}

.message-info {
  border-left-color: var(--wine);
}

/* ---- Tables (members) ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th,
.table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
  vertical-align: middle;
}

.table th {
  background: var(--paper-2);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-weight: 700;
}

.table tr:last-child td {
  border-bottom: none;
}

.col-actions {
  width: 1%;
  white-space: nowrap;
}

.inline-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.inline-actions form {
  display: inline;
}

/* ---- Invitations ---- */
.invite-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.invite-card {
  max-width: 480px;
  margin: 2.5rem auto;
  text-align: center;
}

.invite-card h1 {
  margin-top: 0.2rem;
}

.copy-field {
  display: flex;
  gap: 0.5rem;
  min-width: min(420px, 100%);
}

.copy-field input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---- Map ---- */
.map {
  height: 70vh;
  min-height: 380px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.map-picker {
  height: 320px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
}

.leaflet-container {
  font-family: var(--sans);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--ink-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state p {
  margin-bottom: 1.2rem;
}

/* ---- Hero (home) ---- */
.hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
  max-width: 720px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2.4rem, 1.6rem + 3vw, 3.6rem);
  line-height: 1.05;
}

.hero p {
  max-width: 560px;
  margin: 1rem auto 1.8rem;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Detail helpers ---- */
.detail-hero-photo {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.4rem;
  border: 1px solid var(--line);
}

.meta-sep::before {
  content: "·";
  margin: 0 0.5rem;
  color: var(--line-strong);
}

/* ---- Global form controls (allauth y formularios sin .form) ---- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(122, 47, 58, 0.13);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check input {
  width: auto;
}

.form-check label {
  font-weight: 500;
  margin: 0;
}

/* Keep the invite copy field compact despite the global rule above. */
.copy-field input[type="text"] {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  background: var(--paper);
  color: var(--ink-soft);
}

/* ---- Auth (allauth) ---- */
.auth-wrap {
  max-width: 430px;
  margin: 2.5rem auto;
}

.auth-card {
  padding: 1.8rem 1.8rem 2rem;
}

.auth-card h1 {
  font-size: 1.7rem;
  margin-bottom: 1.2rem;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.auth-card p {
  margin-bottom: 0.8rem;
}

.auth-panel {
  margin-bottom: 1.4rem;
}

.badge-ok {
  background: #e7f2ea;
  color: var(--ok);
  border-color: #c2ddc9;
}

.badge-warn {
  background: #fbeee0;
  color: var(--gold);
  border-color: #ecd3ad;
}

/* ---- Profile ---- */
.profile-card {
  max-width: 460px;
}

.profile-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
}

.profile-row + .profile-row {
  border-top: 1px solid var(--line);
}

.profile-row .field-label {
  width: 5rem;
  flex: 0 0 auto;
  margin: 0;
}

/* ---- Txistus (valoración) ----
   Usa la imagen real del txistu (negra, fondo transparente) como máscara CSS,
   así se tiñe con background-color a dorado (lograda) o gris (vacía). */
.txistus {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}

.txistu {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  background-color: var(--gold);
  -webkit-mask: url("../images/txistu.ebfbafa8cf56.png") center / contain no-repeat;
  mask: url("../images/txistu.ebfbafa8cf56.png") center / contain no-repeat;
}

.txistu.is-empty {
  background-color: var(--line-strong);
}

/* ---- Photo gallery + lightbox ---- */
.photo-section {
  margin-bottom: 1.6rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
}

.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
}

.lightbox {
  position: fixed;
  inset: 0;
  /* Por encima de los paneles/controles de Leaflet (que llegan a ~1000). */
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2rem;
  background: rgba(20, 15, 10, 0.86);
  cursor: zoom-out;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(1000px, 92vw);
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox figcaption {
  color: var(--paper);
  margin-top: 0.8rem;
  font-size: 0.95rem;
}

/* ---- Debate / comments ---- */
.debate {
  margin-top: 1rem;
}

.comments {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.4rem;
}

.comment {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.comment-author {
  font-weight: 700;
}

.comment-date {
  font-size: 0.8rem;
}

.comment-del {
  margin-left: auto;
}

.link-danger {
  background: none;
  border: none;
  color: var(--err);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
}

.link-danger:hover {
  text-decoration: underline;
}

.comment-body {
  margin: 0;
}

.comment-form {
  max-width: none;
}

/* ---- Photo upload formset ---- */
.form-wide {
  max-width: 720px;
}

.photos-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.2rem;
  margin: 0;
}

.photos-fieldset legend {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0 0.4rem;
}

#photo-forms {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0.6rem 0 1rem;
}

.photo-form {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}

.photo-thumb {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--paper-2) center / cover no-repeat;
  border: 1px solid var(--line);
}

.photo-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.photo-fields-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0.6rem;
}

.file-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  width: fit-content;
}

.file-field input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: 0;
}

.file-btn {
  display: inline-block;
  background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.file-field:hover .file-btn {
  border-color: var(--wine);
  color: var(--wine);
}

.file-name {
  font-size: 0.82rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.photo-del {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.photo-del input {
  width: auto;
}

@media (max-width: 540px) {
  .photo-fields-row {
    grid-template-columns: 1fr;
  }

  .photo-form {
    flex-direction: column;
  }
}

/* ---- Reviews (opiniones de la cuadrilla) ---- */
.reviews-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.reviews-head .section-title {
  margin-bottom: 0;
}

.reviews-summary {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.9rem 0 1.2rem;
}

.reviews-avg {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.review {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1.05rem;
}

.review-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.review-date {
  font-size: 0.8rem;
}

.review-head .comment-del {
  margin-left: auto;
}

.review-comment {
  margin: 0 0 0.6rem;
}

.gallery-sm {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

/* ---- Head actions ---- */
.head-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 15, 10, 0.55);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 1.7rem 1.7rem 1.8rem;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.modal-card h2 {
  margin-top: 0.2rem;
}

.modal-x {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}

.modal-x:hover {
  color: var(--ink);
}

.modal-foot {
  margin-top: 1.2rem;
}

.how-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.how-list li {
  padding-left: 1rem;
  position: relative;
  color: var(--ink-soft);
}

.how-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--wine);
}

.how-list strong {
  color: var(--ink);
}

.modal-card h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin: 1.2rem 0 0.4rem;
}

.install-hint {
  text-align: center;
  margin: 2.5rem 0 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

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

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

body.modal-open {
  overflow: hidden;
}

/* ---- Pulido móvil ---- */
@media (max-width: 520px) {
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  .page-head {
    align-items: flex-start;
  }

  .head-actions {
    width: 100%;
  }

  .head-actions .btn {
    flex: 1;
    text-align: center;
  }

  .reviews-head,
  .debate .section-title {
    width: 100%;
  }
}
