@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Sora:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,1,0');

:root {
  --font-ui: 'Sora', sans-serif;
  --font-disp: 'Oswald', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --bg-page: #0f1430;
  --bg-page-alt: #161b42;
  
  --text-main: #ffffff;
  --text-muted: #aab0d4;
  --text-dim: #8a90c0;
  
  --error-rose: #fb7185;
  
  --card-bg: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.028));
  --card-border: rgba(255,255,255,0.10);
  
  --input-border: rgba(255,255,255,0.22);
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  background: radial-gradient(110% 60% at 50% -8%, rgba(124,58,237,0.3), transparent 58%), 
              linear-gradient(170deg, var(--bg-page), var(--bg-page-alt));
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
}

/* Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 5%;
  max-width: 1400px;
  margin: 0 auto;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  transition: all 0.3s ease;
}
.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* Header */
.page-header {
  text-align: center;
  padding: 40px 20px;
}
.eyebrow {
  font-family: var(--font-mono);
  color: #f4c45a;
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.page-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  margin: 0 0 16px 0;
}
.page-title span {
  color: #f4c45a;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 500px;
  margin: 0 auto;
}

/* Accent Tier Classes */
.tier-accent-0 { --a1: #f4c45a; --a2: #fbbf24; } /* Gold */
.tier-accent-1 { --a1: #a78bfa; --a2: #8b5cf6; } /* Violet */
.tier-accent-2 { --a1: #e879f9; --a2: #d946ef; } /* Fuchsia */
.tier-accent-3 { --a1: #2dd4bf; --a2: #14b8a6; } /* Teal */
.tier-accent-4 { --a1: #fb7185; --a2: #f43f5e; } /* Rose */

.tickets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 400px));
  justify-content: center;
  gap: 28px;
  align-items: stretch;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 80px 20px;
}

/* Ticket Card */
.ticket-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  /* overflow: visible needed for notches */
}
.ticket-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.3);
}

/* Top Stripe */
.ticket-stripe {
  height: 6px;
  width: 100%;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, var(--a1), var(--a2));
}

/* Ticket Info Block */
.ticket-info {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1; /* Pushes stub down, aligning across row */
}

.ti-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ti-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.ti-name {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 26px;
  text-transform: uppercase;
  color: var(--a1);
  margin: 0;
  line-height: 1.1;
}
.ti-admits {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  /* using a hack for hex opacity since CSS vars don't do it cleanly unless it's rgb */
  background: color-mix(in srgb, var(--a1) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--a1) 30%, transparent);
  color: var(--a1);
}
.ti-admits span {
  font-size: 14px;
}

.ti-price {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 34px;
  color: var(--a1);
  margin: 0 0 16px 0;
}
.ti-price small {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  color: var(--text-muted);
}

.ti-perks {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ti-perks li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
}
.ti-perks li span {
  color: var(--a1);
  font-size: 18px;
}

/* Perforation Divider */
.perforation {
  position: relative;
  height: 2px;
  border-top: 2px dashed rgba(255,255,255,0.16);
  margin: 0 16px;
}
.perforation::before, .perforation::after {
  content: '';
  position: absolute;
  top: -11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #11152f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); /* slight border match */
}
.perforation::before { left: -26px; }
.perforation::after { right: -26px; }


/* Ticket Stub (Form) */
.ticket-stub {
  padding: 24px;
  position: relative;
  overflow: hidden; /* contains the stamp */
}

.ts-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
.ts-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.ts-serial {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.ts-field {
  position: relative;
  margin-bottom: 16px;
}
.ts-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.ts-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--input-border);
  padding: 4px 0 8px 0;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 15px;
  transition: border-color 0.3s ease;
}
.ts-input.name-input {
  font-family: var(--font-disp);
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: 0.05em;
}
.ts-input:focus {
  outline: none;
  border-bottom-color: #f4c45a;
}
.ts-error {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 10px;
  color: var(--error-rose);
  opacity: 0;
  transition: opacity 0.3s;
}
.ts-field.invalid .ts-error {
  opacity: 1;
}
.ts-field.invalid .ts-input {
  border-bottom-color: var(--error-rose);
}

/* Barcode Row */
.barcode-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 24px 0;
}
.barcode {
  display: flex;
  gap: 2px;
  height: 24px;
  align-items: stretch;
}
.bar {
  background: rgba(255,255,255,0.5);
  border-radius: 1px;
}
.bar.accent {
  background: var(--a1);
}
/* Random bar widths logic done in ejs */

.admit-tag {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 12px;
  background: color-mix(in srgb, var(--a1) 20%, transparent);
  color: var(--a1);
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* CTA */
.btn-cta {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  color: #1a1330;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--a1) 30%, transparent);
}
.btn-cta span {
  font-size: 20px;
}

/* Stamp Animation */
.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  margin-top: -100px;
  margin-left: -100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-disp);
  color: color-mix(in srgb, var(--a1) 80%, transparent);
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: scale(2) rotate(-13deg);
}

.stamp-ring {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.ring-progress {
  stroke: color-mix(in srgb, var(--a1) 80%, transparent);
  stroke-dasharray: 603.2;
  stroke-dashoffset: 0;
}

.ring-inner {
  stroke: color-mix(in srgb, var(--a1) 50%, transparent);
}
.stamp-title {
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
}
.stamp-sub {
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.1em;
  margin: 4px 0;
}
.stamp-holder {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  background: color-mix(in srgb, var(--a1) 20%, transparent);
  padding: 2px 10px;
  border-radius: 12px;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* State Classes */
.ticket-card.issued .stamp {
  animation: stamp-flow 3.2s forwards;
}

@keyframes stamp-flow {
  0% { opacity: 0; transform: scale(2) rotate(-13deg); }
  6% { opacity: 1; transform: scale(1) rotate(-13deg); }
  94% { opacity: 1; transform: scale(1) rotate(-13deg); }
  100% { opacity: 0; transform: scale(1) rotate(-13deg); visibility: hidden; }
}

.ticket-card.issued .ring-progress {
  animation: ring-reduce 3s linear forwards;
  animation-delay: 0.15s;
}

@keyframes ring-reduce {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 603.2; }
}
.ticket-card.issued .ts-form-wrap {
  opacity: 0.2;
  pointer-events: none;
  filter: grayscale(1);
}

/* Responsive / Mobile Adjustments */
@media (max-width: 600px) {
  .top-nav {
    padding: 16px 12px;
  }
  
  .nav-link {
    font-size: 12px;
    padding: 6px 10px;
    gap: 4px;
  }
  
  .nav-link span {
    font-size: 16px;
  }
  
  .top-nav > div:nth-child(2) {
    font-size: 14px !important;
    text-align: center;
    line-height: 1.3;
  }
  
  .top-nav > div:last-child {
    width: 70px !important;
  }

  .tickets-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 16px 40px 16px;
  }
  
  .ticket-info {
    padding: 16px 20px;
  }
  
  .ticket-stub {
    padding: 16px 20px;
  }

  .page-title {
    font-size: clamp(26px, 8vw, 32px);
  }
  
  .page-header {
    padding: 20px 16px;
  }

  .ti-name {
    font-size: 20px;
  }
  
  .ti-price {
    font-size: 26px;
    margin: 0 0 12px 0;
  }

  .ti-perks li {
    font-size: 13px;
    gap: 6px;
  }
  
  .ts-field {
    margin-bottom: 12px;
  }

  .ts-input.name-input {
    font-size: 15px;
  }
  
  .ts-input {
    font-size: 13px;
    padding: 2px 0 6px 0;
  }
  
  .btn-cta {
    padding: 12px;
    font-size: 14px;
  }
  
  .btn-cta span {
    font-size: 18px;
  }

  .barcode-row {
    margin: 12px 0 16px 0;
  }
  
  .stamp {
    width: 140px;
    height: 140px;
    margin-top: -70px;
    margin-left: -70px;
  }
  
  .stamp-title {
    font-size: 22px;
  }
}

.peks-logo { height: 36px !important; }
@media (max-width: 600px) { .peks-logo { height: 24px !important; } }
