/* Clube do Álbum — capa de LP: cartão prensado, duas tintas, um único círculo na página. */

:root {
  --board: #14120f;          /* cartão da capa: o chão de tudo */
  --panel: #1d1a16;          /* painel interno, o encarte */
  --bone: #f1eadc;           /* papel: todo texto principal */
  --bone-2: #b3a895;         /* texto secundário, tingido do chão — nunca cinza neutro */
  --hair: rgba(241, 234, 220, 0.16);
  --scarlet: #e8503a;        /* a segunda tinta: ação, edição corrente, alerta */

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --rule: 2px;

  --mono: "Courier Prime", ui-monospace, "SFMono-Regular", monospace;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --snap: 180ms cubic-bezier(0.2, 0, 0.1, 1);
  --pull: 620ms cubic-bezier(0.16, 1, 0.3, 1);   /* saída exponencial: o disco sai e assenta */
}

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

html { color-scheme: dark; scrollbar-color: var(--bone-2) var(--board); }

body {
  margin: 0;
  background: var(--board);
  color: var(--bone);
  font-family: var(--sans);
  font-variation-settings: "wdth" 100;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--scarlet); color: var(--board); }

:where(a) { color: inherit; }

:where(button, input, a):focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 2px;
}

input { caret-color: var(--scarlet); }

h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }

/* ─── Lombada ─────────────────────────────────────────────────────────────── */

.spine {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem var(--gutter);
  padding: 0.85rem var(--gutter);
  background: var(--board);
  border-bottom: var(--rule) solid var(--bone);
}

.spine__id {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-right: auto;
  text-decoration: none;
}

.spine__name {
  font-size: 1.05rem;
  font-weight: 800;
  font-variation-settings: "wdth" 118;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.spine__cat {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--bone-2);
}

.tabs { display: flex; gap: 1.5rem; }

.tab {
  padding: 0.35rem 0 0.5rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--bone-2);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  font-variation-settings: "wdth" 108;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--snap), border-color var(--snap);
}
.tab:hover { color: var(--bone); }
.tab[aria-current="page"] { color: var(--bone); border-bottom-color: var(--scarlet); }

.key { display: flex; gap: 0.5rem; }

.key__input {
  width: 10.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--hair);
  background: var(--panel);
  color: var(--bone);
  font: inherit;
  font-size: 0.875rem;
}
.key__input::placeholder { color: var(--bone-2); }
body[data-unlocked] .key__input { display: none; }

/* ─── Botões ──────────────────────────────────────────────────────────────── */

.btn {
  border: 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--snap), color var(--snap), border-color var(--snap), transform var(--snap);
}
.btn:disabled { cursor: not-allowed; opacity: 0.45; }

.btn--ghost {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--bone-2);
  background: none;
  color: var(--bone-2);
  font-size: 0.8rem;
}
.btn--ghost:not(:disabled):hover { border-color: var(--bone); color: var(--bone); }

.btn--solid {
  padding: 0.55rem 1rem;
  background: var(--bone);
  color: var(--board);
  font-size: 0.8rem;
}
.btn--solid:not(:disabled):hover { background: #fff; }

/* O maior controle da página, e o único bloco de tinta chapada. */
.btn--press {
  width: 100%;
  margin-top: 1.75rem;
  padding: 1.15rem 1.25rem;
  background: var(--scarlet);
  color: var(--board);
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  font-weight: 900;
  font-variation-settings: "wdth" 112;
  letter-spacing: 0.05em;
}
/* Desabilitado não é tinta desbotada: vira contorno, que é o que um bloco impresso ausente parece. */
.btn--press:disabled { background: none; border: 1px solid var(--bone-2); color: var(--bone-2); opacity: 1; }
.btn--press:not(:disabled):hover { background: #f2604a; transform: translateY(-1px); }
.btn--press:not(:disabled):active { transform: translateY(1px); }

.btn--link {
  padding: 0;
  background: none;
  color: var(--bone-2);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--hair);
}
.btn--link:hover { color: var(--scarlet); text-decoration-color: currentColor; }

/* ─── Errata ──────────────────────────────────────────────────────────────── */

.errata {
  margin: 0;
  padding: 0.7rem var(--gutter);
  background: var(--scarlet);
  color: var(--board);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ─── Estrutura ───────────────────────────────────────────────────────────── */

/* clip, não hidden: o disco sangra na borda do celular sem criar rolagem lateral. */
main { max-width: 78rem; margin: 0 auto; padding: var(--gutter); overflow-x: clip; }
.view[hidden] { display: none; }

.section-head { margin-bottom: 2rem; }
.section-head__title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  font-variation-settings: "wdth" 108;
  letter-spacing: -0.03em;
  line-height: 1;
  text-wrap: balance;
}
.section-head__note { max-width: 46ch; margin-top: 0.6rem; color: var(--bone-2); }

/* ─── Sorteio: o envelope e o disco ───────────────────────────────────────── */

.view--press {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding-block: clamp(1rem, 4vw, 3rem);
}
@media (min-width: 62rem) {
  .view--press { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.stage { display: flex; justify-content: center; padding-right: 38%; }
.credits { position: relative; z-index: 2; }

.sleeve {
  position: relative;
  width: min(100%, 26rem);
  aspect-ratio: 1;
}

.jacket {
  position: relative;
  z-index: 1;
  transform: translate3d(var(--tremida, 0px), 0, 0);
  transition: transform 90ms ease-out;
  width: 100%;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--hair);
  box-shadow: 0 26px 50px -24px rgba(0, 0, 0, 0.95);
  overflow: hidden;
}
.jacket img { width: 100%; height: 100%; object-fit: cover; }

/* Capa que não veio: o envelope branco de fábrica, com o furo e o carimbo do título. */
.jacket__blank {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--hair);
}
.jacket__blank strong {
  font-size: 1.5rem;
  font-weight: 900;
  font-variation-settings: "wdth" 92;
  line-height: 1.05;
  text-wrap: balance;
}
.jacket__blank span { margin-top: 0.35rem; color: var(--bone-2); font-family: var(--mono); font-size: 0.8rem; }

.disc {
  position: absolute;
  top: 3%;
  left: 0;
  z-index: 0;
  width: 94%;
  height: 94%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #0b0a09 0 3%, transparent 3%),
    repeating-radial-gradient(circle at 50% 50%, #1f1b17 0 1px, #2b2621 1px 3px);
  display: grid;
  place-items: center;
  transform: translateX(2%);
  transition: transform var(--pull);
}
.disc::before {
  content: "";
  position: absolute;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: var(--scarlet);
}
.disc::after {
  content: "";
  position: absolute;
  width: 3.5%;
  height: 3.5%;
  border-radius: 50%;
  background: var(--board);
}
.disc__label {
  position: relative;
  z-index: 1;
  margin-top: 22%;
  color: var(--board);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.sleeve.is-out .disc { transform: translateX(68%) rotate(18deg); }
.sleeve.is-tucking .disc { transition-duration: 240ms; }

/* ─── Créditos da edição ──────────────────────────────────────────────────── */

.stamp {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--scarlet);
}

.credits__title {
  margin-top: 0.75rem;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 900;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.04em;
  line-height: 0.98;
  text-wrap: balance;
}

.credits__artist {
  margin-top: 0.6rem;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 500;
  color: var(--bone-2);
}

.credits__owner {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hair);
  color: var(--bone-2);
}
.credits__owner b { color: var(--bone); font-weight: 800; }

.credits__pool {
  margin-top: 1rem;
  color: var(--bone-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.credits__undo { margin-top: 1rem; }

/* ─── Pessoas ─────────────────────────────────────────────────────────────── */

.new-person { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2.5rem; }

.field {
  flex: 1 1 16rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--hair);
  background: var(--panel);
  color: var(--bone);
  font: inherit;
}
.field::placeholder { color: var(--bone-2); }
.field:hover { border-color: var(--bone-2); }

.member { padding: 1.75rem 0; border-top: 1px solid var(--hair); }
.member:first-child { border-top: 0; padding-top: 0; }

.member__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem 1rem; margin-bottom: 1.25rem; }

.member__name {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 900;
  font-variation-settings: "wdth" 100;
  letter-spacing: -0.02em;
  line-height: 1;
}

.member__count {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--bone-2);
}
.member__count[data-full] { color: var(--scarlet); }

.member__acts { display: flex; gap: 1rem; margin-left: auto; }

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

.slot { position: relative; }

.slot__art {
  position: relative;
  aspect-ratio: 1;
  background: var(--panel);
  border: 1px solid var(--hair);
  overflow: hidden;
}
.slot__art img { width: 100%; height: 100%; object-fit: cover; transition: filter var(--snap); }
.slot__art--empty { display: grid; place-items: center; width: 100%; height: 100%; padding: 0.5rem; text-align: center; }
.slot__art--empty span { color: var(--bone-2); font-family: var(--mono); font-size: 0.7rem; }

/* Já sorteado: o estado é lido na forma (carimbo + número), não só na cor. */
.slot[data-drawn] .slot__art img { filter: grayscale(1) brightness(0.42) contrast(1.05); }
.slot[data-drawn] .slot__art::after {
  content: attr(data-stamp);
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 0.2rem 0.45rem;
  border: 2px solid var(--scarlet);
  color: var(--scarlet);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-7deg);
}

.slot__meta { margin-top: 0.5rem; }
.slot__title { font-size: 0.85rem; font-weight: 700; line-height: 1.25; }
.slot__artist { color: var(--bone-2); font-size: 0.78rem; line-height: 1.3; }

.slot__kill {
  position: absolute;
  top: 0;
  right: 0;
  width: 1.9rem;
  height: 1.9rem;
  border: 0;
  background: var(--board);
  color: var(--bone-2);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--snap), color var(--snap);
}
.slot:hover .slot__kill, .slot__kill:focus-visible { opacity: 1; }
.slot__kill:hover { color: var(--scarlet); }

.slot--add button {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px dashed var(--bone-2);
  background: none;
  color: var(--bone-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--snap), color var(--snap);
}
.slot--add button:hover { border-color: var(--scarlet); color: var(--scarlet); }

/* ─── Busca de álbum (inline, sem modal) ─────────────────────────────────── */

.finder { margin-top: 1.25rem; padding: 1.25rem; background: var(--panel); }
.finder__label {
  display: inline-block;
  margin-bottom: 0.9rem;
  padding: 0.2rem 0.5rem;
  background: var(--scarlet);
  color: var(--board);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.finder__form { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.finder__hits { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.5rem; margin-top: 1.25rem; }

.hit {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--snap), border-color var(--snap);
}
.hit:hover { background: var(--board); border-color: var(--hair); }
.hit img, .hit .hit__void { display: block; width: 3rem; height: 3rem; flex: none; background: var(--board); object-fit: cover; }
.hit__title { font-size: 0.85rem; font-weight: 700; line-height: 1.2; }
.hit__artist { color: var(--bone-2); font-size: 0.78rem; }

.finder__mao-abre { margin-top: 1rem; }
.finder__mao { display: grid; gap: 0.6rem; margin-top: 1rem; max-width: 26rem; }

.skel { height: 3.5rem; background: var(--board); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ─── Registrar edição passada ────────────────────────────────────────────── */

.past { margin-bottom: 2rem; padding: 1.25rem; background: var(--panel); }
.past:empty { display: none; padding: 0; margin: 0; }

.past__form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: stretch; }
.past__form select { flex: 1 1 12rem; min-width: 0; }
.past__form input[type="date"] { flex: 0 1 11rem; }

/* Controle nativo com a roupa da casa: a seta e o calendário continuam sendo os do sistema. */
select.field { font-family: inherit; }
input[type="date"].field { font-family: var(--mono); font-size: 0.85rem; }

/* ─── Histórico ───────────────────────────────────────────────────────────── */

.edition {
  display: grid;
  grid-template-columns: 3.5rem 4.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  padding: 1.1rem 0;
  border-top: 1px solid var(--hair);
}
.edition:first-child { border-top: 0; }

.edition__no {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--bone-2);
}
.edition:first-child .edition__no { color: var(--scarlet); }

.edition__art { display: block; width: 100%; height: auto; aspect-ratio: 1; background: var(--panel); border: 1px solid var(--hair); object-fit: cover; }
.edition__title { font-size: 1.05rem; font-weight: 800; line-height: 1.2; }
.edition__artist { color: var(--bone-2); font-size: 0.9rem; }
.edition__foot {
  margin-top: 0.35rem;
  color: var(--bone-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.edition__foot b { color: var(--bone); }
.edition__foot .btn--link { font-size: inherit; letter-spacing: inherit; vertical-align: baseline; }

.archive__zerar { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--hair); }
.archive__zerar .btn--link:hover { color: var(--scarlet); }

/* ─── Vazios ──────────────────────────────────────────────────────────────── */

.blank { max-width: 42ch; padding: 2.5rem 0; }
.blank h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.blank p { margin-top: 0.5rem; color: var(--bone-2); }
.blank .btn { margin-top: 1.25rem; }

.locked-hide { display: none; }
body[data-unlocked] .locked-hide { display: flex; }
body[data-unlocked] .slot--add { display: block; }
.slot--add { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

@media (max-width: 48rem) {
  .spine { gap: 0.5rem 1rem; padding-block: 0.65rem; }
  .spine__id { margin-right: auto; }
  .key { order: 2; }
  /* Cabeçalho em duas linhas no celular: o código do selo sai, ele já está no Histórico. */
  .spine__name { font-size: 0.95rem; }
  .spine__cat { display: none; }
  .key__input { width: 6.5rem; }
  .btn--ghost { padding: 0.45rem 0.6rem; }
  .tabs { order: 3; width: 100%; gap: 1.25rem; }
  .tab { font-size: 0.82rem; }
  .edition { grid-template-columns: 2.25rem 3.5rem minmax(0, 1fr); gap: 0.85rem; }
  .edition__no { font-size: 1.1rem; }
}

@media (max-width: 62rem) {
  .stage { padding-right: 12%; }
}
