/* ===========================================================================
   Design system compartido — Boda M&J (rústico toscano/umbro, minimalista)
   =========================================================================== */

:root {
  --cream: #f4f3e6;
  --taupe: #776d69;
  --white: #ffffff;

  --taupe-soft: rgba(119, 109, 105, 0.55);
  --taupe-line: rgba(119, 109, 105, 0.22);

  --shadow-soft: 0 6px 20px rgba(119, 109, 105, 0.18);
  --shadow-card: 0 10px 30px rgba(119, 109, 105, 0.28);

  --radius: 4px;
  --maxw: 640px;

  --font-serif: "EB Garamond", Georgia, "Times New Roman", serif;
}

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

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

body {
  font-family: var(--font-serif);
  color: var(--taupe);
  letter-spacing: 1px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;

  /* Fondo crema sólido como base garantizada; la textura va encima con overlay
     translúcido. Si la imagen no existe aún, degrada al color sólido. */
  background-color: var(--cream);
  background-image:
    linear-gradient(rgba(244, 243, 230, 0.86), rgba(244, 243, 230, 0.86)),
    url("../assets/texture.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   Tipografía
   -------------------------------------------------------------------------- */
h1,
h2,
h3 {
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin: 0 0 0.5em;
  line-height: 1.25;
}

h1 {
  font-size: 1.9rem;
}
h2 {
  font-size: 1.35rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--taupe);
}

.italic-decor {
  font-style: italic;
  text-transform: none;
  letter-spacing: 1px;
  color: var(--taupe-soft);
}

/* --------------------------------------------------------------------------
   Layout base
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* --------------------------------------------------------------------------
   Monograma / cabecera de marca
   -------------------------------------------------------------------------- */
.brand {
  text-align: center;
  padding: 18px 0 10px;
}

.brand .monogram {
  font-size: 2.4rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  display: inline-block;
  line-height: 1;
}

.brand .date {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
  letter-spacing: 3px;
}

.brand .divider {
  width: 46px;
  height: 1px;
  background: var(--taupe-line);
  margin: 14px auto 0;
  border: 0;
}

/* --------------------------------------------------------------------------
   Botones — grandes, aptos para dedos
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 16px 22px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--cream);
  background: var(--taupe);
  border: 1px solid var(--taupe);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

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

.btn--ghost {
  background: transparent;
  color: var(--taupe);
}

.btn--small {
  width: auto;
  min-height: 44px;
  padding: 10px 18px;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */
.field {
  margin-bottom: 18px;
  text-align: left;
}

.field label {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--taupe);
  background: var(--white);
  border: 1px solid var(--taupe-line);
  border-radius: var(--radius);
}

.field input:focus {
  outline: 2px solid var(--taupe-soft);
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Avisos / estados
   -------------------------------------------------------------------------- */
.notice {
  background: var(--white);
  border: 1px solid var(--taupe-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 18px;
  font-size: 0.98rem;
  box-shadow: var(--shadow-soft);
}

.notice--error {
  border-color: rgba(150, 70, 60, 0.4);
}

.hidden {
  display: none !important;
}

.center {
  text-align: center;
}

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

/* Spinner sobrio */
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--taupe-line);
  border-top-color: var(--taupe);
  border-radius: 50%;
  margin: 24px auto;
  animation: spin 0.9s linear infinite;
}

.spinner--sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
  margin: 0 9px 0 0;
  display: inline-block;
  vertical-align: -4px;
}

/* Cámara embebida */
.camera {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 58vh;
  margin: 6px auto 14px;
  background: #2b2724;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera.flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  animation: flash 0.22s ease;
}
@keyframes flash {
  from { opacity: 0.85; }
  to { opacity: 0; }
}
.cam-switch {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
}
.cam-switch:active { transform: scale(0.9); }
.cam-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.shutter {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--taupe);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.shutter:active { transform: scale(0.92); }
.shutter:disabled { opacity: 0.45; cursor: default; }

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Componentes compartidos: íconos, idioma, progreso, subida, anti-zoom
   -------------------------------------------------------------------------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--taupe);
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, background 0.15s ease;
}
.icon-btn:active { transform: scale(0.9); }

/* Toggle de idioma EN / IT */
.lang-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(244, 243, 230, 0.85);
  border: 1px solid var(--taupe-line);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.lang-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: var(--taupe-soft);
  padding: 5px 12px;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-btn.is-active {
  background: var(--taupe);
  color: var(--cream);
}

/* Barra de progreso de subida */
.progressbar {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 8px;
  margin: 22px auto 14px;
  background: var(--taupe-line);
  border-radius: 999px;
  overflow: hidden;
}
/* Barrido continuo en la pista: indica actividad aunque el % no avance */
.progressbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(119, 109, 105, 0.22) 50%, transparent 100%);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  animation: track-slide 1.2s linear infinite;
}
.progressbar-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  width: 0%;
  background: var(--taupe);
  border-radius: 999px;
  transition: width 0.4s ease;
  overflow: hidden;
}
/* Pulso interno sobre la parte ya cargada */
.progressbar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.2s linear infinite;
}
@keyframes track-slide {
  from { background-position: -45% 0; }
  to { background-position: 145% 0; }
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}
.uploading {
  text-align: center;
  padding: 48px 0;
}

/* Bloquear doble-tap zoom y selección accidental (inputs siguen seleccionables) */
html { touch-action: manipulation; }
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}
