/* Baco: la bodega como carta de vinos.
   El color de la página es el del vino; el verdejo y el rosado solo aparecen
   para decir el estado de una botella o la acción principal. */

@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('../fonts/cormorant-500.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-style: italic; font-display: swap;
  src: url('../fonts/cormorant-500i.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('../fonts/cormorant-600.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('../fonts/cinzel-500.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('../fonts/jost-400.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('../fonts/jost-500.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --uva: #37102B;
  --hollejo: #280A20;
  --racimo: #4A1B3C;
  --albariza: #F3E9DC;
  --poso: #CDB8C4;
  --borde: #8A6A7E;
  --verdejo: #DBDA72;
  --rosado: #F4AEB6;
  --aviso: #FFC9B0;
  --carta: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --etiqueta: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  --ui: 'Jost', 'Segoe UI', system-ui, sans-serif;
  --sangria: clamp(0.5rem, 2vw, 1.25rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--uva);
  color: var(--albariza);
  font: 500 1.3125rem/1.45 var(--carta);
}
h1, h2, h3, h4, h5, p, ul, fieldset { margin: 0; padding: 0; }
h1, h2, h3, h4, h5 { font-weight: inherit; font-size: inherit; }
fieldset { border: 0; min-width: 0; }
ul { list-style: none; }
img, svg { display: block; }
[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--verdejo); }
:focus-visible { outline: 2px solid var(--verdejo); outline-offset: 3px; border-radius: 2px; }

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

.pagina {
  max-width: 58rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem) max(16px, 4vw) 5rem;
}

/* ------------------------------------------------------------ cabecera */
.cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}
.marca { display: inline-flex; font-size: clamp(3.5rem, 11vw, 6.75rem); line-height: 1; text-decoration: none; }
.logo { height: 1.5em; width: auto; flex: none; }
.marca-pequena { font-size: 2.5rem; }
.boton-mas {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--verdejo);
  color: var(--hollejo);
}
.boton-mas:hover { background: #E9E88E; color: var(--hollejo); }
.boton-mas svg { width: 1.875rem; height: 1.875rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pie { display: flex; justify-content: center; margin-top: clamp(3rem, 8vw, 5rem); }

/* ------------------------------------------------------------ acceso */
.acceso { display: grid; gap: 1.5rem; max-width: 22rem; margin: clamp(2rem, 10vh, 6rem) auto 0; }
.acceso .marca { justify-self: center; font-size: 4.5rem; }
.acceso .logo { height: 2.6em; }
.acceso-formulario { display: grid; gap: 0.875rem; }
.acceso-formulario .boton { justify-self: start; margin-top: 0.25rem; }
.acceso code { font: inherit; font-weight: 500; }

/* ------------------------------------------------------------ conectar la IA */
.conexion { display: grid; gap: 1rem; max-width: 40rem; margin: clamp(1rem, 5vh, 3rem) auto 0; }
.conexion h1, .conexion h2 { font-size: 2rem; line-height: 1.15; }
.conexion h2 { margin-top: 0.75rem; }
.conexion-detalle { color: var(--poso); font-size: 1rem; }
.conexion-url { padding: 0.75rem 1rem; border: 1px solid var(--borde); border-radius: 3px; overflow-wrap: anywhere; }
.conexion-url code { font: 500 1.0625rem/1.4 var(--ui); user-select: all; }
.conexion-formulario { display: grid; gap: 1rem; }
.conexion-opcion { display: flex; align-items: center; gap: 0.625rem; cursor: pointer; }
.conexion-botones { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.conexion-lista { display: grid; gap: 0.75rem; padding: 0; list-style: none; }
.conexion-lista li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--racimo); }
.conexion-lista li > div { display: grid; }

/* ------------------------------------------------------------ botones */
.boton {
  display: inline-block;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
  background: none;
  color: var(--albariza);
  font: 500 1.0625rem/1.3 var(--ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.boton:hover { background: var(--racimo); color: var(--albariza); }
.boton-principal { background: var(--verdejo); border-color: var(--verdejo); color: var(--hollejo); }
.boton-principal:hover { background: #E9E88E; border-color: #E9E88E; color: var(--hollejo); }
.boton-principal:disabled { opacity: 0.6; cursor: progress; }
.boton-peligro { color: var(--aviso); border-color: transparent; }
.boton-peligro:hover { color: var(--aviso); }
.boton-eliminar, .boton-eliminar:hover { background: var(--aviso); border-color: var(--aviso); color: var(--hollejo); }

/* ------------------------------------------------------------ filtros */
.mandos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  font-family: var(--ui);
  font-weight: 400;
  font-size: 1.0625rem;
}
.filtros { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.filtros a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.filtros a[aria-current] { border-bottom-color: var(--verdejo); font-weight: 500; }
.filtros .glifo { height: 1.3em; }
.cuenta { color: var(--poso); font-family: var(--ui); font-weight: 400; font-size: 1rem; }

.buscador { flex: 0 1 16rem; }
.buscador input { width: 100%; }

/* ------------------------------------------------------------ glifo */
.glifo { height: 1.5em; width: auto; flex: none; stroke-width: 1.25; }
.glifo-comprada { fill: var(--verdejo); stroke: var(--verdejo); }
.glifo-bebida { fill: none; stroke: var(--poso); }
.glifo-quiero { fill: none; stroke: var(--rosado); stroke-width: 1.6; stroke-dasharray: 3.4 2.4; }

/* ------------------------------------------------------------ la carta */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.nivel > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.nivel > summary::before, .anada > summary::before {
  content: "";
  flex: none;
  width: 0.34em;
  height: 0.34em;
  border-right: 1.5px solid var(--poso);
  border-bottom: 1.5px solid var(--poso);
  transform: translateY(-0.12em) rotate(-45deg);
  transition: transform 120ms ease-out;
}
.nivel[open] > summary::before, .anada[open] > summary::before { transform: translateY(-0.26em) rotate(45deg); }
.nivel > summary .cuenta { margin-left: auto; }
.nivel > summary:hover h2, .nivel > summary:hover h3, .nivel > summary:hover h4 { color: var(--verdejo); }

.pais + .pais { margin-top: clamp(2.5rem, 6vw, 4rem); }
.pais > summary h2 { font: 500 clamp(1.75rem, 4vw, 2.375rem)/1.15 var(--etiqueta); letter-spacing: 0.06em; text-transform: uppercase; overflow-wrap: anywhere; }

.region { margin: 1.5rem 0 0 var(--sangria); }
.region > summary h3 { font: 500 clamp(1.0625rem, 2.2vw, 1.25rem)/1.3 var(--etiqueta); letter-spacing: 0.12em; text-transform: uppercase; overflow-wrap: anywhere; }

.productor { margin: 1.125rem 0 0 var(--sangria); }
.productor > summary h4 { font-weight: 600; font-size: 1.5rem; line-height: 1.2; }

.botella { margin: 0.5rem 0 0 calc(var(--sangria) + 0.9rem); }
.botella + .botella { margin-top: 0.875rem; }
.botella h5 { font-size: 1.3125rem; line-height: 1.3; }

.anada > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.1rem 0.25rem 0.1rem 0.5rem;
  border-radius: 2px;
}
.anada > summary:hover { background: var(--racimo); }
.anada:target > summary { background: var(--racimo); }
.anio { font-feature-settings: 'onum' 1; white-space: nowrap; }
.guia { flex: 1; min-width: 1rem; border-bottom: 0.13em dotted var(--borde); }
.media { font-weight: 600; }
.fila-botellas {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  align-self: center;
  gap: 0.2rem;
}
.fila-botellas .glifo { height: 1.45em; }

/* ------------------------------------------------------------ registros */
.registros { margin: 0.5rem 0 0 0.75rem; }
.registro {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 0.75rem 0;
}
.foto {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 2px;
  background: var(--hollejo);
}
.foto img { width: 100%; height: 100%; object-fit: cover; }
.foto-vacia .glifo { height: 55%; opacity: 0.55; }

.estado { font: 500 1.0625rem/1.3 var(--ui); }
.estado-comprada { color: var(--verdejo); }
.estado-quiero { color: var(--rosado); }
.estado-bebida { color: var(--poso); }
.fechas { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: 0.125rem; color: var(--poso); font: 400 1rem/1.4 var(--ui); }
.notas { margin-top: 0.375rem; max-width: 34em; white-space: pre-line; overflow-wrap: anywhere; }
.acciones { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: 0.375rem; font: 400 1rem/1.5 var(--ui); }
.puntuacion strong { font-weight: 600; font-size: 2.75rem; line-height: 1; font-feature-settings: 'lnum' 1; }
.otra { margin: 0.25rem 0 1rem 0.75rem; font: 400 1rem/1.5 var(--ui); }

/* ------------------------------------------------------------ vacío */
.vacio { padding: 2rem 0; max-width: 32em; }
.vacio-titulo { font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.15; font-weight: 600; margin-bottom: 0.5rem; }

/* ------------------------------------------------------------ formulario */
.cabecera-ficha { margin-bottom: 1rem; }
.titulo-ficha { font-weight: 600; font-size: clamp(2.5rem, 6vw, 3.5rem); line-height: 1.05; margin-bottom: 1.75rem; overflow-wrap: anywhere; }

.formulario { display: grid; gap: 2.25rem; font-family: var(--ui); font-weight: 400; font-size: 1.0625rem; }
legend, .rotulo-notas {
  padding: 0;
  margin-bottom: 0.625rem;
  font: 500 1.0625rem/1.3 var(--etiqueta);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.columnas { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.25rem; align-items: start; }
.clasificacion { display: grid; gap: 0.875rem; }
.campo { display: grid; gap: 0.25rem; min-width: 0; }
.campo > label:not(.rotulo-notas) { color: var(--poso); font-size: 1rem; }

input:not([type="radio"], [type="checkbox"], [type="file"]), select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
  background: var(--hollejo);
  color: var(--albariza);
  font: 400 1.0625rem/1.4 var(--ui);
}
select { cursor: pointer; }
select:disabled { color: var(--poso); cursor: not-allowed; }
.campo-nuevo { margin-top: 0.25rem; }
::placeholder { color: var(--poso); opacity: 0.75; }
textarea { resize: vertical; font-size: 1.0625rem; }
[aria-invalid="true"] { border-color: var(--aviso) !important; }
.error { color: var(--aviso); font: 400 1rem/1.35 var(--ui); }
.error-general { margin-bottom: 1.25rem; }

.opciones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.625rem; }
.opcion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
  cursor: pointer;
}
.opcion input, .punto input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opcion:hover, .punto:hover span { background: var(--racimo); }
.opcion:has(:checked) { background: var(--racimo); border-color: var(--albariza); font-weight: 500; }
.opcion:has(:focus-visible), .punto:has(:focus-visible) span { outline: 2px solid var(--verdejo); outline-offset: 2px; }
.opcion .glifo { height: 2.25rem; }

.caja-foto {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px dashed var(--borde);
  border-radius: 3px;
  background: var(--hollejo);
  cursor: pointer;
}
.caja-foto:hover { border-color: var(--albariza); }
.caja-foto:has(+ input:focus-visible) { outline: 2px solid var(--verdejo); outline-offset: 2px; }
.caja-foto img { width: 100%; height: 100%; object-fit: cover; }
.caja-foto-texto { display: grid; justify-items: center; gap: 0.625rem; color: var(--poso); }
.caja-foto-texto .glifo { height: 5rem; }
.casilla { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; cursor: pointer; }
#foto-error { margin-top: 0.5rem; }

.fechas-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.fechas-campos legend { grid-column: 1 / -1; }

.escala { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.punto { cursor: pointer; }
.punto span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.5rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
}
.punto input:checked + span { background: var(--verdejo); border-color: var(--verdejo); color: var(--hollejo); font-weight: 500; }
.punto-sin input:checked + span { background: var(--racimo); border-color: var(--albariza); color: var(--albariza); }

.fecha-entrada { position: relative; }
.fecha-entrada input[type="text"] { padding-right: 2.75rem; }
.fecha-abrir {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.75rem;
  border: 0;
  background: none;
  color: var(--poso);
  cursor: pointer;
}
.fecha-abrir:hover { color: var(--verdejo); }
.fecha-abrir svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.5; }

.calendario {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 5;
  display: grid;
  gap: 0.5rem;
  width: min(20rem, 100%);
  padding: 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
  background: var(--hollejo);
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 45%);
  font: 400 1rem/1.3 var(--ui);
}
.calendario select { padding: 0.3rem 0.35rem; font-size: 1rem; }
.cal-cabecera { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 5rem 2.25rem; gap: 0.25rem; }
.cal-flecha { border: 0; background: none; color: var(--albariza); font: 500 1.5rem/1 var(--ui); cursor: pointer; }
.cal-flecha:hover { color: var(--verdejo); }
.cal-semana, .cal-rejilla { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.cal-semana { color: var(--poso); font-size: 0.9375rem; }
.cal-dia {
  min-height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  color: var(--albariza);
  font: inherit;
  cursor: pointer;
}
.cal-dia:hover { background: var(--racimo); }
.cal-hoy { border-color: var(--borde); }
.cal-dia[aria-pressed="true"] { background: var(--verdejo); border-color: var(--verdejo); color: var(--hollejo); font-weight: 500; }
.cal-pie { display: flex; justify-content: space-between; }
.cal-accion { padding: 0.25rem; border: 0; background: none; color: var(--albariza); font: inherit; text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.cal-accion:hover { color: var(--verdejo); }

.pie-formulario { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.confirmar-borrado { margin-left: auto; text-align: right; }
.confirmar-borrado[open] { flex-basis: 100%; }
.confirmar-panel { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.confirmar-panel p { flex-basis: 100%; }

/* ------------------------------------------------------------ móvil */
@media (max-width: 640px) {
  .columnas { grid-template-columns: minmax(0, 1fr); }
  .bloque-foto { max-width: 12rem; }
  .fechas-campos { grid-template-columns: minmax(0, 1fr); gap: 0.875rem; }
  .opciones { gap: 0.375rem; }
  .opcion { flex-direction: column; gap: 0.25rem; padding: 0.625rem 0.25rem; text-align: center; }
  .registro { grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: 0.75rem; }
  .buscador { flex-basis: 100%; }
  .cabecera .boton { margin-bottom: 0.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
