/* ---------- Fontes (auto-hospedadas, OFL) ---------- */
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Gowun Batang";
  src: url("/fonts/gowun-batang-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Gowun Batang";
  src: url("/fonts/gowun-batang-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Paleta do photocard ARIRANG em São Paulo */
  --paper: #f3f3f3;      /* fundo cinza-claro */
  --card: #ffffff;       /* superfícies, como a janela do photocard */
  --line: #d6d6d6;       /* bordas */
  --line-strong: #a8a8a8;
  --ink: #000000;        /* texto e estrelas pretas */
  --muted: #5c5c5c;
  --red: #9f0811;        /* vermelho do título da turnê */
  --red-hover: #b80d17;
  --red-soft: #f7e4e5;
  --error: #9f0811;

  --serif: "Gowun Batang", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);

  --radius-s: 10px;
  --radius-m: 14px;
  --gutter: 16px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.page { min-height: 100dvh; }

.stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #ffffff 0%, transparent 60%),
    var(--paper);
  padding: 28px var(--gutter) 0;
}
.stage__inner { max-width: 640px; margin: 0 auto; position: relative; z-index: 1; }

.brush { color: var(--red); }
.brush svg { display: block; fill: currentColor; }
.brush .brush__h { width: min(78vw, 340px); height: auto; }
.brush .brush__v { display: none; }

.stage__text { margin-top: 14px; }
.stage__event { font-family: var(--serif); font-weight: 700; font-size: var(--step-1); letter-spacing: 0.01em; }
.stage__venue { color: var(--muted); font-size: var(--step--1); }

.ridges { display: block; width: calc(100% + 2 * var(--gutter)); margin: 18px calc(-1 * var(--gutter)) 0; height: 64px; }
.ridge { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ridge--3 { stroke: #c4c4c4; stroke-width: 1.5; }
.ridge--2 { stroke: var(--ink); stroke-width: 1.5; }
.ridge--1 { stroke: var(--red); stroke-width: 2.5; }

.sheet {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px var(--gutter) calc(32px + env(safe-area-inset-bottom));
}

/* Produto (topo da página) */
.product {
  display: grid;
  gap: 14px;
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.product__media {
  margin: 0 0 6px;
  overflow: hidden;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
}
.product__media img { display: block; width: 100%; height: auto; }
.product__name { font-size: var(--step-3); color: var(--red); }
.product__specs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.product__specs li {
  padding: 6px 12px;
  font-size: var(--step--1);
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.product__desc { max-width: 62ch; }
.product__desc--soft { color: var(--muted); }
.product__gift {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  background: var(--red-soft);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-s);
}
.product__gift-title { font-weight: 700; color: var(--red); }

.intro h1 { font-size: var(--step-3); }
.intro p { color: var(--muted); margin-top: 10px; max-width: 52ch; }

/* ---------- Form ---------- */
.form { margin-top: 28px; display: grid; gap: 28px; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
.field > label, legend {
  font-weight: 600;
  font-size: var(--step-1);
  padding: 0;
}
legend { margin-bottom: 10px; }
.hint { color: var(--muted); font-size: var(--step--1); margin-top: -6px; margin-bottom: 4px; }

input[type="text"], input[type="tel"] {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  font-size: var(--step-1); /* >=16px evita zoom no iOS */
  transition: border-color 0.15s;
}
input::placeholder { color: #9a9a9a; }
input[type="text"]:hover, input[type="tel"]:hover { border-color: var(--line-strong); }
input[type="text"]:focus-visible, input[type="tel"]:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(159 8 17 / 0.18); }
[aria-invalid="true"] { border-color: var(--error) !important; }

.error { color: var(--error); font-size: var(--step--1); font-weight: 500; }

/* Dias: ingressos com picote */
.tickets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ticket { position: relative; cursor: pointer; }
.ticket input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ticket__body {
  display: grid;
  gap: 2px;
  padding: 14px 8px 12px;
  text-align: center;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-s);
  /* recortes laterais do ingresso */
  -webkit-mask: radial-gradient(circle 7px at 0 62%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 7px at 100% 62%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 7px at 0 62%, #0000 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 7px at 100% 62%, #0000 98%, #000) right / 51% 100% no-repeat;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.ticket__weekday { font-size: var(--step--1); color: var(--muted); }
.ticket__date { font-family: var(--serif); font-weight: 700; font-size: var(--step-2); line-height: 1.1; }
.ticket__perf { border-top: 1.5px dashed var(--line); margin: 8px 10px 4px; }
.ticket__tag { font-size: 0.75rem; color: var(--muted); }
.ticket:hover .ticket__body { border-color: var(--line-strong); }
.ticket input:checked + .ticket__body {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
  transform: translateY(-2px);
}
.ticket input:checked + .ticket__body .ticket__weekday,
.ticket input:checked + .ticket__body .ticket__tag { color: #f3d3d5; }
.ticket input:checked + .ticket__body .ticket__perf { border-color: #f3d3d5; }
.ticket input:focus-visible + .ticket__body { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Setores */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.pill:hover span { border-color: var(--line-strong); }
.pill input:checked + span { background: var(--red-soft); border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); color: var(--red); font-weight: 600; }
.pill input:checked + span::before {
  content: "";
  width: 8px; height: 8px; margin-right: 8px;
  border-radius: 50%;
  background: var(--red);
}
.pill input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Quantidade */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper__btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.stepper__btn:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.stepper__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper input {
  width: 3.2ch;
  min-width: 72px;
  height: 64px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.5rem;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--red);
  border-radius: 0;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus-visible { outline: none; border-bottom-color: var(--ink); background: var(--card); }
.stepper__unit { color: var(--muted); }

/* Sim / Não */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-m);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.segmented input:checked + span { background: var(--ink); color: #ffffff; font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }

/* Campo que aparece quando escolhe "Sim" */
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.25s ease; }
.reveal.is-open { grid-template-rows: 1fr; }
.reveal__inner { overflow: hidden; display: grid; gap: 12px; }
.reveal.is-open .reveal__inner { padding-top: 14px; }
.field--nested > label { font-size: var(--step-0); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; color: var(--muted); font-size: var(--step--1); }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--red); }

/* Cards por dia (aparecem quando o dia é marcado) */
.day-details { display: grid; gap: 14px; }
.day-details:not(:has(.day-card:not([hidden]))) { display: none; }
.day-card {
  display: grid;
  gap: 18px;
  padding: 18px 16px 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius-m);
}
.day-card__title { font-size: var(--step-2); }
.day-card__title [data-role="weekday"] { color: var(--muted); font-weight: 400; }
.day-card .field > label, .day-card legend { font-size: var(--step-0); }
.day-card .pill span,
.day-card .segmented,
.day-card .stepper__btn { background: var(--paper); }
.day-card .pill input:checked + span { background: var(--red-soft); }
.segmented--compact { max-width: 280px; }
.error--block { margin-top: -14px; }

@media (prefers-reduced-motion: no-preference) {
  .day-card:not([hidden]) { animation: card-in 0.2s ease-out; }
}
@keyframes card-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (min-width: 960px) {
  .day-card { padding: 22px 24px 24px; }
}

/* Envio */
.submit { display: grid; gap: 12px; }
.turnstile:empty { display: none; }
.status { font-size: var(--step--1); color: var(--muted); min-height: 1.5em; }
.status.is-error { color: var(--error); }
.button {
  min-height: 56px;
  padding: 14px 24px;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--red);
  color: #ffffff;
  font-weight: 700;
  font-size: var(--step-1);
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.button:hover:not(:disabled) { background: var(--red-hover); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: 0.6; cursor: progress; }
.button.button--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.button.button--ghost:hover:not(:disabled) { background: var(--card); border-color: var(--ink); }

/* Sucesso */
.done { margin-top: 28px; padding: 28px 20px; display: grid; gap: 12px; justify-items: start; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-m); }
.done:focus { outline: none; }
.done__mark { width: 48px; height: 48px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.done__mark circle { stroke: var(--ink); }
.done__mark path { stroke: var(--red); }
.done h2 { font-size: var(--step-2); }
.done p { color: var(--muted); }
.done .button { margin-top: 8px; }

.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 0.8125rem; color: #7a7a7a; }

.foot__credit { margin-top: 4px; color: var(--muted); }
.foot a { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; transition: color 0.15s, text-decoration-color 0.15s; }
.foot a:hover { color: var(--red); text-decoration-color: var(--red); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.noscript { padding: 16px; text-align: center; background: var(--card); }

/* ---------- Telas largas: palco fixo à esquerda, formulário à direita ---------- */
@media (min-width: 960px) {
  .page { display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; }

  .stage {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    padding: 48px 40px 0;
    display: flex;
    flex-direction: column;
    background:
      radial-gradient(90% 60% at 30% 10%, #ffffff 0%, transparent 65%),
      var(--paper);
    border-right: 1px solid var(--line);
  }
  .stage__inner { margin: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
  .brush .brush__h { display: none; }
  .brush .brush__v { display: block; height: min(54vh, 520px); width: auto; }
  .stage__event { font-size: var(--step-2); }
  .stage__venue { font-size: var(--step-0); }

  .ridges { width: calc(100% + 80px); margin: 0 -40px; height: 120px; }

  .sheet { margin: 0; padding: 72px 56px 48px; max-width: 680px; }
}

@media (min-width: 1280px) {
  .sheet { padding-left: 96px; }
}

/* ---------- Um único momento de entrada ---------- */
@media (prefers-reduced-motion: no-preference) {
  .brush svg { animation: ink 1.1s cubic-bezier(.6, 0, .2, 1) both; }
  .brush__h { --from: inset(0 100% 0 0); }
  .brush__v { --from: inset(0 0 100% 0); }
  .ridges { --from: inset(0 100% 0 0); animation: ink 1.6s cubic-bezier(.4, 0, .2, 1) 0.35s both; }
}
@keyframes ink { from { clip-path: var(--from); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
