/* the site's only stylesheet. right to left, vazirmatn from this origin for every element, print leaves only the ticket. */

@font-face {
  font-family: "vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/vazirmatn-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC;
}
@font-face {
  font-family: "vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/vazirmatn-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "vazirmatn";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/vazirmatn-arabic-500-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE80-FEFC;
}
@font-face {
  font-family: "vazirmatn";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/vazirmatn-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/*
  one warm neutral ramp with a single green accent.
  text has three roles (text, text-2, muted), borders are hairlines of the text color,
  spacing sits on a 4px grid, weights are 400 and 500, and motion uses one curve.
*/
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --raised: #eeece6;
  --glass: rgba(246, 245, 242, 0.85);
  --text: #1d1d1b;
  --text-2: #4d4c48;
  --muted: #6b6a66;
  --line: rgba(29, 29, 27, 0.1);
  --line-strong: rgba(29, 29, 27, 0.22);
  --accent: #1f5f4a;
  --accent-hover: #174a39;
  --accent-text: #ffffff;
  --accent-soft: #dcebe4;
  --danger: #a4262c;
  --danger-hover: #861d22;
  --danger-text: #ffffff;
  --danger-soft: #f7e1e2;
  --ok: #1f6b3a;
  --ok-soft: #dff1e5;
  --r-card: 8px;
  --r-ctl: 6px;
  --r-tag: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t: 150ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161715;
    --surface: #1f201d;
    --raised: #292a26;
    --glass: rgba(22, 23, 21, 0.85);
    --text: #efeee9;
    --text-2: #c9c8c1;
    --muted: #a3a29b;
    --line: rgba(239, 238, 233, 0.1);
    --line-strong: rgba(239, 238, 233, 0.22);
    --accent: #6fb596;
    --accent-hover: #8bc9ae;
    --accent-text: #10201a;
    --accent-soft: #223a2f;
    --danger: #ef8a8f;
    --danger-hover: #f4a3a7;
    --danger-text: #2a0f10;
    --danger-soft: #3d2324;
    --ok: #8fd3a4;
    --ok-soft: #203628;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161715;
  --surface: #1f201d;
  --raised: #292a26;
  --glass: rgba(22, 23, 21, 0.85);
  --text: #efeee9;
  --text-2: #c9c8c1;
  --muted: #a3a29b;
  --line: rgba(239, 238, 233, 0.1);
  --line-strong: rgba(239, 238, 233, 0.22);
  --accent: #6fb596;
  --accent-hover: #8bc9ae;
  --accent-text: #10201a;
  --accent-soft: #223a2f;
  --danger: #ef8a8f;
  --danger-hover: #f4a3a7;
  --danger-text: #2a0f10;
  --danger-soft: #3d2324;
  --ok: #8fd3a4;
  --ok-soft: #203628;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  font-family: "vazirmatn", system-ui, sans-serif;
  font-synthesis: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "vazirmatn", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
}
/* every control and every code block uses the same face as the body */
button, input, select, textarea, code, pre, kbd, samp, .mono, .ticket-code {
  font-family: "vazirmatn", system-ui, sans-serif;
}
h1, h2, h3, strong, b, th, dt { font-weight: 500; }
h1 { font-size: 1.75rem; line-height: 1.4; margin: 8px 0 16px; }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 32px 0 12px; }
h3 { font-size: 1rem; line-height: 1.6; margin: 0 0 8px; }
p { margin: 8px 0; }
a {
  color: var(--accent);
  text-underline-offset: 4px;
  transition: color var(--t) var(--ease);
}
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }
code, pre, .mono { direction: ltr; unicode-bidi: isolate; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0; }
.error { color: var(--danger); font-size: 0.875rem; }
.mono, .facts dd, td, .stat strong, .ticket-code { font-variant-numeric: tabular-nums; }

/* header: a quiet bar over the page, hairline underneath */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  transition: color var(--t) var(--ease);
}
.brand:hover { color: var(--accent); }
.account { display: flex; gap: 16px; align-items: center; font-size: 0.875rem; }
.account a { color: var(--text-2); text-decoration: none; }
.account a:hover { color: var(--accent); }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}
.admin-nav a {
  text-decoration: none;
  padding: 4px 12px;
  border-radius: var(--r-tag);
  color: var(--text-2);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
.admin-nav a:hover { background: var(--raised); color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--raised); color: var(--text); font-weight: 500; }

/* page frame: 16px gutter on phones, no page-level horizontal scroll */
.page {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px;
}
.foot { padding: 24px 16px 32px; text-align: center; color: var(--muted); font-size: 0.875rem; }
.foot p { margin: 0; }

.flash {
  padding: 12px 16px;
  border-radius: var(--r-ctl);
  margin: 0 0 16px;
}
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.notice {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 12px 16px;
  margin: 12px 0;
}
.notice.success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

/* cards are a surface and a hairline, nothing else */
.card-box,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px;
  margin: 16px 0;
}
.card-box > h2 { margin-top: 0; }

.narrow { max-width: 480px; margin: 0 auto; }

/* trace ids and other values people copy: plain text in the page face, one click selects the whole thing */
.request-id {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  padding: 0 8px;
  margin-inline-start: 4px;
  border-radius: var(--r-tag);
  background: var(--raised);
  color: var(--text);
  font-weight: 500;
  -webkit-user-select: all;
  user-select: all;
}

/* buttons and forms */
.btn {
  display: inline-block;
  min-height: 44px;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: var(--r-ctl);
  padding: 8px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.8;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--raised); border-color: var(--line-strong); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
.btn.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: var(--danger-text); }
.btn-block { display: block; width: 100%; }
button.link {
  background: none;
  border: none;
  padding: 8px 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color var(--t) var(--ease);
}
button.link:hover { color: var(--accent-hover); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.card-box form.stack { padding-top: 16px; border-top: 1px solid var(--line); margin: 16px 0 0; }
.card-box h2 + form.stack { border-top: 0; padding-top: 0; margin-top: 0; }
form label { display: grid; gap: 4px; font-size: 0.875rem; font-weight: 400; color: var(--text-2); }
input, select, textarea {
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  padding: 8px 12px;
  min-height: 44px;
  width: 100%;
  min-width: 0;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"] { border-color: var(--danger); }
textarea { resize: vertical; }
input[dir="ltr"] { text-align: left; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0; }
.filters label { flex: 1 1 180px; }
.filters .btn { flex: 0 0 auto; }

/* badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: var(--r-tag);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.5;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }

/* definition lists used across pages */
.facts { margin: 12px 0; }
.facts > div {
  display: grid;
  grid-template-columns: minmax(7em, 40%) 1fr;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-weight: 400; }
.facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }

/* event page: poster, description and card; the card sits to the side on wide screens */
.banner {
  display: block;
  width: min(100%, 520px);
  height: auto;
  object-fit: contain;
  margin: 0 auto 16px;
  border-radius: var(--r-ctl);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  background: var(--surface);
}
.banner-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 24px 16px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent);
  border-radius: var(--r-ctl);
  margin-bottom: 16px;
  box-shadow: none;
}
.banner-fallback span { max-width: 90%; }
.event { display: grid; gap: 0; }
.side { display: contents; }
.side .banner { order: -2; }
.side .card { order: -1; }
.description { color: var(--text); }
.description p { margin: 0 0 16px; }
.description h3 {
  font-size: 1.125rem;
  color: var(--text);
  margin: 32px 0 8px;
}
.description h3:first-child { margin-top: 0; }
.description ul { list-style: disc; margin: 0 0 16px; padding: 0; padding-inline-start: 24px; }
.description li { color: var(--text); padding: 0; }
.description li::marker { color: var(--accent); }
.buy-desktop { display: none; }
.buy-bar {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.buy-bar .notice { margin: 0; padding: 4px 12px; }
.off { display: inline-block; padding: 0 8px; border-radius: var(--r-tag); background: var(--accent-soft); color: var(--accent); font-size: 0.8125rem; font-weight: 500; }
.receipt-img { max-width: 100%; max-height: 640px; border: 1px solid var(--line); border-radius: var(--r-card); }
.card-number { font-size: 1.125rem; letter-spacing: 0.04em; user-select: all; }
.was { color: var(--muted); font-weight: 400; text-decoration-thickness: 1px; }
@media (max-width: 440px) { .bar-price .off { display: none; } .bar-price { font-size: 0.9375rem; } }
.bar-price { font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.buy-bar .btn { white-space: nowrap; }
:root:has(.buy-bar) body { padding-bottom: 80px; }
.event .card .notice { margin: 12px 0 0; }
.scarce { margin: 12px 0 0; color: var(--text-2); font-size: 0.875rem; }

@media (min-width: 900px) {
  .event {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
  }
  .side {
    display: block;
    align-self: start;
  }
  .side .banner {
    order: 0;
    width: 100%;
    max-width: 340px;
    height: auto;
    margin: 0 0 16px;
  }
  .side .card {
    order: 0;
    margin: 0;
  }
  .buy-desktop { display: block; }
  .buy-bar { display: none; }
  :root:has(.buy-bar) body { padding-bottom: 0; }
  .page { padding: 32px 24px 40px; }
}

/* ticket: a printed stub with a perforated edge above the code */
.ticket {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: 24px 20px;
  margin: 20px 0;
  text-align: center;
  background: var(--surface);
}
.ticket-title { color: var(--muted); font-size: 0.875rem; margin: 0; }
.ticket-name { font-size: 1.25rem; margin: 4px 0 16px; font-weight: 500; }
.ticket-label { color: var(--muted); margin: 0; font-size: 0.875rem; }
.ticket-code {
  direction: ltr;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 16px;
}
.ticket-qr { display: flex; justify-content: center; margin: 8px 0 16px; }
.ticket-qr svg { width: min(220px, 80%); height: auto; }
.ticket .ticket-qr {
  position: relative;
  margin: 20px -20px 0;
  padding: 24px 20px 0;
  border-top: 2px dotted var(--line-strong);
}
.ticket .ticket-qr::before,
.ticket .ticket-qr::after {
  content: "";
  position: absolute;
  top: -9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
}
.ticket .ticket-qr::before { inset-inline-start: -9px; }
.ticket .ticket-qr::after { inset-inline-end: -9px; }
.ticket-facts { text-align: start; margin: 16px 0; }
.ticket-facts > div {
  display: grid;
  grid-template-columns: minmax(7em, 45%) 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.ticket-facts dt { color: var(--muted); font-weight: 400; }
.ticket-facts dd { margin: 0; font-weight: 500; }

/* admin tables and dashboard */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}
.card-box .table-wrap { border-color: transparent; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); white-space: nowrap; background: var(--raised); }
tbody tr:hover td { background: var(--bg); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.stat {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
a.stat:hover { border-color: var(--accent); color: var(--text); }
.stat span { color: var(--muted); font-size: 0.875rem; }
.stat strong { font-size: 1.5rem; line-height: 1.4; color: var(--text); }
.stat small { color: var(--muted); }
.alerts { padding-inline-start: 20px; }
.alerts li { margin: 4px 0; }
.log { padding-inline-start: 20px; }
.log li { margin: 4px 0; }
.events { padding-inline-start: 20px; }
.events pre, pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 8px;
  overflow-x: auto;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-all;
}
.temp { font-size: 1.25rem; padding: 8px 12px; background: var(--raised); border-radius: var(--r-ctl); }
.pager { display: flex; justify-content: center; gap: 16px; align-items: center; margin: 16px 0; }

/* the verify page is simple and left to the reading edge */
.verify { text-align: start; }
.verify h1 { margin-top: 12px; }

/* the survey: single-select rows, a compact rating matrix, and short text answers */
.survey-section { border: 1px solid var(--line); border-radius: var(--r-card); padding: 8px 16px 16px; margin: 16px 0; }
.survey-section > legend { padding: 0 6px; font-weight: 500; color: var(--text-2); }
.survey .q { margin: 16px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.survey .q:first-of-type { border-top: 0; padding-top: 0; }
.q-label { margin: 0 0 8px; font-weight: 500; }
.opts { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.opt { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.opt input[type="radio"], .opt input[type="checkbox"] { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.err { color: var(--danger); font-size: 0.875rem; margin: 6px 0 0; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.matrix-table th, .matrix-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix-table thead th { color: var(--muted); font-weight: 400; }
.matrix-table th:first-child { text-align: start; white-space: nowrap; }
.matrix-table .opt { justify-content: center; }
.survey textarea { min-height: 76px; }
.stat-bar { height: 8px; background: var(--raised); border-radius: var(--r-tag); overflow: hidden; }
.stat-bar > span { display: block; height: 100%; background: var(--accent); }

/* one entrance on load for the page content, short and small */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.page > :not(.buy-bar) { animation: rise 300ms var(--ease) both; }
.page > :nth-child(2) { animation-delay: 40ms; }
.page > :nth-child(3) { animation-delay: 80ms; }
.page > :nth-child(n+4) { animation-delay: 120ms; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --text-2: #000;
    --muted: #333;
    --line: #000;
    --line-strong: #000;
    --accent: #000;
    color-scheme: light;
  }
  body { background: #fff; color: #000; }
  body * { visibility: hidden; }
  .ticket, .ticket * { visibility: visible; }
  .ticket {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    margin: 0;
    background: #fff;
    color: #000;
  }
  .page > * { animation: none; }
  .no-print, .buy-bar, .top, .foot, .admin-nav { display: none !important; }
}
