/* MechanicsPAD demo.
   The start screen keeps the website's shop-floor look. The demo itself is
   quiet: three phones in a phone's own colours on a dark stage, and a guide
   that reads like a message. Alex, Nov 27 2026: "I want this to look
   sophisticated, not like a childrens toy". */
:root {
  --ink: #111111;
  --paper: #f4f2ec;
  --card: #ffffff;
  --red: #d7141a;
  --red-deep: #a90f14;
  --steel: #565b61;

  /* the demo: a phone's own colours */
  --stage: #0b0c0f;
  --on-stage: #f5f5f7;
  --on-stage-soft: #9b9da6;
  --blue: #0a7cff;
  --blue-deep: #0062d6;
  --green: #2fb457;
  --orange: #f59a0b;
  --bubble: #e9e9eb;
  --hair: #d8d8dd;
  --quiet: #8e8e93;
  --text: #1c1c1e;

  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", sans-serif-condensed, Impact, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lean: 12px;
  --slow: 900ms;           /* how long the light takes to move from one phone to the next */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--body);
}
body.visiting { background: radial-gradient(120% 80% at 50% 0%, #1b1d23 0%, var(--stage) 60%); color: var(--on-stage); }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--red-deep); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* --- top bar --------------------------------------------------------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 1rem;
  background: var(--ink);
}
.top img { display: block; height: 30px; width: auto; }
.tag {
  padding: 0.15rem 0.8rem;
  background: var(--red); color: #fff;
  font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase;
  letter-spacing: 0.05em; font-size: 0.9rem;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
body.visiting .tag {
  padding: 0.2rem 0.7rem; border-radius: 999px; clip-path: none;
  background: rgba(255, 255, 255, 0.12); color: var(--on-stage-soft);
  font: 600 0.75rem/1.3 var(--body); letter-spacing: 0.04em;
}

/* --- before a visit ---------------------------------------------------------- */
.start { width: 100%; max-width: 30rem; margin: 0 auto; padding: 2rem 1.25rem 2.5rem; }
.kicker {
  margin: 0 0 0.5rem;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.12em; font-size: 0.95rem; color: var(--red);
}
h1 {
  margin: 0;
  font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase;
  font-size: clamp(2.2rem, 1.5rem + 4vw, 3.2rem); line-height: 1;
}
h1 span { display: block; color: var(--red); }
.lead { margin: 1rem 0 1.5rem; font-size: 1.05rem; color: #2b2b2b; }
.start label { display: block; margin: 1rem 0 0.3rem; font-weight: 700; }
.start input {
  width: 100%; padding: 0.8rem 0.9rem;
  border: 2px solid var(--ink); border-radius: 4px; background: var(--card);
  font-size: 1.1rem;
}
.button {
  display: block; width: 100%; margin-top: 1.4rem; padding: 0.9rem 1.5rem;
  border: 0; background: var(--red); color: #fff;
  font-family: var(--display); font-weight: 800; font-style: italic; font-size: 1.35rem;
  text-transform: uppercase; letter-spacing: 0.03em;
  clip-path: polygon(var(--lean) 0, 100% 0, calc(100% - var(--lean)) 100%, 0 100%);
  transition: background-color 150ms;
}
.button:hover { background: var(--red-deep); }
button:disabled { opacity: 0.5; cursor: default; }
.bot-check { margin-top: 1.2rem; min-height: 65px; }
.small { margin: 1.2rem 0 0; font-size: 0.85rem; color: var(--steel); }
.problem {
  margin: 0.8rem 0 0; padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--red); border-radius: 6px; background: #fff; color: var(--text); font-weight: 600;
}

/* --- the guide: what to do next, or what just happened -------------------------- */
.demo { flex: 1; display: flex; flex-direction: column; min-height: 0; width: 100%; max-width: 72rem; margin: 0 auto; }
.guide { padding: 0.75rem 0.75rem 0.5rem; }
.hint {
  display: flex; gap: 0.75rem; align-items: flex-start;
  min-height: 11.5rem; padding: 0.9rem 1rem 1rem;
  border-radius: 22px; background: #fff; color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.demo.beginning .hint { min-height: 0; }
.hint.changed .words { animation: settle 700ms ease-out; }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } }
.face {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; margin-top: 2px;
  border-radius: 50%; background: var(--ink); color: #fff;
  font: 700 0.8rem/1 var(--body); letter-spacing: 0.02em;
}
.words { flex: 1; min-width: 0; }
.over { display: flex; flex-wrap: wrap; gap: 0.1rem 0.6rem; align-items: baseline; margin-bottom: 0.2rem; }
.count { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--quiet); }
.where { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--blue); }
.hint p { margin: 0; font-size: 1.12rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.go, .next {
  display: inline-block; margin-top: 0.75rem; padding: 0.5rem 1.15rem;
  border: 0; border-radius: 999px; background: var(--blue); color: #fff;
  font-weight: 600; font-size: 0.95rem;
  transition: background-color 150ms;
}
.go:hover, .next:hover { background: var(--blue-deep); }
.go::after, .next::after { content: "  \2192"; }
.reading { height: 3px; margin-top: 0.85rem; border-radius: 2px; background: #e5e5ea; overflow: hidden; }
.reading i { display: block; height: 100%; background: var(--blue); transform-origin: left; animation: reading linear both; }
@keyframes reading { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.begin { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; max-width: 30rem; margin-top: 0.8rem; }
.begin-button {
  padding: 0.7rem 0.5rem 0.75rem;
  border: 0; border-radius: 16px; color: #fff; text-align: center; line-height: 1.25;
  transition: transform 150ms, filter 150ms;
}
.begin-button.call { background: var(--green); }
.begin-button.text { background: var(--blue); }
.begin-button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.begin-button b { display: block; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.begin-button span { font-size: 0.8rem; font-weight: 500; opacity: 0.92; }
.demo.beginning .later, .demo.beginning .go { display: none; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; margin-top: 0.7rem; }
.clock { margin-right: auto; font-size: 0.8rem; font-weight: 600; color: var(--on-stage-soft); }
.control {
  padding: 0.4rem 0.85rem;
  border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: var(--on-stage);
  font-size: 0.82rem; font-weight: 600;
  transition: background-color 150ms;
}
.control:hover { background: rgba(255, 255, 255, 0.2); }
.control.strong { background: var(--on-stage); color: var(--ink); }
.control.strong:hover { background: #fff; }

/* --- three tabs, on a phone: a segmented control ---------------------------------- */
.tabs { display: flex; gap: 2px; margin: 0.25rem 0.75rem 0.6rem; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, 0.1); }
.tab {
  flex: 1; padding: 0.42rem 0.2rem;
  border: 0; border-radius: 8px; background: none; color: var(--on-stage-soft);
  font-size: 0.85rem; font-weight: 600;
  transition: background-color 200ms, color 200ms;
}
.tab[aria-selected="true"] { background: #fff; color: var(--ink); }

/* --- the three screens. All three are the same phone. --------------------------------- */
.screens { flex: 1; display: flex; min-height: 0; }
.phone { flex: 1; display: none; flex-direction: column; min-height: 0; min-width: 0; }
.phone.showing { display: flex; }
.label { display: none; }
.device { flex: 1; display: flex; min-height: 0; }
.screen { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fff; color: var(--text); }

.bar {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 0.45rem 0.75rem 0.4rem;
  border-bottom: 1px solid var(--hair); background: #f6f6f7;
}
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; background: linear-gradient(#a6abb6, #7d828e); color: #fff;
  font-size: 0.72rem; font-weight: 600;
}
.bar b { font-size: 0.75rem; font-weight: 500; }
.bar span:last-child { font-size: 0.68rem; color: var(--quiet); }
.bar b.title { font-size: 1.05rem; font-weight: 700; padding-top: 0.35rem; }

.thread { flex: 1; min-height: 10rem; margin: 0; padding: 0.75rem 0.7rem; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.thread li { max-width: 80%; padding: 0.45rem 0.8rem; border-radius: 18px; font-size: 1rem; line-height: 1.32; overflow-wrap: anywhere; white-space: pre-wrap; }
.thread .received { align-self: flex-start; background: var(--bubble); color: #000; border-bottom-left-radius: 5px; }
.thread .typed { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.thread .received + .typed, .thread .typed + .received { margin-top: 0.3rem; }
.thread .note { align-self: center; max-width: 100%; margin: 0.35rem 0; padding: 0 0.5rem; background: none; color: var(--quiet); font-size: 0.72rem; font-weight: 500; text-align: center; }
.thread .arriving { animation: arrive-line var(--slow) ease-out; }
@keyframes arrive-line { from { opacity: 0; transform: translateY(14px); } }
.thread .waiting { align-self: flex-start; background: var(--bubble); color: var(--quiet); letter-spacing: 0.2em; animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.35; } }

/* The note with each phone: what to type there now, and one example. */
.type-note {
  order: -1;                    /* on a phone-sized page it sits above the screen, clear of the keyboard */
  margin: 0; padding: 0 1rem 0.55rem;
  font-size: 0.85rem; line-height: 1.4; text-align: center; color: var(--on-stage-soft);
}
.type-note.empty { display: none; }
.type-note span { color: var(--on-stage); }
.type-note .eg { margin-left: 0.35rem; color: var(--on-stage-soft); }
.type-note q { color: #8ec1ff; font-weight: 600; quotes: "\201C" "\201D"; }
.send { display: flex; gap: 0.45rem; align-items: center; padding: 0.5rem 0.7rem calc(0.6rem + env(safe-area-inset-bottom)); }
.send input { flex: 1; min-width: 0; padding: 0.42rem 0.9rem; border: 1px solid #c9c9ce; border-radius: 999px; background: #fff; color: #000; }
.send input::placeholder { color: #b0b0b6; }
.send button {
  flex: none; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: var(--blue); color: #fff;
  font-size: 1.05rem; font-weight: 700; line-height: 1;
}

/* --- the calendar ---------------------------------------------------------------------- */
.agenda { flex: 1; min-height: 10rem; padding: 0.4rem 0.75rem 0.75rem; overflow-y: auto; }
.agenda h3 { margin: 0.9rem 0 0.45rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--hair); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--red); }
.entry { margin-bottom: 0.45rem; padding: 0.55rem 0.7rem; border-left: 4px solid var(--quiet); border-radius: 8px; background: #f2f2f7; }
.entry.hold { border-left-color: var(--orange); background: #fff5e2; }
.entry.confirmed { border-left-color: var(--green); background: #e9f7ee; }
.entry.fresh { animation: arrive 2.4s ease-out; }
@keyframes arrive { 0% { opacity: 0; transform: scale(0.94); box-shadow: 0 0 0 4px var(--blue); } 30% { opacity: 1; } 100% { transform: none; box-shadow: 0 0 0 0 transparent; } }
.entry .when { font-size: 0.75rem; font-weight: 600; color: #5f6066; }
.entry .title { font-size: 0.95rem; font-weight: 600; }
.entry .state { display: block; margin: 0.1rem 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--quiet); }
.entry.hold .state { color: #b56a00; }
.entry.confirmed .state { color: #1c8a3e; }
.entry .place { font-size: 0.85rem; }
.entry ul { margin: 0.3rem 0 0; padding: 0; list-style: none; font-size: 0.82rem; color: #3a3a3c; }
.agenda .empty { color: var(--quiet); }

/* --- contact --------------------------------------------------------------------------- */
.contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 0.6rem; padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; font-size: 0.9rem; }
.contact a { color: #fff; font-weight: 700; }
body.visiting .contact { padding-top: 0.45rem; padding-bottom: 0.45rem; background: #000; color: var(--on-stage-soft); font-size: 0.8rem; }
body.visiting .contact b { display: none; }

/* On a phone the demo fills the screen, so the text box stays in reach. */
@media (max-width: 999px) {
  body.visiting { height: 100dvh; overflow: hidden; }
  body.visiting .top { padding: 0.35rem 0.75rem; }
  body.visiting .top img { height: 22px; }
  .screen { border-radius: 18px 18px 0 0; overflow: hidden; }
}

/* --- a wide page: three phones side by side. The one in use is lit; the others go dark. ---- */
@media (min-width: 1000px) {
  .tabs { display: none; }
  .guide { padding: 1.25rem 1.25rem 0.75rem; }
  .hint { min-height: 9.75rem; padding: 1.1rem 1.4rem 1.2rem; }
  .hint p { font-size: 1.3rem; }
  .screens { flex: none; gap: 1.75rem; padding: 0.75rem 1.5rem 2rem; align-items: stretch; }
  .phone, .phone.showing {
    display: flex;
    transition: filter var(--slow), transform var(--slow);
  }
  .label { display: block; padding: 0 0.5rem 0.6rem; text-align: center; }
  .label b { display: block; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; color: var(--on-stage); }
  .label span { font-size: 0.8rem; color: var(--on-stage-soft); }
  .device {
    flex: none; height: min(41rem, calc(100dvh - 28.5rem)); min-height: 22rem;
    padding: 11px; border-radius: 46px; background: #000;
    box-shadow: 0 0 0 1.5px #3a3c44, 0 24px 50px rgba(0, 0, 0, 0.55);
    transition: box-shadow var(--slow);
  }
  .screen { border-radius: 35px; overflow: hidden; }
  .screen::before {            /* the notch */
    content: ""; position: absolute; top: 9px; left: 50%; z-index: 1;
    width: 84px; height: 22px; margin-left: -42px; border-radius: 12px; background: #000;
  }
  .bar { padding-top: 2.5rem; }
  .type-note { order: 0; min-height: 3.4rem; padding: 0.75rem 0.5rem 0; }
  .type-note.empty { display: block; visibility: hidden; }
  .screens.spot .phone { filter: brightness(0.3) saturate(0.7); }
  .screens.spot .phone.active { filter: none; transform: translateY(-6px) scale(1.025); }
  .screens.spot .phone.active .device { box-shadow: 0 0 0 1.5px #5b5e68, 0 0 70px rgba(120, 160, 255, 0.22), 0 30px 60px rgba(0, 0, 0, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .thread .waiting, .thread .arriving, .entry.fresh, .hint.changed .words { animation: none; }
  .phone, .phone.showing, .device { transition: none; }
}
