/* Concepto: un libro de opiniones de local — cartulinas de reseña clavadas
   en un muro de lino, con el verde salvia de PN como tinta de firma. */
:root {
  --linen: #EEE6DA;      /* fondo */
  --paper: #FBF7F0;      /* tarjeta crema */
  --cocoa: #3E2C21;      /* tarjeta oscura / puertas */
  --ink: #2A1E17;        /* texto */
  --caramel-a: #D6B391;  /* tarjeta caramelo, arriba */
  --caramel-b: #A47A58;  /* tarjeta caramelo, abajo */
  --sage: #B6D774;       /* acento PN */
  --sage-deep: #5E7A22;  /* acento legible sobre claro */
  --muted: #7A6758;
  --line: rgba(42, 30, 23, .14);

  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --f-script: "Pinyon Script", "Brush Script MT", cursive;

  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-display);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* grano suave de papel */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .18 0 0 0 0 .12 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .bar, .foot { position: relative; z-index: 1; }
a { color: inherit; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--sage); color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 18px; font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 600; color: var(--muted);
}

/* ---------- Apertura ---------- */
.intro { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; }
.door {
  position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--cocoa); overflow: hidden;
  animation: doorOpen .9s var(--ease) 2.15s forwards;
}
.door-l { left: 0; border-right: 1px solid rgba(182, 215, 116, .5); }
.door-r { right: 0; --dir: 1; }
.door-l { --dir: -1; }
.door-word {
  position: absolute; bottom: -0.18em; width: 100vw; text-align: center; white-space: nowrap; color: rgba(251, 247, 240, .05);
  font-weight: 900; font-stretch: 125%; font-size: 15vw; line-height: 1; letter-spacing: -.02em;
}
.door-l .door-word { left: 0; }
.door-r .door-word { right: 0; }
@keyframes doorOpen { to { transform: translateX(calc(var(--dir) * 102%)); } }

.intro-inner {
  position: relative; display: grid; justify-items: center; gap: 6px; color: var(--paper); text-align: center;
  padding-inline: 16px;
  animation: innerOut .45s ease 1.85s forwards;
}
@keyframes innerOut { to { opacity: 0; transform: translateY(-14px); } }
.seal {
  width: 132px; height: 132px; border-radius: 50%; background: var(--sage); color: var(--ink);
  display: grid; place-items: center; position: relative; margin-bottom: 22px;
  animation: stamp .55s cubic-bezier(.3, 1.6, .5, 1) .1s both;
  box-shadow: 0 0 0 6px rgba(182, 215, 116, .18);
}
.seal span { font-weight: 900; font-stretch: 125%; font-size: 34px; letter-spacing: -.02em; }
.seal-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 9s linear infinite; }
.seal-ring text { font: 600 11px/1 var(--f-display); letter-spacing: .16em; fill: var(--ink); }
@keyframes stamp { from { transform: scale(2.2) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
.intro-line { margin: 0; overflow: hidden; }
.l1 {
  font-weight: 800; font-stretch: 125%; text-transform: uppercase; font-size: clamp(34px, 7vw, 84px);
  line-height: .95; letter-spacing: -.01em; animation: rise .7s var(--ease) .55s both;
}
.l2 { font-size: clamp(28px, 5vw, 60px); line-height: 1.1; font-weight: 300; animation: rise .7s var(--ease) .8s both; }
.l2 em { color: var(--sage); }
@keyframes rise { from { transform: translateY(110%); opacity: 0; } to { transform: none; opacity: 1; } }
.skip {
  position: absolute; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: none; border: 1px solid rgba(251, 247, 240, .35); color: var(--paper);
  font: 500 13px var(--f-display); padding: 8px 14px; border-radius: 99px; cursor: pointer;
  animation: innerOut .3s ease 2.1s forwards;
}
.skip:hover { border-color: var(--sage); color: var(--sage); }
.intro.is-done { display: none; }
.intro.is-skipping .door { animation: doorOpen .6s var(--ease) forwards; }
.intro.is-skipping .intro-inner, .intro.is-skipping .skip { animation: innerOut .2s ease forwards; }

/* ---------- Barra ---------- */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(238, 230, 218, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; font-weight: 800; font-stretch: 125%; letter-spacing: .02em; font-size: 15px; }
.brand span, .foot-big span { color: var(--sage-deep); }
.bar-nav { display: flex; gap: 22px; align-items: center; font-size: 14px; }
.bar-nav a { text-decoration: none; }
.bar-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.bar-cta { background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 99px; }
.bar-cta:hover { background: var(--sage); color: var(--ink); text-decoration: none !important; }
@media (max-width: 520px) { .bar-nav a:not(.bar-cta) { display: none; } .bar-cta { font-size: 13px; } }

.demo-banner {
  margin: 18px var(--gutter) 0; padding: 12px 16px; border: 1px dashed var(--sage-deep); border-radius: 10px;
  background: rgba(182, 215, 116, .18); font-size: 14px;
}
.demo-banner code { font-size: 13px; background: rgba(42,30,23,.08); padding: 1px 5px; border-radius: 4px; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px);
  grid-template-areas: "title title" "copy score"; align-items: end; padding: clamp(40px, 8vw, 110px) var(--gutter) clamp(40px, 6vw, 80px);
}
.hero-title { display: contents; }
.hero-head { grid-area: title; }
.hero-copy { grid-area: copy; align-self: start; }
.score { grid-area: score; }
.hero h1 { margin: 0; position: relative; line-height: .82; }
.script {
  display: block; font-family: var(--f-script); font-weight: 400; color: var(--sage-deep);
  font-size: clamp(48px, 9vw, 130px); line-height: 1; margin-bottom: -.32em; margin-left: .35em;
  position: relative; z-index: 2; transform: rotate(-6deg); transform-origin: left bottom;
}
.big {
  display: block; font-weight: 900; font-stretch: 125%; letter-spacing: -.035em;
  font-size: clamp(48px, 12.4vw, 230px); color: var(--cocoa); white-space: nowrap;
}
.lede { font-size: clamp(19px, 2.2vw, 28px); line-height: 1.3; max-width: 30ch; margin: 0 0 28px; text-wrap: balance; }
.lede em { font-size: 1.12em; color: var(--sage-deep); }
.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; cursor: pointer;
  background: var(--sage); color: var(--ink); border: 0; font: 600 16px var(--f-display);
  padding: 14px 22px; border-radius: 99px; transition: transform .25s var(--ease), background .2s;
}
.btn:hover { transform: translateY(-2px) rotate(-1deg); background: #c4e386; }
.btn span { transition: transform .25s var(--ease); }
.btn:hover span { transform: translate(2px, -2px); }

.score {
  background: var(--cocoa); color: var(--paper); border-radius: 22px; padding: 26px 26px 22px;
  transform: rotate(1.5deg); box-shadow: 0 30px 50px -30px rgba(42, 30, 23, .6);
}
.score-top { display: flex; align-items: center; gap: 18px; }
.score-num { font-weight: 900; font-stretch: 125%; font-size: clamp(64px, 7vw, 92px); line-height: .9; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.score-meta { margin: 6px 0 0; font-size: 14px; color: rgba(251, 247, 240, .7); }
.dist { list-style: none; padding: 0; margin: 22px 0 14px; display: grid; gap: 7px; }
.dist li { display: grid; grid-template-columns: 26px 1fr 30px; align-items: center; gap: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.dist .track { height: 6px; border-radius: 6px; background: rgba(251, 247, 240, .12); overflow: hidden; }
.dist .fill { display: block; height: 100%; background: var(--sage); border-radius: 6px; width: 0; transition: width 1s var(--ease); }
.dist .n { text-align: right; color: rgba(251, 247, 240, .7); }
.score-note { margin: 0; font-size: 12px; color: rgba(251, 247, 240, .5); }

/* ---------- Estrellas ---------- */
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 15px; height: 15px; }
.stars-lg svg { width: 22px; height: 22px; }
.stars .on { fill: currentColor; }
.stars .off { fill: currentColor; opacity: .22; }
.score .stars { color: var(--sage); }

/* ---------- Muro ---------- */
.wall-wrap { padding: clamp(30px, 5vw, 60px) var(--gutter) clamp(50px, 7vw, 100px); border-top: 1px solid var(--line); }
.wall-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 34px; }
.wall-head h2, .leave h2 {
  margin: 0; font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: -.02em;
  font-size: clamp(38px, 6vw, 80px); line-height: .95;
}
.wall-head h2 em, .leave h2 em { text-transform: none; font-size: 1.15em; color: var(--sage-deep); }
.tools { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 13px var(--f-display); padding: 7px 13px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink); transition: background .2s, border-color .2s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .k { opacity: .55; margin-left: 4px; font-variant-numeric: tabular-nums; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
select {
  font: 500 14px var(--f-display); color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 32px 8px 12px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%232A1E17' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

.wall { columns: 3 300px; column-gap: 28px; }
.card {
  break-inside: avoid; display: block; margin: 0 0 30px; padding: 22px 22px 18px; border-radius: 16px;
  background: var(--paper); color: var(--ink);
  transform: rotate(var(--r, 0deg)) translateY(0);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 34px -22px rgba(42, 30, 23, .55);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
  position: relative;
}
.card:hover { transform: rotate(0deg) translateY(-4px) scale(1.015); box-shadow: 0 26px 44px -22px rgba(42, 30, 23, .6); z-index: 2; }
.card.t-cocoa { background: var(--cocoa); color: var(--paper); }
.card.t-caramel { background: linear-gradient(160deg, var(--caramel-a), var(--caramel-b)); color: #2A1E17; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card .stars { color: var(--ink); }
.card.t-cocoa .stars { color: var(--sage); }
.badge {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  background: var(--sage); color: var(--ink); padding: 3px 8px; border-radius: 99px;
}
.card-text { margin: 0 0 18px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-line; }
.card-text::before { content: "“"; font-family: var(--f-serif); font-size: 2.6em; line-height: 0; vertical-align: -.42em; margin-right: 2px; opacity: .45; }
.card-foot { display: flex; align-items: center; gap: 11px; padding-top: 14px; border-top: 1px solid currentColor; border-top-color: rgba(42,30,23,.15); }
.card.t-cocoa .card-foot { border-top-color: rgba(251,247,240,.15); }
.avatar {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; background: var(--cocoa); color: var(--paper);
}
.card.t-cocoa .avatar { background: var(--sage); color: var(--ink); }
.card.t-caramel .avatar { background: var(--paper); color: var(--cocoa); }
.who { min-width: 0; }
.who-name { margin: 0; font-weight: 700; font-size: 14px; }
.who-meta { margin: 0; font-size: 12px; opacity: .7; }
.badge.is-example { background: transparent; color: inherit; opacity: .6; border: 1px solid currentColor; }

/* llegada en cascada al abrir (visible en reposo) */
body.is-live .wall .card { animation: drop .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes drop {
  from { transform: translateY(-60px) rotate(calc(var(--r, 0deg) * 4)); opacity: 0; }
  to { transform: rotate(var(--r, 0deg)); opacity: 1; }
}
.card.is-fresh { animation: fresh 1.1s var(--ease) both !important; }
@keyframes fresh {
  0% { transform: translateY(-80px) rotate(-14deg) scale(1.08); opacity: 0; box-shadow: 0 0 0 0 rgba(182,215,116,.0); }
  60% { opacity: 1; box-shadow: 0 0 0 10px rgba(182,215,116,.55); }
  100% { transform: rotate(var(--r, 0deg)); box-shadow: 0 18px 34px -22px rgba(42,30,23,.55); }
}

.empty { text-align: center; padding: 40px 0; color: var(--muted); }
.empty-script { font-family: var(--f-script); font-size: 54px; color: var(--sage-deep); margin: 0; }

/* ---------- Formulario ---------- */
.leave { padding: clamp(50px, 8vw, 110px) var(--gutter); background: var(--paper); border-top: 1px solid var(--line); }
.leave-copy { max-width: 640px; margin-bottom: 40px; }
.leave-copy p:last-child { font-size: 18px; color: var(--muted); margin: 18px 0 0; max-width: 55ch; }
.leave-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 70px); align-items: start; }
.form { display: grid; gap: 22px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .rate legend { font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.opt { font-weight: 400; color: var(--muted); }
input[type="text"], textarea, .field select {
  width: 100%; font: 400 16px/1.45 var(--f-display); color: var(--ink);
  background: var(--linen); border: 1px solid transparent; border-radius: 12px; padding: 13px 14px;
  transition: border-color .2s, background .2s;
}
input[type="text"]::placeholder, textarea::placeholder { color: #A8978A; }
input[type="text"]:focus, textarea:focus, .field select:focus { outline: none; border-color: var(--ink); background: #fff; }
textarea { resize: vertical; min-height: 130px; }
.field select { background-color: var(--linen); padding-right: 32px; }
.field-foot { display: flex; justify-content: space-between; gap: 10px; }
.counter { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.err { margin: 0; font-size: 13px; color: #A23B1E; }
.invalid { border-color: #A23B1E !important; }

.rate { border: 0; padding: 0; margin: 0; }
.rate legend { padding: 0; margin-bottom: 10px; }
.rate-stars { display: flex; gap: 6px; }
.rate-stars input { position: absolute; opacity: 0; pointer-events: none; }
.rate-stars label {
  width: 52px; height: 52px; cursor: pointer; display: block; color: var(--line);
  background: currentColor;
  -webkit-mask: var(--star) center / contain no-repeat; mask: var(--star) center / contain no-repeat;
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.8l3.1 6.6 7.2.9-5.3 5 1.4 7.1L12 17.9l-6.4 3.5 1.4-7.1-5.3-5 7.2-.9z'/%3E%3C/svg%3E");
  transition: transform .25s var(--ease), color .15s;
}
.rate-stars label { color: rgba(42, 30, 23, .16); }
.rate-stars label.lit { color: var(--cocoa); }
.rate-stars label.lit.hot { color: var(--sage-deep); }
.rate-stars label:hover { transform: scale(1.12) rotate(-6deg); }
.rate-stars input:focus-visible + label { outline: 2px solid var(--sage-deep); outline-offset: 2px; border-radius: 6px; }
.rate-stars label.pop { animation: pop .4s var(--ease); }
@keyframes pop { 50% { transform: scale(1.3) rotate(10deg); } }
.rate-word { margin: 8px 0 0; font-family: var(--f-serif); font-style: italic; font-size: 24px; min-height: 1.3em; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn-send { justify-self: start; font-size: 17px; padding: 16px 26px; background: var(--ink); color: var(--paper); }
.btn-send:hover { background: var(--sage); color: var(--ink); }
.btn-send[disabled] { opacity: .6; cursor: wait; transform: none; }
.form-msg { margin: 0; min-height: 1.4em; font-size: 15px; }
.form-msg.ok { color: var(--sage-deep); font-weight: 600; }
.form-msg.bad { color: #A23B1E; }

.preview { position: sticky; top: 90px; padding: 34px 30px 14px; border-radius: 22px; background: var(--linen); }
.preview-label { margin: 0 0 22px; font-family: var(--f-script); font-size: 30px; color: var(--sage-deep); line-height: 1; }
.preview .card { --r: -2deg; }
.preview .card-text.placeholder { opacity: .45; }

/* ---------- Pie ---------- */
.foot { background: var(--cocoa); color: var(--paper); padding: clamp(40px, 6vw, 70px) var(--gutter) calc(30px + env(safe-area-inset-bottom, 0px)); }
.foot-big { margin: 0; font-weight: 900; font-stretch: 125%; font-size: clamp(36px, 9vw, 130px); line-height: .9; letter-spacing: -.03em; overflow-wrap: anywhere; }
.foot-big span { color: var(--sage); }
.foot-links { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 28px 0 18px; }
.foot-links a { text-decoration: none; border-bottom: 1px solid rgba(251,247,240,.3); padding-bottom: 2px; }
.foot-links a:hover { color: var(--sage); border-color: var(--sage); }
.foot-small { margin: 0; font-size: 13px; color: rgba(251, 247, 240, .55); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .hero, .leave-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-areas: "title" "copy" "score"; }
  .score { max-width: 460px; }
  .preview { position: static; }
}
@media (max-width: 560px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .rate-stars label { width: 46px; height: 46px; }
  .wall { columns: 1; }
  .card { margin-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .intro { display: none; }
  html { scroll-behavior: auto; }
}
