/* ============================================================
   TicketGo Public - Frontend per visitatori/clienti
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Manrope:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink:        #0d1117;
  --ink-2:      #1c2128;
  --paper:      #faf8f3;
  --paper-2:    #f3efe6;
  --line:       #e0d9c8;
  --line-2:     #c9bfa8;
  --muted:      #6e6557;
  --terracotta: #c44536;
  --terracotta-dark: #a73a2d;
  --gold:       #b08968;
  --green:      #4a7c59;
  --red:        #a4243b;

  --f-display: 'Instrument Serif', Georgia, serif;
  --f-body:    'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0 0 .4em 0;
}
h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.1rem; font-style: normal; font-family: var(--f-body); font-weight: 600; }

p { margin: 0 0 1em 0; }
a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.mono, .num { font-family: var(--f-mono); }

/* ============================================================
   HEADER PUBBLICO
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-header .wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .logo {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.site-header .logo a { color: inherit; text-decoration: none; }
.site-header .logo .tag {
  display: block;
  font-family: var(--f-body);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}
.site-header nav { display: flex; gap: 28px; align-items: center; }
.site-header nav a {
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
.site-header nav .lang {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.site-header nav .lang a.active { color: var(--terracotta); font-weight: 600; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 24px 32px;
}
.hero .kicker {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 16px;
}
.hero h1 { max-width: 22ch; margin-bottom: 16px; }
.hero .lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 60ch;
}

/* ============================================================
   GRID EVENTI
   ============================================================ */
.section { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }
.section-head {
  display: flex; justify-content: space-between; align-items: end;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; }
.section-head .sub {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
}
.event-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.event-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(13,17,23,.06);
}
.event-card a.cover-link { display: block; text-decoration: none; color: inherit; }
.event-card .cover {
  aspect-ratio: 16/10;
  background: var(--paper-2);
  position: relative;
  overflow: hidden;
}
.event-card .cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.event-card .cover .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-style: italic;
  color: var(--line-2); font-size: 4rem;
}
.event-card .body { padding: 22px 24px; flex: 1; display: flex; flex-direction: column; }
.event-card .date {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 8px;
}
.event-card h3 {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.5rem;
  margin: 0 0 8px;
}
.event-card h3 a { color: var(--ink); text-decoration: none; }
.event-card h3 a:hover { color: var(--terracotta); }
.event-card .place {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.event-card .cta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.event-card .price {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.3rem;
}
.event-card .price .free { color: var(--green); }

/* ============================================================
   EVENT DETAIL
   ============================================================ */
.event-detail {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.event-detail .crumbs {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}
.event-detail .crumbs a { color: var(--muted); }
.event-detail .crumbs a:hover { color: var(--terracotta); }

.event-detail .header {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}
@media (max-width: 800px) {
  .event-detail .header { grid-template-columns: 1fr; gap: 24px; }
}
.event-detail .header .info .kicker {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 12px;
}
.event-detail .header .info h1 { margin: 0 0 24px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
  margin-top: 16px;
}
.meta-grid .item .label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.meta-grid .item .val {
  font-family: var(--f-mono);
  font-size: 14px;
}

.event-detail .header .cover {
  aspect-ratio: 4/3;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.event-detail .header .cover img { width: 100%; height: 100%; object-fit: cover; }
.event-detail .header .cover .placeholder {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  color: var(--line-2);
  font-family: var(--f-display); font-style: italic;
  font-size: 6rem;
}

.event-detail .desc {
  font-size: 16px;
  max-width: 70ch;
  line-height: 1.75;
  margin-bottom: 48px;
  white-space: pre-line;
}

/* ============================================================
   TICKET TYPES / FORM ACQUISTO
   ============================================================ */
.buy-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 32px;
  position: relative;
}
.buy-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  transform: translate(6px, 6px);
  z-index: -1;
  background: var(--paper-2);
}
.buy-card h2 {
  font-size: 1.6rem;
  margin-bottom: 24px;
}
@media (max-width: 600px) {
  .buy-card { padding: 22px 18px; }
  .buy-card::before { transform: translate(4px, 4px); }
}

.ticket-type {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
}
.ticket-type:first-of-type { border-top: 0; padding-top: 0; }
.ticket-type .name {
  font-weight: 600;
  font-size: 15px;
}
.ticket-type .desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.ticket-type .price {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.6rem;
  white-space: nowrap;
}
.ticket-type .price .free { color: var(--green); font-size: 1.2rem; font-style: normal; font-family: var(--f-body); font-weight: 700; letter-spacing: 0.05em; }
.ticket-type .qty-control {
  display: flex; align-items: center; gap: 8px;
}
.ticket-type .qty-control button {
  width: 32px; height: 32px;
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  font-size: 16px;
}
.ticket-type .qty-control button:disabled {
  opacity: 0.4; cursor: not-allowed;
}
.ticket-type .qty-control input {
  width: 48px;
  height: 32px;
  text-align: center;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  font: 600 14px/1 var(--f-mono);
}
.ticket-type.sold-out { opacity: 0.55; }
.ticket-type.sold-out .qty-control { display: none; }
.ticket-type .sold-out-tag {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}

/* Mobile: riga biglietto su due livelli (nome sopra, prezzo+stepper sotto)
   evita che lo stepper "− 0 +" sbordi a destra su schermi stretti */
@media (max-width: 600px) {
  .ticket-type {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "info  info"
      "price qty";
    gap: 12px 12px;
    align-items: center;
  }
  .ticket-type > div:first-child { grid-area: info; min-width: 0; }
  .ticket-type .price       { grid-area: price; justify-self: start; }
  .ticket-type .qty-control { grid-area: qty; justify-self: end; }
}

.buy-summary {
  margin-top: 24px;
  padding: 20px 0 0;
  border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; align-items: baseline;
}
.buy-summary .label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.buy-summary .total {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 2.4rem;
  line-height: 1;
}
.buy-summary .total .free { color: var(--green); font-size: 1.4rem; font-family: var(--f-body); font-style: normal; font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 4px;
  border: 1px solid var(--terracotta);
  background: var(--terracotta);
  color: var(--paper);
  font: 600 14px/1 var(--f-body);
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.btn:hover { background: var(--terracotta-dark); border-color: var(--terracotta-dark); text-decoration: none; color: var(--paper); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.lg { padding: 16px 28px; font-size: 15px; }

/* ============================================================
   CHECKOUT FORM
   ============================================================ */
.checkout-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
}
@media (max-width: 800px) {
  .checkout-wrap { grid-template-columns: 1fr; }
}
.form-card, .order-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 32px;
}
.form-card h2, .order-summary h3 { margin-bottom: 24px; }

.fr { margin-bottom: 18px; }
.fr label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.fr input[type=text],
.fr input[type=email],
.fr input[type=tel] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  font: 400 15px var(--f-body);
  background: #fff;
}
.fr input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(196,69,54,.12);
}
.fr-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.order-summary .line {
  display: flex; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.order-summary .line:last-of-type { border-bottom: 0; }
.order-summary .line .qty { font-family: var(--f-mono); color: var(--muted); }
.order-summary .total {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; align-items: baseline;
}
.order-summary .total .label { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.order-summary .total .val { font-family: var(--f-display); font-style: italic; font-size: 2rem; }

/* ============================================================
   CONFERMA + BIGLIETTI
   ============================================================ */
.thanks {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}
.thanks-header {
  text-align: center;
  padding: 0 0 40px;
}
.thanks-header .check-mark {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 5rem;
  color: var(--green);
  line-height: 1;
}
.thanks-header h1 { margin: 16px 0 8px; }
.thanks-header .lead { color: var(--muted); }

.ticket {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 24px;
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 28px;
  align-items: center;
  position: relative;
}
.ticket::after {
  content: "";
  position: absolute;
  left: calc(100% - 180px - 28px - 14px);
  top: 24px; bottom: 24px;
  width: 0;
  border-left: 1px dashed var(--line-2);
}
@media (max-width: 600px) {
  .ticket { grid-template-columns: 1fr; text-align: center; }
  .ticket::after { display: none; }
}
.ticket .info .kicker {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 8px;
}
.ticket .info h3 {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.7rem;
  margin: 0 0 8px;
}
.ticket .info .type {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
.ticket .info .meta { font-size: 13px; color: var(--muted); }
.ticket .info .meta strong { color: var(--ink); font-weight: 600; }
.ticket .qr { text-align: center; }
.ticket .qr img {
  width: 160px; height: 160px; display: block; margin: 0 auto;
  border: 1px solid var(--line);
  background: #fff;
}
.ticket .qr .code {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  word-break: break-all;
}

.print-actions {
  text-align: center;
  margin: 32px 0;
  display: flex; justify-content: center; gap: 12px;
}

@media print {
  body { background: white; }
  .site-header, .print-actions, footer { display: none !important; }
  .ticket { page-break-inside: avoid; box-shadow: none; }
  .thanks { padding: 0; }
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 14px 18px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid;
  font-size: 14px;
}
.alert.error { background: #f7e0e5; border-color: var(--red); color: #5c1422; }
.alert.success { background: #e6efe7; border-color: var(--green); color: #2d4a35; }
.alert.info { background: var(--paper-2); border-color: var(--line-2); }

/* badges (per pagina biglietti riassuntiva) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid;
}
.badge.paid       { background: #e6efe7; border-color: var(--green); color: #2d4a35; }
.badge.pending    { background: #fef3d4; border-color: #c69214; color: #6b4d00; }
.badge.failed     { background: #f7e0e5; border-color: var(--red);  color: #5c1422; }
.badge.expired    { background: var(--paper-2); border-color: var(--line-2); color: var(--muted); }
.badge.refunded   { background: var(--paper-2); border-color: var(--line-2); color: var(--muted); }
.badge.cancelled  { background: var(--paper-2); border-color: var(--line-2); color: var(--muted); }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: rgba(250,248,243,.7);
  padding: 48px 24px 24px;
  margin-top: 48px;
}
footer .wrap {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}
@media (max-width: 700px) {
  footer .wrap { grid-template-columns: 1fr; }
}
footer .logo {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 2rem;
  color: var(--paper);
  margin-bottom: 8px;
}
footer .logo .tag {
  display: block;
  font-family: var(--f-body);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}
footer h4 {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
footer a { color: rgba(250,248,243,.7); display: block; padding: 4px 0; font-size: 13px; }
footer a:hover { color: var(--paper); text-decoration: none; }
footer .copy {
  margin-top: 36px; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(250,248,243,.4);
  text-align: center;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.muted { color: var(--muted); }
.center { text-align: center; }
.empty-state {
  text-align: center;
  padding: 80px 24px;
}
.empty-state .glyph {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 5rem;
  color: var(--line-2);
  line-height: 1;
}
.empty-state h3 { margin-top: 12px; color: var(--ink); }
.empty-state p { color: var(--muted); }


/* ============================================================
   SESSIONI TEMPORALI E ARGOMENTI (Fase sessioni)
   ============================================================ */

.step-title {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 400;
  margin: 28px 0 6px;
  color: var(--ink);
}

/* --- Sessioni --- */

.slot-section {
  border-top: 1px dashed var(--ink-30);
  padding-top: 22px;
  margin-top: 22px;
}

.slot-day {
  margin-bottom: 22px;
}

.slot-day-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-60);
  margin-bottom: 10px;
  font-weight: 600;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.slot {
  display: block;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink-20);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.slot input[type=radio] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slot:hover:not(.full) {
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

.slot:has(input:checked) {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--paper);
}

.slot:has(input:checked) .slot-meta {
  color: rgba(255,255,255,0.85);
}

.slot-time {
  font-family: var(--f-mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.slot-meta {
  font-size: 10px;
  color: var(--ink-60);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.slot.full {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--paper-2);
}

.slot.full .slot-time {
  text-decoration: line-through;
}

/* --- Argomenti --- */

.arg-section {
  border-top: 1px dashed var(--ink-30);
  padding-top: 22px;
  margin-top: 22px;
}

.arg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.arg {
  display: block;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--ink-20);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.arg input[type=radio] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.arg:hover {
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

.arg:has(input:checked) {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: var(--paper);
}

.arg:has(input:checked) .arg-desc {
  color: rgba(255,255,255,0.85);
}

.arg-name {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 4px;
}

.arg-desc {
  font-size: 12px;
  color: var(--ink-60);
  line-height: 1.4;
}

/* --- Info slot/argomento sul biglietto --- */

.ticket-meta-line {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-radius: 6px;
  font-size: 13px;
}

.ticket-meta-line .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-60);
  margin-right: 6px;
}

.ticket-meta-line .val {
  font-weight: 600;
}

.ticket-meta-line .val.mono {
  font-family: var(--f-mono);
}

/* --- Fallback senza :has() (browser vecchi) --- */
@supports not (selector(:has(*))) {
  .slot input:checked + .slot-time { color: var(--terracotta); font-weight: 700; }
  .arg input:checked ~ .arg-name { color: var(--terracotta); }
}

