/* ==========================================================================
   Components. Every surface obeys the two rules that carry the identity:
     · dark has no card border and no drop shadow — near-black separates
       itself, and an outline there reads as a seam;
     · light has both, because bone-on-bone cannot separate itself.
   The border is DECLARED in both modes (transparent in dark) so the 1px
   inset is identical and a theme flip never reflows anything.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons — press physics, exactly as PressButton behaves in the app.
   The element itself is the shadow plate, tinted as a DARKENED COPY of the
   face's own fill rather than a fixed ink, so the press reads as depth on
   bone paper and on cinema black alike. Pressing translates the face; the
   shadow collapses. Transform only.
   -------------------------------------------------------------------------- */
.btn {
  --btn-fill: var(--accent);
  --btn-ink: var(--on-accent);
  display: inline-block;
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--btn-fill) 62%, #000);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.72em 1.6em;
  border-radius: var(--radius);
  background: var(--btn-fill);
  color: var(--btn-ink);
  font-family: var(--font-display);
  font-size: clamp(1.02rem, 0.95rem + 0.4vw, 1.3rem);
  line-height: 1.35;
  white-space: nowrap;
  transform: translate3d(0, calc(var(--press) * -1), 0);
  transition: transform var(--dur-fast) var(--ease-out-expo);
}

.btn:hover .btn__face {
  transform: translate3d(0, calc(var(--press) * -1.6), 0);
}

.btn:active .btn__face {
  transform: translate3d(0, 0, 0);
  transition-duration: 60ms;
}

.btn--quiet {
  --btn-fill: var(--elevated);
  --btn-ink: var(--on-bg);
  box-shadow: inset 0 0 0 var(--hair) var(--border);
}

.btn--quiet .btn__face {
  box-shadow: inset 0 0 0 var(--hair) var(--border);
}

.btn--sm .btn__face {
  padding: 0.5em 1.05em;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  font-weight: 700;
}

.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.btn--primary:focus-visible {
  outline-color: var(--on-bg);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  background: var(--surface);
  color: var(--on-bg);
  border: var(--hair) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.card--raised {
  background: var(--elevated);
  box-shadow: var(--card-lift);
}

.card__body {
  padding: clamp(1.1rem, 0.8rem + 1.2vw, 1.9rem);
}

.card p {
  color: var(--muted);
  max-inline-size: 48ch;
}

/* Grouped rows inside a card separate on a hairline, never a border. */
.hairline-top {
  border-block-start: var(--hair) solid var(--hairline);
}

/* --------------------------------------------------------------------------
   Ticket stub — a dashed chip. Street-signage texture with no extra hue.
   -------------------------------------------------------------------------- */
.stub {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.55em 1.15em;
  background: var(--surface);
  color: var(--on-bg);
  border: var(--hair) dashed var(--hairline);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.15rem);
  line-height: 1.5;
}

.stub::before,
.stub::after {
  content: "";
  position: absolute;
  inline-size: 10px;
  block-size: 10px;
  border-radius: 50%;
  background: var(--bg);
  inset-block-start: calc(50% - 5px);
}

.stub::before {
  inset-inline-start: -5px;
}

.stub::after {
  inset-inline-end: -5px;
}

.stub--on-surface::before,
.stub--on-surface::after {
  background: var(--surface);
}

.stub__dot {
  inline-size: 9px;
  block-size: 9px;
  border-radius: 50%;
  background: var(--positive);
  flex: none;
}

.stub--live .stub__dot {
  animation: pulse-dot 2.4s var(--ease-standard) infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.55);
    opacity: 0.5;
  }
}

/* Chips — quieter than a stub. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.28em 0.75em;
  border: var(--hair) solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
}

/* --------------------------------------------------------------------------
   Taxi-checker strip — the section separator, alternating the mode's own
   ground and text colours. Scrolls toward the reading direction, on
   transform only.
   -------------------------------------------------------------------------- */
.checker-strip {
  position: relative;
  block-size: calc(var(--checker) * 2);
  overflow: hidden;
  background: var(--bg);
}

.checker-strip__track {
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(var(--checker) * -4);
  inline-size: calc(100% + var(--checker) * 8);
  background-color: var(--bg);
  background-image:
    linear-gradient(45deg, var(--on-bg) 25%, transparent 25%),
    linear-gradient(-45deg, var(--on-bg) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--on-bg) 75%),
    linear-gradient(-45deg, transparent 75%, var(--on-bg) 75%);
  background-size: calc(var(--checker) * 2) calc(var(--checker) * 2);
  background-position:
    0 0,
    0 var(--checker),
    var(--checker) calc(var(--checker) * -1),
    calc(var(--checker) * -1) 0;
  animation: checker-slide 2.6s linear infinite;
}

@keyframes checker-slide {
  to {
    transform: translate3d(calc(var(--checker) * 2 * var(--push)), 0, 0);
  }
}

.checker-strip--accent .checker-strip__track {
  background-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Phone frame + fake screens
   -------------------------------------------------------------------------- */
.phone {
  --phone-w: 200px;
  position: relative;
  inline-size: var(--phone-w);
  aspect-ratio: 41 / 84;
  flex: none;
  padding: 7px;
  background: var(--elevated);
  border: var(--hair) solid var(--border);
  border-radius: 26px;
  box-shadow: var(--card-lift);
}

.phone::after {
  content: "";
  position: absolute;
  inset-block-start: 13px;
  inset-inline-start: 50%;
  inline-size: 40px;
  block-size: 4px;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  transform: translateX(-50%);
}

.phone__screen {
  block-size: 100%;
  border-radius: 20px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 12px 16px;
  text-align: center;
}

.phone__label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--on-bg);
}

.phone__label--dim {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

html[lang="ar"] .phone__label--dim {
  letter-spacing: normal;
}

/* --------------------------------------------------------------------------
   The buzzer dome — a real, focusable button that physically presses.
   Its hard shadow is a darkened copy of its own fill.
   -------------------------------------------------------------------------- */
.buzzer {
  --dome: 104px;
  position: relative;
  inline-size: var(--dome);
  block-size: var(--dome);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}

.buzzer__base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 55%, #000);
  transform: translate3d(0, var(--press), 0);
}

.buzzer__dome {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.42) 0 12%, transparent 44%),
    var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  /* >= 24px keeps on-accent-on-accent inside the AA large-text threshold
     even before the palette's own 6.4:1 headroom. */
  font-size: 1.55rem;
  transform: translate3d(0, calc(var(--press) * -1), 0);
  transition: transform var(--dur-fast) var(--ease-out-expo);
}

.buzzer:hover .buzzer__dome {
  transform: translate3d(0, calc(var(--press) * -1.7), 0);
}

.buzzer:active .buzzer__dome,
.buzzer.is-slammed .buzzer__dome {
  transform: translate3d(0, 0, 0);
  transition-duration: 55ms;
}

.buzzer__ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}

.buzzer.is-slammed .buzzer__ring {
  animation: slam-ring 620ms var(--ease-out-expo);
}

@keyframes slam-ring {
  from {
    opacity: 0.9;
    transform: scale(0.86);
  }
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

.buzzer:focus-visible {
  outline: 3px solid var(--on-bg);
  outline-offset: 8px;
}

.buzzer-readout {
  min-block-size: 1.5em;
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: var(--accent-ink);
  opacity: 0;
  transform: translate3d(0, 6px, 0);
  transition:
    opacity var(--dur-normal) var(--ease-out-expo),
    transform var(--dur-normal) var(--ease-out-expo);
}

.buzzer-readout.is-shown {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Header controls — language and theme
   -------------------------------------------------------------------------- */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-block-size: 40px;
  padding: 0.4em 0.9em;
  background: transparent;
  color: var(--on-bg);
  border: var(--hair) solid var(--hairline);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-out-expo);
}

.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translate3d(0, -2px, 0);
}

.pill-btn--icon {
  inline-size: 40px;
  padding: 0;
}

.pill-btn svg {
  inline-size: 17px;
  block-size: 17px;
  flex: none;
}

/* Both toggles are JS-only controls: without scripting they would be dead
   buttons, so they are not rendered at all. boot.js always stamps
   data-theme, so the icon that shows is a straight attribute match. */
html:not(.js) .js-only {
  display: none;
}

.icon-sun,
.icon-moon {
  display: none;
}

/* The theme toggle shows the mode it will switch TO. */
html[data-theme="dark"] .icon-sun {
  display: block;
}

html[data-theme="light"] .icon-moon {
  display: block;
}

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  flex: 1 1 15rem;
}

.field__label {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

html[lang="ar"] .field__label {
  letter-spacing: normal;
  text-transform: none;
}

.field__input {
  inline-size: 100%;
  padding: 0.72em 0.95em;
  background: var(--bg);
  color: var(--on-bg);
  border: var(--hair) solid var(--hairline);
  border-radius: var(--radius);
  font-size: var(--text-base);
}

.field__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field__input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.field__input[aria-invalid="true"] {
  border-color: var(--accent);
}

.form-status {
  min-block-size: 1.5em;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--positive);
}

.form-status[data-state="error"] {
  color: var(--accent-ink);
}
