/* Design system from docs/design/barbershop.css. */

:root {
  color-scheme: only light;

  /* Colour: enamel plate (white + cobalt), barber-pole red, one green. */
  --paper: #ffffff;       /* every background */
  --ink: #0d1526;         /* text, selected state            18.2:1 on paper */
  --muted: #4b556b;       /* secondary text                   7.5:1 */
  --edge: #5a6580;        /* outline of anything tappable     5.8:1 */
  --line: #d8dde6;        /* dividers only, never a control */
  --wash: #eef1f6;        /* pressed state, read-only fields */
  --blue: #1a3c9e;        /* THE action on the screen         9.6:1 */
  --blue-deep: #132c78;   /* action, pressed */
  --green: #085f2e;       /* done, paid, arrived              7.8:1 */
  --green-wash: #e6f4eb;
  --red: #a5151a;         /* problem, missed, cancel          7.7:1 */
  --red-wash: #fcebeb;
  --pole-red: #d0222a;    /* stripe only, never text */

  /* Type: one family, three weights (400 / 600 / 700). */
  --font: "Sofia Sans", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-small: 1.0625rem;  /* 17px  small links, second lines */
  --text-body: 1.1875rem;   /* 19px  sentences */
  --text-label: 1.375rem;   /* 22px  anything you tap, anything you type */
  --text-title: 1.875rem;   /* 30px  the question */
  --text-hero: 2.375rem;    /* 38px  the one fact that matters */

  /* Space and shape */
  --gutter: 20px;
  --gap: 12px;
  --tap: 64px;        /* height of choices, buttons, fields */
  --tap-small: 48px;  /* height of small links, never less */
  --radius: 14px;
  --stroke: 2px;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--text-body) / 1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

p {
  margin: 0 0 8px;
}

a {
  color: inherit;
}

svg.icon {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ---------- Page ---------- */

/* One column, left aligned, content in normal flow from the top.
   Nothing is pinned to the viewport: Instagram's browser hides it. */
.screen {
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 40px
    max(var(--gutter), env(safe-area-inset-left));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  min-height: 56px;
  margin-top: 4px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap-small);
  margin-left: -6px;
  padding-right: 16px;
  font-weight: 600;
  text-decoration: none;
}

.shop {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.shop__photo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--wash);
}

.question {
  margin: 8px 0 20px;
  font: 700 var(--text-title) / 1.15 var(--font);
  letter-spacing: -0.01em;
}

.hero {
  margin: 4px 0 12px;
  font: 700 var(--text-hero) / 1.1 var(--font);
  letter-spacing: -0.015em;
}

.context {
  margin: 0 0 4px;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: var(--gap);
}

.after {
  margin-top: 28px;
}

/* ---------- Choice: tap the answer, move on ---------- */

.choices {
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  background: var(--paper);
  border: var(--stroke) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  font: 600 var(--text-label) / 1.2 var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.choice:active,
.choice[aria-busy="true"] {
  background: var(--wash);
  border-color: var(--ink);
}

.choice__name {
  flex: 1 1 auto;
  min-width: 0;
}

.choice__hours {
  display: grid;
  flex: none;
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.choice__price {
  flex: none;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.choice__price small {
  display: block;
  color: var(--muted);
  font-size: var(--text-small);
}

.choice__photo {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--wash);
}

/* ---------- Days and times ---------- */

.days {
  display: flex;
  gap: 8px;
  margin: 0 calc(var(--gutter) * -1) 20px;
  padding: 2px var(--gutter);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

/* 96px wide: three and a bit fit on a 360px phone, so the cut-off
   fourth one says "there is more this way" without an arrow. */
.day {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 56px;
  padding: 0 14px;
  background: var(--paper);
  border: var(--stroke) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  font: 600 var(--text-body) / 1 var(--font);
  text-decoration: none;
  white-space: nowrap;
}

.day[aria-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.part {
  margin: 20px 0 8px;
  color: var(--muted);
  font: 600 var(--text-body) / 1.2 var(--font);
}

.part:first-of-type {
  margin-top: 0;
}

.times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.time {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  background: var(--paper);
  border: var(--stroke) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  font: 600 var(--text-label) / 1 var(--font);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.time:active,
.time[aria-busy="true"],
.day:active,
.day[aria-busy="true"] {
  background: var(--wash);
  border-color: var(--ink);
}

/* ---------- Field ---------- */

.field {
  display: block;
  margin-bottom: 20px;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.field__input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0 16px;
  background: var(--paper);
  border: var(--stroke) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  font: 400 var(--text-label) / 1.2 var(--font);
  -webkit-appearance: none;
  appearance: none;
}

/* Without the native look, iOS draws a date or time value at the top of the
   field and centred. A line box as tall as the field centres it vertically,
   and it sits on the left like any other typed value (R-7). */
.field__input[type="date"],
.field__input[type="time"] {
  height: var(--tap);
  line-height: calc(var(--tap) - 2 * var(--stroke));
}

.field__input::-webkit-date-and-time-value {
  margin: 0;
  text-align: left;
}

.field__input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue);
}

.field--error .field__input {
  border-color: var(--red);
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--red);
  font-weight: 600;
}

/* One period is one line: from, to, and the button that removes it. */
.availability__period {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

/* Focused by script after adding or removing a period, so a screen reader
   announces it. It is not tappable, so it gets no outline (R-2). */
.availability__period:focus {
  outline: none;
}

.availability__period .field {
  min-width: 0;
  margin-bottom: 0;
}

.availability__period .act {
  min-height: var(--tap);
  padding: 0 12px;
  font-size: var(--text-body);
}

/* ---------- Button: one per screen says what happens next ---------- */

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 20px;
  background: var(--blue);
  border: var(--stroke) solid var(--blue);
  border-radius: var(--radius);
  color: var(--paper);
  font: 600 var(--text-label) / 1.2 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.button:active {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.button--quiet {
  background: var(--paper);
  color: var(--blue);
}

.button--quiet:active {
  background: var(--wash);
  border-color: var(--blue);
}

.button--danger {
  background: var(--red);
  border-color: var(--red);
}

.button--done {
  background: var(--green);
  border-color: var(--green);
}

/* Turbo disables the submitter and swaps its text (data-turbo-submits-with). */
.button:disabled,
.button[aria-busy="true"] {
  background: var(--muted);
  border-color: var(--muted);
  color: var(--paper);
}

.link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-small);
  color: var(--ink);
  font-size: var(--text-small);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* A small link that writes ("Sair") is a button_to; it looks like any other link. */
button.link {
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--font);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.links {
  display: grid;
  justify-items: start;
  margin-top: 16px;
}

/* ---------- Payment ---------- */

.code {
  display: block;
  width: 100%;
  min-height: var(--tap-small);
  margin-top: 8px;
  padding: 0 14px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font: 400 var(--text-small) / 1 var(--font);
  text-overflow: ellipsis;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.steps li > span {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-top: -1px;
  background: var(--ink);
  border-radius: 50%;
  color: var(--paper);
  font-size: var(--text-small);
  font-weight: 700;
}

/* Countdown is proportional to the remaining hold time. */
.hold {
  margin: 24px 0 16px;
}

.pole {
  height: 12px;
  background: var(--wash);
  border-radius: 6px;
  overflow: hidden;
}

.pole__left {
  width: var(--left, 100%);
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  transition: width 1s linear;
}

.pole__stripes {
  width: calc(100% + 40px);
  height: 100%;
  background-image: linear-gradient(
    135deg,
    var(--blue) 0 12.5%,
    var(--paper) 12.5% 25%,
    var(--pole-red) 25% 37.5%,
    var(--paper) 37.5% 50%,
    var(--blue) 50% 62.5%,
    var(--paper) 62.5% 75%,
    var(--pole-red) 75% 87.5%,
    var(--paper) 87.5% 100%
  );
  background-size: 40px 40px;
  animation: pole-turn 1.4s linear infinite;
}

@keyframes pole-turn {
  from {
    transform: translateX(-40px);
  }
  to {
    transform: translateX(0);
  }
}

.hold__text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--text-small);
}

.hold__text b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* "Pagar com outro celular": a <details>, so it opens with no JavaScript
   and no new page. */
.other-phone summary {
  list-style: none;
  cursor: pointer;
}

.other-phone summary::-webkit-details-marker {
  display: none;
}

.qr {
  display: block;
  width: 240px;
  max-width: 100%;
  height: auto;
  margin: 8px 0 12px;
}

/* ---------- Messages ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 14px 16px;
  background: var(--red-wash);
  border: var(--stroke) solid var(--red);
  border-radius: var(--radius);
  font-weight: 600;
}

.notice .icon {
  margin-top: 2px;
  color: var(--red);
}

.notice--good {
  background: var(--green-wash);
  border-color: var(--green);
}

.notice--good .icon {
  color: var(--green);
}

/* Toast: a flash message pinned over the page like an enamel tag, so the content never moves.
   The colour block repeats the word (R-3); the card's shadow says it floats above the screen. */
.toasts {
  position: fixed;
  z-index: 10;
  top: calc(10px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
}

.toasts:empty {
  display: none;
}

.toast {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  background: var(--paper);
  border: var(--stroke) solid var(--red);
  border-radius: var(--radius);
  box-shadow: 0 14px 30px -12px rgb(13 21 38 / 0.45);
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in 240ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toast__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  background: var(--red);
  color: var(--paper);
}

.toast__text {
  flex: 1;
  align-self: center;
  margin: 0;
  padding: 12px 4px 12px 14px;
  line-height: 1.3;
}

.toast__close {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--tap-small);
  min-height: var(--tap-small);
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.toast__close:active {
  background: var(--wash);
}

.toast__close:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: -6px;
  border-radius: 10px;
}

.toast--good {
  border-color: var(--green);
}

.toast--good .toast__mark {
  background: var(--green);
}

.toast--leaving {
  animation: toast-out 160ms ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(calc(-100% - 16px)); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-16px); }
}

@keyframes toast-fade {
  from { opacity: 0; }
}

.done {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 16px;
}

.done__mark {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--green);
  border-radius: 50%;
  color: var(--paper);
  font-size: 1.5rem;
  animation: done-in 0.25s ease-out both;
}

@keyframes done-in {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

.done .question {
  margin: 0;
}

/* ---------- Barber agenda ---------- */

.daybar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 12px;
}

.daybar .question {
  margin: 0;
}

.daybar__date {
  color: var(--muted);
}

.daybar__action {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-small);
  margin-left: auto;
  padding: 0 14px;
  border: var(--stroke) solid var(--blue);
  border-radius: var(--radius);
  color: var(--blue);
  font: 600 var(--text-body) / 1 var(--font);
  text-decoration: none;
  white-space: nowrap;
}

.daybar__action:active {
  background: var(--wash);
}

.segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  background: var(--paper);
  border: var(--stroke) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  font: 600 var(--text-body) / 1 var(--font);
  text-decoration: none;
}

.rows {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 68px 1fr;
  column-gap: 12px;
  align-items: center;
  min-height: 80px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.row__main {
  display: contents;
  color: inherit;
  text-decoration: none;
}

.row__time {
  align-self: start;
  padding-top: 1px;
  font: 700 var(--text-label) / 1.2 var(--font);
  font-variant-numeric: tabular-nums;
}

.row__who {
  min-width: 0;
}

.row__name {
  display: block;
  font-weight: 600;
  line-height: 1.25;
}

.row__what {
  display: block;
  color: var(--muted);
  font-size: var(--text-small);
  line-height: 1.35;
}

/* The action for right now sits under the line, full width.
   Two answers ("Chegou" / "Faltou") share the width. */
.row__actions {
  grid-column: 1 / -1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--gap);
  margin-top: 12px;
}

.row--past .row__time,
.row--past .row__name {
  color: var(--muted);
}

.row--off .row__time,
.row--off .row__name {
  color: var(--muted);
  text-decoration: line-through;
}

.act {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 16px;
  background: var(--blue);
  border: var(--stroke) solid var(--blue);
  border-radius: var(--radius);
  color: var(--paper);
  font: 600 var(--text-body) / 1 var(--font);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.act:active {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
}

.act--missed {
  background: var(--paper);
  border-color: var(--red);
  color: var(--red);
}

.act--undo,
.act--quiet {
  background: var(--paper);
  border-color: var(--edge);
  color: var(--ink);
}

.act--missed:active,
.act--undo:active,
.act--quiet:active {
  background: var(--wash);
}

/* A state is always a word. Colour and icon only repeat what the word says. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.tag .icon {
  width: 1em;
  height: 1em;
  stroke-width: 3;
}

.tag--good {
  color: var(--green);
}

.tag--bad {
  color: var(--red);
}

.tag--plain {
  color: var(--muted);
}

.now {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: var(--blue);
  font-size: var(--text-small);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.now::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--blue);
}

/* The only pinned element in the product, and only for the barbers, who use
   Safari or Chrome. sticky, not fixed: if it fails it is still in the page. */
.dock {
  position: sticky;
  bottom: 0;
  margin: 24px calc(var(--gutter) * -1) -40px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.facts {
  margin: 0 0 24px;
}

.facts div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* ---------- Turbo ---------- */

.turbo-progress-bar {
  height: 4px;
  background: var(--blue);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .pole__stripes,
  .done__mark {
    animation: none;
  }

  .toast {
    animation-name: toast-fade;
  }

  .toast--leaving {
    animation: none;
    opacity: 0;
  }

  .pole__left {
    transition: none;
  }
}

@font-face {
  font-family: "Sofia Sans";
  src: url("/assets/sofia-sans-latin-0b5551d6.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

[hidden] { display: none !important; }
.initials { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1rem; }
.row__actions .act { width: 100%; }
.choice__name, .row__name, .question, .facts dd { overflow-wrap: anywhere; }
.button + .question { margin-top: 28px; }
@media (max-width: 23rem) {
  .daybar__action { padding: 0 8px; }
}
