/* ArcWheel layout. Built only from the tokens in arcapita.css: no new colours, radii, spacing, type sizes or durations. */

[hidden] { display: none !important; }
html { scroll-padding-top: var(--space-8); }
.container { width: min(100% - var(--space-6), var(--max-width)); margin-inline: auto; }

/* ---------- Brand and app bar ---------- */
.brand { font: 300 20px/1 var(--font-display); letter-spacing: -.02em; color: var(--arc-white); text-decoration: none; }
.brand small { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--arc-line-on-dark); font: 400 13px/1 var(--font-body); letter-spacing: 0; color: var(--arc-blue-soft); }
.nav { display: flex; gap: var(--space-5); }
.nav a { position: relative; padding: 8px 0; font-size: 14px; font-weight: 400; white-space: nowrap; color: var(--arc-blue-soft); text-decoration: none; transition: color var(--dur-fast); }
.nav a::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform var(--dur-state) var(--ease-out); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--arc-white); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

.appbar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--arc-line-on-dark); }
.appbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5); padding-block: var(--space-3); }
.appbar .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
.appbar-tools { min-width: 0; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-left: auto; }
.appbar-tools .input { width: auto; max-width: 100%; }
.appbar-tools .who { display: none; }
@media (min-width: 981px) {
  .appbar .nav { order: 0; flex-basis: auto; overflow: visible; }
  .appbar-tools .who { display: inline; }
  .appbar-tools .input { max-width: 280px; }
}
@media (max-width: 720px) {
  .appbar-tools:has(#event-select:not([hidden])) { flex: 1 1 100%; margin-left: 0; }
  .appbar-tools .input { flex: 1 1 0; min-width: 0; }
}

/* ---------- Shared layout ---------- */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-content: start; }
.stack-lg { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-content: start; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.btn-block { width: 100%; }
.btn-lg { padding: var(--space-4) var(--space-5); font-size: 16px; }
.btn-danger { color: var(--arc-white); background: var(--arc-danger); }
.btn-danger:hover { box-shadow: inset 0 0 0 99px var(--arc-line); }
.btn-tertiary.is-danger { color: var(--arc-danger); }
.hint:empty { display: none; }
.pub-copy { margin-block: var(--space-2) var(--space-5); }
.card-title { margin-bottom: var(--space-4); }
.empty { padding-block: var(--space-4); }
.callout.is-error { background: var(--arc-danger-tint); }
.callout.is-error::before { background: var(--arc-danger); }

/* ---------- Public page ---------- */
/* Event banner (hb). Colours come from the supplied event artwork, so they are event colours, not theme tokens.
   Everything is sized in container units (cqi = 1% of the banner width), so it scales like an image but keeps live text.
   Wide: absolute layout that follows the original artwork. Phones (720px and below): stacked layout further down. */
.hb { --event-red: #e0201b; container-type: inline-size; overflow: hidden; max-width: 1100px; margin-top: var(--space-5); background: var(--arc-white); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.hb-art { position: relative; height: 34.5cqi; }
:where(.hb) p { margin: 0; }
.hb-band { position: absolute; inset: 0 0 auto; height: 12cqi; background: var(--event-red); }
.hb-wheel { position: absolute; z-index: 2; left: 2cqi; top: 2.9cqi; width: 30cqi; }
.hb-wheel-svg { display: block; width: 100%; height: auto; overflow: visible; }
.hb-spin { transform-box: view-box; transform-origin: 100px 100px; }
.hb-q { font: 600 46px/1 var(--font-body); }
.hb-title { position: absolute; z-index: 1; right: 2.1cqi; top: .77cqi; height: 12cqi; display: flex; align-items: center; font: 400 3.81cqi/1.1 Raleway, var(--font-body); color: var(--arc-white); }
.hb-flag { position: absolute; z-index: 1; left: 37.5cqi; right: 2cqi; top: 14.7cqi; height: 13.45cqi; background: var(--arc-white); outline: 1px solid var(--arc-rule); }
/* The red field with the five white serrations of the flag cut into its left edge.
   It is a size container: its artwork is placed in cqh (1% of the field height), measured from the original artwork, so it keeps its proportions. */
.hb-flag-red { --k: 1; --tag-max: 83.5cqh; container-type: size; position: absolute; inset: 0 0 0 23.6%; background: var(--event-red); color: var(--arc-white);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 6.4% 90%, 0 80%, 6.4% 70%, 0 60%, 6.4% 50%, 0 40%, 6.4% 30%, 0 20%, 6.4% 10%); }
/* Tagline in the artwork's fonts (Montserrat, Tajawal for Arabic). The English lines are sized so "Live every moment" fills --tag-w, as in the artwork.
   --k scales the logo and ornament group; on phones it shrinks and the tagline takes the room left of it, so the text stays readable. */
.hb-tag { --tag-w: min(var(--tag-max), 100cqw - 140.5cqh * var(--k) - 12cqw); position: absolute; right: calc(140.5cqh * var(--k)); top: calc(57.15cqh - var(--tag-w) * .2046); width: var(--tag-w); display: flex; flex-direction: column; align-items: flex-start; }
.hb-tag p { line-height: 1; white-space: nowrap; }
.hb-tag-ar { align-self: flex-end; font: 700 calc(var(--tag-w) * .127)/1 Tajawal, var(--font-body); }
.hb-tag-en { margin-top: calc(var(--tag-w) * .0678); font: 600 calc(var(--tag-w) / 13)/1 Montserrat, var(--font-body); }
.hb-tag-big { margin-top: calc(var(--tag-w) * .0291); font: 600 calc(var(--tag-w) / 9.905)/1 Montserrat, var(--font-body); }
.hb-flag-logo { position: absolute; right: calc(89.9cqh * var(--k)); top: calc(26.5cqh * var(--k)); width: calc(43.5cqh * var(--k)); height: auto; }
.hb-orn { position: absolute; right: 1.6cqh; top: 1.35cqh; height: calc(97.8cqh * var(--k)); width: auto; }
.hb-bridge { position: absolute; left: 25.5cqi; right: 0; bottom: 0; width: 74.5cqi; height: 5.8cqi; }
.hb-hangers { transform-box: fill-box; transform-origin: 50% 100%; }
.hb-deck { transform-box: fill-box; transform-origin: 0 50%; }

/* Motion: the wheel rolls in and spins, then the banner builds up piece by piece: title, flag panel, red field,
   each tagline line, the calligraphy (right to left, as it is written), the ornaments, and the bridge.
   A second spin plays after a registration. Only with the motion gate on (gate.js): reduced-motion users get the still banner. */
@keyframes hb-roll { from { transform: translateX(-120%) rotate(-200deg); } }
@keyframes hb-spin-in { from { transform: rotate(-900deg); } }
@keyframes hb-spin-win { to { transform: rotate(1800deg); } }
@keyframes hb-rise { from { opacity: 0; transform: translateY(.6em); } }
@keyframes hb-fade { from { opacity: 0; transform: scale(.97); } }
@keyframes hb-flag-wipe { from { clip-path: polygon(0 0, 0 0, 0 100%, 0 100%, 0 90%, 0 80%, 0 70%, 0 60%, 0 50%, 0 40%, 0 30%, 0 20%, 0 10%); } }
@keyframes hb-write { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0); } }
@keyframes hb-bloom { from { clip-path: circle(0 at 100% 0); } to { clip-path: circle(150% at 100% 0); } }
@keyframes hb-draw { from { stroke-dashoffset: 1; } }
@keyframes hb-grow { from { transform: scaleY(0); } }
@keyframes hb-grow-x { from { transform: scaleX(0); } }
@keyframes hb-pop { 50% { transform: scale(1.06); } }
.motion .hb-wheel { animation: hb-roll 1.4s cubic-bezier(.2, .7, .2, 1) both; }
.motion .hb-spin { animation: hb-spin-in 2.2s cubic-bezier(.15, .6, .15, 1) both; }
.motion .hb-title { animation: hb-rise .7s var(--ease-out) .5s both; }
.motion .hb-flag { animation: hb-fade .5s var(--ease-out) .8s both; }
.motion .hb-flag-red { animation: hb-flag-wipe .9s cubic-bezier(.6, 0, .2, 1) 1.1s both; }
.motion .hb-tag-ar { animation: hb-rise .5s var(--ease-out) 1.8s both; }
.motion .hb-tag-en { animation: hb-rise .5s var(--ease-out) 1.95s both; }
.motion .hb-tag-big { animation: hb-rise .5s var(--ease-out) 2.1s both; }
.motion .hb-flag-logo { animation: hb-write .9s ease-in-out 2.2s both; }
.motion .hb-orn { animation: hb-bloom 1.2s ease-in 2.6s both; }
.motion .hb-deck { animation: hb-grow-x .8s var(--ease-out) .7s both; }
.motion .hb-arch { stroke-dasharray: 1; animation: hb-draw 1s ease-in-out 1s both; }
.motion .hb-hangers { animation: hb-grow .7s var(--ease-out) 1.7s both; }
.motion .hb.is-win .hb-spin { animation: hb-spin-win 3.2s cubic-bezier(.12, .7, .1, 1) both; }
.motion .hb.is-win .hb-wheel { animation: hb-pop .6s var(--ease-out) 2.7s both; }

/* The card hangs straight off the banner: same width, no gap, square corners where they meet. */
.pub .pub-card { max-width: 1100px; margin: 0 auto var(--space-8); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.pub-card section { display: grid; gap: var(--space-2); }
.pub-head { display: grid; gap: var(--space-1); margin-bottom: var(--space-5); padding-bottom: var(--space-5); border-bottom: 1px solid var(--arc-line); }
.pub-head h1 { font-size: 28px; line-height: 1.15; }
.pub-date { font-size: 20px; color: var(--arc-muted); }
.pub-date:empty { display: none; }
.sent-to { font-weight: 400; overflow-wrap: anywhere; }
/* Headings that take focus from script (to announce a new step) do not need a ring. */
[tabindex="-1"]:focus { outline: none; }

/* Desktop: the whole public page fits one screen. Banner and card share one width: the widest that fits the screen width,
   1100px, and the height left over after the card (at the artwork's 2750:950 ratio). The card has a fixed minimum height so the
   banner does not resize between states. */
@media (min-width: 721px) {
  .pub { --card-h: 284px; --pub-w: min(100vw - var(--space-6), 1100px, (100vh - var(--card-h) - 2 * var(--space-5)) * 2750 / 950); }
  @supports (height: 100svh) { .pub { --pub-w: min(100vw - var(--space-6), 1100px, (100svh - var(--card-h) - 2 * var(--space-5)) * 2750 / 950); } }
  .hb.container { width: var(--pub-w); max-width: none; }
  .pub .pub-card { width: var(--pub-w); max-width: none; min-height: var(--card-h); margin-bottom: var(--space-5); }
  .pub-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-1) var(--space-4); margin-bottom: var(--space-4); padding-bottom: var(--space-4); }
  .pub-card section { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--space-6); align-items: start; }
  .pub-card section > * { grid-column: 1; }
  .pub-card section > form { grid-column: 2; grid-row: 1 / span 3; }
  .pub-card section > .actions { grid-column: 2; grid-row: 1; }
  .pub-card section > .callout { grid-column: 2; grid-row: 2 / span 2; }
  .pub-card section > .hint { grid-column: 2; grid-row: 4; }
  .pub-card section .pub-copy { margin-bottom: 0; }
  .pub-card form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pub-card form > :not(.field) { grid-column: 1 / -1; }
}

/* ---------- Sign in ---------- */
.boot { padding: var(--space-5); }
.login { min-height: 100vh; display: grid; align-items: center; padding-block: var(--space-6); }
.login-inner { width: min(100% - var(--space-6), 480px); margin-inline: auto; display: grid; gap: var(--space-5); }
.login-card section { display: grid; gap: var(--space-2); }
/* The white card sits on the slate login stage: put ink back so its text is readable. */
.login-card { --surface: var(--arc-white); color: var(--arc-ink); }
.tone-dark .login-card :is(h1, h2, h3, h4) { color: var(--arc-dark); }
.tone-dark .login-card .meta { color: var(--arc-muted); }

/* ---------- Admin pages ---------- */
.page { padding-block: var(--space-6) var(--space-8); }
#notice:not(:empty) { margin-bottom: var(--space-5); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.page-head h1 { font-size: 34px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3) var(--space-4); }
.toolbar-grow { flex: 1 1 240px; }
.row-actions { display: flex; gap: var(--space-4); }
td.wrap { white-space: normal; min-width: 240px; }
.cell-sub { display: block; }
.kpis { margin-top: var(--space-4); }
/* Dashboard links: one slim strip, an item per link (label, address, copy). */
.links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin-top: var(--space-3); }
.link-item { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; font-size: 14px; }
.link-item .meta { white-space: nowrap; }
.link-url { min-width: 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item .btn { padding: 0; font-size: 14px; white-space: nowrap; }
.chart .ranked { margin-top: var(--space-2); }

/* ---------- Check-in ---------- */
.checkin { display: grid; gap: var(--space-4); width: min(100%, 640px); margin-inline: auto; }
.code-input { padding: var(--space-4); font: 200 34px/1.2 var(--font-display); text-align: center; }
.actions-grow > .btn { flex: 1 1 0; }
.scan-panel { display: grid; gap: var(--space-3); }
.scan-video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-md); background: var(--arc-dark); }
.result { display: grid; justify-items: start; gap: var(--space-2); padding: var(--space-6); border-radius: var(--radius-lg); }
.result.is-ok { background: var(--arc-lime-tint); }
.result.is-bad { background: var(--arc-danger-tint); }
.result-name { font-size: 34px; overflow-wrap: anywhere; }
.result-line { font-size: 20px; line-height: 1.25; font-weight: 400; overflow-wrap: anywhere; }
.result-line:empty { display: none; }
.result.is-ok .result-line { color: var(--arc-lime-ink); }
.result.is-bad .result-line { color: var(--arc-ink); }

/* ---------- Dialog ---------- */
.dialog { width: min(100% - var(--space-6), 480px); max-height: calc(100vh - var(--space-6)); overflow-y: auto; padding: var(--space-6); border: 0; border-radius: var(--radius-lg); background: var(--arc-white); color: var(--arc-ink); font: inherit; box-shadow: var(--shadow-float); }
.dialog[open] { display: grid; gap: var(--space-4); }
.dialog::backdrop { background: var(--arc-dark); opacity: .6; }
.dialog-copy { font-size: 14px; font-weight: 400; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  /* Banner on phones: a compact red band with the wheel and title, then the building and its bridge exactly as on wide screens.
     The building (flag panel) and bridge keep the artwork's proportions to each other and inside, like the real thing:
     relative to the building width F, the bridge is 1.231F wide and .0959F tall, starts .198F left of the building
     and ends on the banner's right edge, just under the building. Building width here: 86cqi. */
  .hb-art { height: auto; display: grid; grid-template-columns: 24cqi minmax(0, 1fr); column-gap: 4cqi; padding: 4cqi 4cqi 0; }
  .hb-band { height: 32cqi; }
  .hb-wheel { position: relative; left: auto; top: auto; width: auto; }
  .hb-title { position: relative; right: auto; top: auto; height: 24cqi; font-size: max(16px, 5.6cqi); line-height: 1.15; }
  .hb-flag { position: relative; grid-column: 1 / -1; justify-self: start; left: auto; right: auto; top: auto; width: 86cqi; height: calc(86cqi * .2223); margin: 8cqi 0 0 7.2cqi; }
  .hb-bridge { position: relative; grid-column: 1 / -1; justify-self: start; left: auto; width: calc(86cqi * 1.231); max-width: none; height: calc(86cqi * .0959); margin: calc(86cqi * .0099) 0 0 calc(-4cqi - 5.9cqi); }
  .pub-head h1 { font-size: 20px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > :first-child { grid-column: 1 / -1; }
  .card, .panel, .stage, .result, .dialog { padding: var(--space-5); }
  .ranked li { grid-template-columns: 96px minmax(0, 1fr) 32px; }
  .page-head h1 { font-size: 20px; }
}
