/* ------------------------------------------------------------------
   مَرّ — tokens
   Two colours carry the brand: cobalt and white. Everything else is a
   tint of cobalt, so the screens read as one cup sleeve.
------------------------------------------------------------------ */

:root {
  --cobalt: #1a3fd9;
  --cobalt-deep: #0b1f7a;
  --ink: #0a1a5c;
  --soft: #eaeeff;
  --line: #c7d1fb;
  --muted: #4a5a9c;
  --white: #fff;

  --radius: 18px;
  --tap: 56px;
  --font: 'Alexandria', 'Geeza Pro', 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* Keyboard focus never lands under the sticky top bar or bottom dock. */
html,
.phone {
  scroll-padding-block: 80px 200px;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-tap-highlight-color: transparent;
}

button,
input,
output {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.screen--cobalt :focus-visible {
  outline-color: var(--white);
}

h1:focus,
.phone:focus {
  outline: none;
}

/* ------------------------------------------------------------------
   Stage: the phone fills the screen on mobile. From 960px it stands
   beside a short note for the café owner.
------------------------------------------------------------------ */

.pitch {
  display: none;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
}

.screen--cobalt {
  background: var(--cobalt);
  color: var(--white);
}

/* ------------------------------------------------------------------
   Shared pieces
------------------------------------------------------------------ */

.wordmark {
  font-size: 3.25rem;
  font-weight: 900;
  line-height: 1;
}

.title {
  margin: 8px 0 20px;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1.15;
  color: var(--cobalt);
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -12px -20px 0;
  padding: 12px 20px;
  background: var(--white);
}

.bar__mark {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  color: var(--cobalt);
}

.bar__branch {
  flex: 1;
  font-size: 0.95rem;
}

.bar__branch strong {
  font-weight: 800;
  color: var(--cobalt);
}

.back,
.bar__change {
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--cobalt);
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  color: var(--cobalt);
}

.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--cobalt);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--white);
}

.cta:active,
.branch:active,
.drink:active {
  transform: scale(0.98);
}

.cta__price {
  flex: none;
  padding: 4px 12px;
  white-space: nowrap;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.18);
  font-weight: 700;
}

.cta--light {
  justify-content: center;
  background: var(--white);
  color: var(--cobalt);
}

/* Secondary action: same size and shape, outlined. */
.cta--ghost {
  justify-content: center;
  min-height: 54px;
  border: 2px solid var(--cobalt);
  background: var(--white);
  color: var(--cobalt);
}

.cta--small {
  min-height: 48px;
  font-size: 1rem;
}

/* The bottom action stays under the thumb while the options scroll. */
.dock {
  position: sticky;
  bottom: 0;
  margin: auto -20px calc(-20px - env(safe-area-inset-bottom));
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--soft);
  background: var(--white);
}

.dock--stack {
  display: grid;
  gap: 10px;
}

/* ------------------------------------------------------------------
   1. Branch question
------------------------------------------------------------------ */

.screen--branch {
  padding-top: 28px;
}

.ask {
  margin: auto 0 28px;
  padding-top: 40px;
  font-size: clamp(2.9rem, 14vw, 3.9rem);
  font-weight: 900;
  line-height: 1.12;
}

.branches {
  display: grid;
  gap: 12px;
}

.branch {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 92px;
  padding: 16px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--white);
  text-align: start;
  color: var(--ink);
}

.branch__name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--cobalt);
}

.branch__detail {
  font-size: 0.95rem;
}

.branch__status {
  font-size: 0.9rem;
  font-weight: 700;
}

.branch__status--closed {
  color: var(--muted);
}

.branch-hint {
  margin-top: 20px;
  font-size: 0.95rem;
}

/* ------------------------------------------------------------------
   2. Menu
------------------------------------------------------------------ */

.menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 14px;
}

.drink {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: start;
}

.drink__photo,
.item__photo {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--soft);
}

.drink__photo img,
.item__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drink__photo {
  margin-bottom: 6px;
}

.drink__name {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.3;
}

.drink__price {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--cobalt);
}

/* ------------------------------------------------------------------
   3. Drink options
------------------------------------------------------------------ */

.item__head {
  display: grid;
  grid-template-columns: 38% 1fr;
  gap: 18px;
  align-items: end;
  margin: 8px 0 24px;
}

.item__head .title {
  margin: 0 0 6px;
}

.item__desc {
  font-size: 0.95rem;
}

.group {
  margin: 0 0 22px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.group__title {
  display: block;
  margin-bottom: 10px;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.choices {
  display: grid;
  gap: 10px;
}

.choices--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choices--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice {
  position: relative;
  display: grid;
  align-content: center;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}

/* The hidden input covers its card, so a tap anywhere on it lands on the input. */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--cobalt);
  background: var(--cobalt);
  color: var(--white);
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.choice__main {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
}

.choice__sub,
.choice__extra {
  font-size: 0.85rem;
}

.choice__extra {
  font-weight: 700;
}

/* Pickup times: one row each, time on one side and the day on the other. */
.choices--list .choice {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.fixed {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--soft);
}

.switch {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}

.switch:has(input:checked) {
  border-color: var(--cobalt);
}

.switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 54px;
  height: 32px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s;
}

.switch input::before {
  content: '';
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white);
  transition: inset-inline-start 0.2s;
}

.switch input:checked {
  background: var(--cobalt);
}

.switch input:checked::before {
  inset-inline-start: 26px;
}

.switch__text {
  flex: 1;
  font-weight: 700;
}

.switch__price {
  font-weight: 700;
  color: var(--cobalt);
}

.qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qty .group__title {
  margin: 0;
}

.stepper {
  display: flex;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 999px;
}

.stepper__btn {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--cobalt);
}

.stepper__btn[aria-disabled='true'] {
  color: var(--line);
  cursor: default;
}

.stepper__value {
  min-width: 2.2em;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
}

/* ------------------------------------------------------------------
   4. Pickup time
------------------------------------------------------------------ */

.cart {
  margin-bottom: 24px;
  padding: 16px 18px 18px;
  border-radius: var(--radius);
  background: var(--soft);
}

.cart__lines {
  margin-bottom: 4px;
}

.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 2px solid var(--line);
}

.line__name {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.4;
}

.line__mods {
  font-size: 0.9rem;
}

.line__price {
  grid-column: 2;
  grid-row: 1;
  font-weight: 800;
  color: var(--cobalt);
}

.line__controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.line .stepper {
  background: var(--white);
}

.line .stepper__btn {
  width: 44px;
  height: 44px;
}

.line__remove {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: none;
  font-weight: 700;
  color: var(--cobalt);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 10px 0 14px;
  font-weight: 700;
}

.cart__total strong {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--cobalt);
}

.empty {
  margin-bottom: 20px;
}

.note {
  margin-bottom: 22px;
  padding: 12px 16px;
  border-inline-start: 4px solid var(--cobalt);
  background: var(--soft);
  font-size: 0.95rem;
}

.note--alert {
  border-inline-start-color: var(--cobalt-deep);
  background: var(--cobalt);
  font-weight: 700;
  color: var(--white);
}

.note--alert:focus {
  outline: none;
}

.demo-note {
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* ------------------------------------------------------------------
   5. Pickup ticket — the one loud moment
------------------------------------------------------------------ */

.screen--ticket {
  align-items: center;
  padding-top: 24px;
  text-align: center;
}

.wordmark--small {
  font-size: 2.25rem;
}

.ticket-title {
  margin: 18px 0 16px;
  font-size: 1.35rem;
  font-weight: 800;
}

.ticket {
  width: 100%;
  max-width: 360px;
  border-radius: 22px;
  background: var(--white);
  text-align: start;
  color: var(--ink);
}

.ticket__top {
  padding: 22px 24px 20px;
}

.ticket__label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}

.ticket__number {
  margin: 2px 0 18px;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1.05;
  color: var(--cobalt);
}

.ticket__facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.ticket__facts dt {
  font-size: 0.85rem;
  color: var(--muted);
}

.ticket__facts dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.4;
}

/* Tear line with a notch on each side, cut in the screen's cobalt. */
.ticket__body {
  position: relative;
  padding: 22px 24px 24px;
  border-top: 2px dashed var(--line);
}

.ticket__body::before,
.ticket__body::after {
  content: '';
  position: absolute;
  top: -15px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cobalt);
}

.ticket__body::before {
  inset-inline-start: -15px;
}

.ticket__body::after {
  inset-inline-end: -15px;
}

.ticket__line + .ticket__line {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--soft);
}

.ticket__line-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ticket__drink {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.3;
}

.ticket__price {
  flex: none;
  font-weight: 800;
  color: var(--cobalt);
}

.ticket__size {
  margin-bottom: 12px;
  color: var(--muted);
}

.ticket__mods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ticket__mods li {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cobalt);
}

.ticket__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px solid var(--soft);
  font-weight: 700;
}

.ticket__total strong {
  font-size: 1.5rem;
  font-weight: 900;
}

.ticket__demo {
  margin-top: 16px;
  font-size: 0.88rem;
  line-height: 1.7;
}

.stamp {
  display: inline-block;
  margin-inline-end: 6px;
  padding: 0 10px;
  border: 2px solid var(--cobalt);
  border-radius: 8px;
  font-weight: 900;
  color: var(--cobalt);
  transform: rotate(-4deg);
}

.ticket-hint {
  margin: 18px 0 20px;
}

.screen--ticket .cta {
  max-width: 360px;
  margin-top: auto;
}

/* The ticket comes out of the slot once, when the order is confirmed. */
.ticket--print {
  animation: print 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes print {
  from {
    transform: translateY(-28px);
    clip-path: inset(0 0 100% 0);
  }
  to {
    transform: none;
    clip-path: inset(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticket--print {
    animation: none;
  }

  .switch input,
  .switch input::before {
    transition: none;
  }
}

/* ------------------------------------------------------------------
   Wider screens
------------------------------------------------------------------ */

@media (min-width: 600px) and (max-width: 959px) {
  .screen {
    max-width: 560px;
    margin-inline: auto;
  }

  .menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  body {
    background: var(--cobalt);
  }

  .stage {
    display: grid;
    grid-template-columns: minmax(0, 400px) 420px;
    justify-content: center;
    align-items: center;
    gap: clamp(56px, 8vw, 128px);
    min-height: 100vh;
    padding: 32px;
  }

  .pitch {
    display: block;
    color: var(--white);
  }

  .pitch__mark {
    font-size: 9.5rem;
    font-weight: 900;
    line-height: 1;
  }

  .pitch__line {
    margin: 24px 0 16px;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.4;
  }

  .pitch__note {
    max-width: 34ch;
    font-size: 1rem;
  }

  .phone {
    height: min(860px, calc(100vh - 64px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    border: 10px solid var(--cobalt-deep);
    border-radius: 44px;
    background: var(--white);
  }

  .phone::-webkit-scrollbar {
    display: none;
  }

  .screen {
    min-height: 100%;
  }
}
