/* Formulario público de reviews (/opina) con la paleta ámbar de Caña.
 * Radios: botones en píldora, tarjetas 16px, campos 10px. Un solo acento: --amber. */
@font-face {
  font-family: 'Lexend';
  src: url('/gift/lexend.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #f4f0e8;
  --surface: #fffdf9;
  --ink: #1f1b16;
  --ink-2: #5d554b;
  --line: #e2dacd;
  --field-line: #968874; /* bordes de campos y estrellas vacías: 3:1 sobre papel */
  --amber: #9a5816;      /* 5.5:1 con blanco, 4.9:1 como link sobre papel */
  --amber-ink: #fffdf9;
  --amber-soft: #f3e4cf;
  --danger: #a63a26;
  --radius: 16px;
  --radius-field: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --surface: #211e1a;
    --ink: #efe8dd;
    --ink-2: #a89d8f;
    --line: #35302a;
    --field-line: #7a7064;
    --amber: #d08a3c;
    --amber-ink: #1a1510;
    --amber-soft: #3a2b1a;
    --danger: #e0715c;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Lexend', system-ui, sans-serif;
  font-weight: 350;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 1120px; margin: 0 auto; padding: 40px 16px 64px; }
a { color: var(--amber); text-underline-offset: 3px; }
.muted { color: var(--ink-2); }
h1, h2 { font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

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

/* ---------- Botones ---------- */
.btn, button {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--field-line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.2s, filter 0.2s;
}
.btn.primary, button.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn:hover, button:hover { filter: brightness(0.96); }
.btn:active, button:active { transform: scale(0.98); }
button:disabled { opacity: 0.6; cursor: progress; }
button.danger { color: var(--danger); }
button.link {
  border: 0; background: none; padding: 0; color: var(--amber);
  text-decoration: underline; text-underline-offset: 3px; font-weight: 400;
}

/* ---------- Logo ---------- */
.logo { width: 56px; height: auto; display: block; flex: none; }
/* El logo es de trazo fino sobre fondo claro: en modo oscuro va sobre un círculo crema. */
@media (prefers-color-scheme: dark) { .logo { background: #f4f0e8; border-radius: 50%; padding: 6px; } }

/* ---------- Formulario ---------- */
.form-wrap { max-width: 600px; }
.form-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.form-head h1 { margin: 0 0 4px; font-size: clamp(1.6rem, 4.5vw, 2.2rem); }
.form-head p { margin: 0; }

form.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 32px);
}
.field { display: grid; gap: 8px; margin-bottom: 22px; min-width: 0; }
.field > * { min-width: 0; }
.field-label, legend { font-weight: 500; padding: 0; }
.optional { font-weight: 350; color: var(--ink-2); font-size: 0.9em; }
.hint { color: var(--ink-2); font-size: 0.86rem; }
.hint-row { display: flex; justify-content: space-between; gap: 12px; }
.counter { font-variant-numeric: tabular-nums; }
.counter.near { color: var(--danger); }

input[type='text'], input[type='url'], textarea {
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-field);
  padding: 11px 13px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 0.85; }
input[type='text']:focus, input[type='url']:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 22%, transparent);
}
textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }

/* Estrellas: radios en orden inverso para pintar las anteriores al pasar el mouse. */
.rating-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.rating { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label {
  font-size: 34px; line-height: 1; padding: 2px; color: var(--field-line); cursor: pointer;
  transition: color 0.15s, transform 0.15s var(--ease);
}
.rating input:checked ~ label,
.rating label:hover,
.rating label:hover ~ label { color: var(--amber); }
.rating label:active { transform: scale(0.9); }
.rating input:focus-visible + label { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
.rating-word { color: var(--ink-2); min-height: 1.5em; }

/* Foto: círculo de vista previa + botón propio en lugar del input nativo. */
.avatar-pick { display: flex; gap: 16px; align-items: center; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--amber-soft); border: 1px dashed var(--field-line);
}
.avatar-preview[src] { border-style: solid; border-color: var(--line); }
.avatar-actions { display: grid; gap: 6px; min-width: 0; }
.avatar-buttons { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-name { color: var(--ink-2); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[type='file'].visually-hidden:focus-visible + label { outline: 2px solid var(--amber); outline-offset: 3px; }
details.photo-link summary { cursor: pointer; color: var(--amber); font-size: 0.9rem; width: max-content; }
details.photo-link[open] summary { margin-bottom: 8px; }

.hp { position: absolute; left: -9999px; }
.form-error {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-field);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}
.submit-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.submit-row .hint { margin: 0; }

.panel.thanks h2 { margin: 0 0 8px; font-size: 1.5rem; }
.panel.thanks p { margin: 0 0 14px; color: var(--ink-2); max-width: 46ch; }
.order-banner {
  margin: 0 0 22px; padding: 10px 14px; border-radius: var(--radius-field);
  background: var(--amber-soft); color: var(--ink); font-size: 0.92rem;
}
.gift-code { margin: 0 0 18px; padding: 16px 18px; border-radius: var(--radius-field); background: var(--amber-soft); }
.gift-code p { margin: 0; }
.gift-code .code { margin-top: 8px; font-size: 1.5rem; font-weight: 600; letter-spacing: 0.12em; color: var(--amber); user-select: all; }
.panel.thanks .signature { margin: 0; color: var(--amber); font-weight: 500; }

/* ---------- Movimiento: solo si la persona no pidió reducirlo ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 0.6s var(--ease) both; }
  .rise-2 { animation-delay: 0.08s; }
  .rise-3 { animation-delay: 0.16s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
