/* ==========================================================================
   style.css — 234 Doorbell in System 7 dress, the same skin as the guest
   portal: 1-bit, only "ink" and "paper", patterns of 2 px dots, Chicago-like
   type in window chrome and buttons, Geneva-like in body text. --px is "one
   classic pixel" (2 CSS px ≈ 72 dpi scaled to a phone).

   Theme: light = black on white, dark = inverted (white on black), like
   "Invert screen" on old Macs. Light is the default; "Auto" (follow the
   system) or "Dark" can be chosen in the menu and is stored per device.
   ========================================================================== */

/* Geneva is the face of this design. Apple's Geneva cannot be shipped, so devices without
   it (iPhone, Android, Windows) get Luxi Sans: drawn by Bigelow & Holmes, who also drew the
   TrueType Geneva, in the same Lucida style. A Mac never downloads it (Geneva comes first). */
@font-face {
  font-family: "Luxi Sans";
  src: url("fonts/luxisr.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Luxi Sans";
  src: url("fonts/luxisb.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Want real Chicago for the chrome? Put e.g. ChicagoFLF (freeware) in fonts/, add an
   @font-face for it and put it first in --chicago. */

:root {
  --chicago: "Chicago", "ChicagoFLF", "Charcoal", "Geneva", "Luxi Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --geneva: "Geneva", "Luxi Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --px: 2px;
  --ink: #000;
  --paper: #fff;
  --gray50: repeating-conic-gradient(var(--ink) 0 25%, var(--paper) 0 50%) 0 0 / calc(var(--px) * 2) calc(var(--px) * 2);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #fff;
  --paper: #000;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --ink: #fff;
    --paper: #000;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font: 18px/1.35 var(--geneva);
  background: var(--gray50);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: var(--px) dotted var(--ink); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Menu bar
   -------------------------------------------------------------------------- */

.menubar {
  position: relative;
  z-index: 50;
  height: 40px;
  background: var(--paper);
  border-bottom: var(--px) solid var(--ink);
  display: flex;
  align-items: stretch;
  padding: 0 10px;
  font: bold 20px/40px var(--chicago);
}
.menu-title { padding: 0 14px; color: var(--ink); white-space: nowrap; }
.menu-title.apple { font-size: 26px; padding: 0 12px 0 6px; }
button.menu-title.open, button.menu-title:active { background: var(--ink); color: var(--paper); }
.menubar-clock { margin-left: auto; padding: 0 6px; font: 18px/40px var(--geneva); }

.settings-wrap { position: relative; }
.menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 300px;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  border-top: 0;
  box-shadow: var(--px) var(--px) 0 var(--ink);
  padding: 4px 0;
  z-index: 60;
  font: bold 19px/1.2 var(--chicago);
}
.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 24px 9px 42px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover:not(.static) { background: var(--ink); color: var(--paper); }
.menu-item.static { font: 15px/1.3 var(--geneva); cursor: default; padding-top: 5px; padding-bottom: 5px; }
.menu-item.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.menu-item.check input:checked ~ span::before,
.menu-item.opt-btn.active span::before { content: "✓"; position: absolute; left: 16px; }
.menu-item.opt-btn.active { font-weight: bold; }
.menu-sep { height: var(--px); margin: 5px 0; background: repeating-linear-gradient(90deg, var(--ink) 0 var(--px), var(--paper) var(--px) calc(var(--px) * 2)); }
/* At phone width the menu bar keeps only the apple, the settings button and the clock */
@media (max-width: 460px) {
  .menubar .app-name { display: none; }
  .menu { min-width: 280px; }
}

/* --------------------------------------------------------------------------
   Window
   -------------------------------------------------------------------------- */

.desktop { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 26px 14px calc(36px + env(safe-area-inset-bottom)); }
@media (max-width: 460px) { .desktop { padding: 16px 10px calc(28px + env(safe-area-inset-bottom)); } }
.window {
  width: min(100%, 560px);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
}
.titlebar {
  position: relative;
  height: 40px;
  border-bottom: var(--px) solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stripes {
  position: absolute;
  inset: 6px 8px;
  background: repeating-linear-gradient(var(--ink) 0 var(--px), var(--paper) var(--px) calc(var(--px) * 2));
}
.closebox {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border: var(--px) solid var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--paper);
}
.titlebar .title {
  position: relative;
  margin: 0;
  padding: 0 14px;
  background: var(--paper);
  font: bold 21px/1 var(--chicago);
}
/* The app name in the menu bar and the window title both start over */
.titlebar .title button { font: inherit; padding: 4px 2px; }
.titlebar .title button:active, .menubar button.app-name:active { background: var(--ink); color: var(--paper); }
.content { padding: 22px 22px 18px; }
@media (max-width: 460px) { .content { padding: 18px 16px 16px; } }
.statusbar {
  border-top: var(--px) solid var(--ink);
  padding: 8px 14px;
  font: 16px/1.2 var(--geneva);
  display: flex;
  justify-content: center;
}
.conn-status { margin: 0; display: inline-flex; align-items: center; gap: 8px; text-align: center; }
.conn-status .dot { width: 12px; height: 12px; flex-shrink: 0; border: var(--px) solid var(--ink); background: var(--paper); }
.conn-status.ok .dot { background: var(--ink); }
.conn-status.busy .dot { animation: blink 0.9s steps(1) infinite; }
.conn-status.bad .dot { background: var(--gray50); }
@keyframes blink { 50% { background: var(--ink); } }

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.mac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 11px 26px;
  font: bold 19px/1 var(--chicago);
  color: var(--ink);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
}
.mac-btn:active { background: var(--ink); color: var(--paper); }
.mac-btn.default { outline: 6px solid var(--ink); outline-offset: 2px; }
.mac-btn.default:focus-visible { outline: 6px solid var(--ink); }
.mac-btn[disabled] { opacity: 0.5; cursor: default; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin: 6px 0 2px; }

.mac-checkbox { display: inline-flex; align-items: center; gap: 12px; font: 19px/1.2 var(--geneva); color: var(--ink); cursor: pointer; padding: 6px 0; }
.mac-checkbox input {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin: 0;
  border: var(--px) solid var(--ink);
  background: var(--paper);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
/* System 7 checks boxes with an X */
.mac-checkbox input:checked {
  background:
    linear-gradient(45deg, transparent 43%, var(--ink) 43% 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, var(--ink) 43% 57%, transparent 57%),
    var(--paper);
}

.text-input {
  width: 100%;
  font: 20px/1.2 var(--geneva);
  color: var(--ink);
  background: var(--paper);
  border: var(--px) solid var(--ink);
  border-radius: 0;
  padding: 9px 10px;
  -webkit-user-select: text;
  user-select: text;
}
.text-input::placeholder { color: var(--ink); opacity: 0.45; }
.text-input:focus { outline: none; box-shadow: inset 0 0 0 var(--px) var(--ink); }

/* --------------------------------------------------------------------------
   Notice from Slack and the "closed now" line, above whichever view is shown
   -------------------------------------------------------------------------- */

.notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: var(--px) solid var(--ink);
  outline: 4px solid var(--ink);
  outline-offset: 2px;
  background: var(--paper);
  margin: 4px 6px 20px;
}
.notice-text { margin: 0; font: bold 19px/1.3 var(--chicago); text-align: center; text-wrap: balance; }
.closed { margin: 2px 0 0; font: 16px/1.4 var(--geneva); text-align: center; text-wrap: balance; }

/* --------------------------------------------------------------------------
   The form: name, who, and the bell
   -------------------------------------------------------------------------- */

.view { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.form-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field-label { font: bold 18px/1.2 var(--chicago); }
fieldset.field legend { padding: 0; margin-bottom: 2px; }
.who-row { display: flex; flex-wrap: wrap; gap: 4px 34px; }
.mac-checkbox input:disabled { cursor: default; background: var(--gray50); }
.mac-checkbox input:disabled + span { opacity: 0.55; }
.mac-checkbox .away { display: block; font: 14px/1.2 var(--geneva); }
.who-hint { text-align: left; margin-top: 2px; }
.delivery-row { margin-top: -4px; }
.delivery-row span { font-weight: bold; font-family: var(--chicago); font-size: 18px; }
.name-hint { margin: -4px 0 0; font: 16px/1.3 var(--geneva); text-wrap: balance; }
.micro { margin: 0; font: 16px/1.3 var(--geneva); text-align: center; }

/* The doorbell: a plate with a round button. Two rings around the button, like the
   default button's thick ring in System 7; pressing inverts it. */
.bell-plate {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  padding: 24px 40px 18px;
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
}
.bell-btn {
  position: relative;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: var(--px) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 8px var(--ink);
  transition: transform 80ms ease-out;
}
.bell-btn:active, .bell-btn.ringing { background: var(--ink); color: var(--paper); transform: translateY(2px); }
.bell-btn:focus-visible { outline-offset: 12px; }
.bell-btn[disabled] { cursor: default; }
.bell-btn svg { width: 74px; height: 74px; display: block; transform-origin: 50% 10%; }
.bell-btn.ringing svg { animation: swing 1.4s ease-in-out; }
@keyframes swing {
  0% { transform: rotate(0); }
  12% { transform: rotate(18deg); }
  30% { transform: rotate(-16deg); }
  48% { transform: rotate(12deg); }
  66% { transform: rotate(-8deg); }
  84% { transform: rotate(4deg); }
  100% { transform: rotate(0); }
}
.bell-label { font: bold 20px/1 var(--chicago); letter-spacing: 0.06em; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   Waiting: "X has been told", Wi-Fi, directions, replies
   -------------------------------------------------------------------------- */

.notified { margin: 4px 0 0; font: bold 24px/1.25 var(--chicago); text-align: center; max-width: 440px; text-wrap: balance; }
.notified.ok::before { content: "✓ "; }
.notified.bad::before { content: "✗ "; }
/* Two numbered steps: how to find us, then the Wi-Fi */
.steps { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 14px; }
.step-card {
  padding: 14px 18px 16px;
  border: var(--px) solid var(--ink);
  box-shadow: var(--px) var(--px) 0 var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-head { display: flex; align-items: center; gap: 12px; }
.step-num {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font: bold 20px/1 var(--chicago);
}
.step-title { margin: 0; font: bold 20px/1.2 var(--chicago); }
.step-body { margin: 0; font: 17px/1.45 var(--geneva); text-wrap: pretty; }
.step-body.joke { font-size: 19px; font-style: italic; }
.wifi { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: baseline; }
.wifi dt { font: bold 16px/1.3 var(--chicago); }
.wifi dd { margin: 0; font: 19px/1.3 var(--geneva); -webkit-user-select: text; user-select: text; word-break: break-all; }

.wifi-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 8px 0 2px; }
.wifi-actions .mac-btn { min-width: 0; padding: 10px 18px; font-size: 17px; }
.wifi-actions .mac-btn.default { outline-width: 4px; margin: 6px 6px 6px 0; }
.wifi-hint { margin: -2px 0 0; font: 15px/1.4 var(--geneva); }
.replies { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; }
.reply {
  padding: 12px 16px 14px;
  border: var(--px) solid var(--ink);
  outline: 6px solid var(--ink);
  outline-offset: 2px;
  margin: 8px 8px 4px;
  background: var(--paper);
}
.reply-from { margin: 0 0 4px; font: bold 16px/1.2 var(--chicago); }
.reply-text { margin: 0; font: 22px/1.3 var(--geneva); }
.waiting { margin: 2px 0 0; font: 16px/1.4 var(--geneva); text-align: center; max-width: 400px; text-wrap: balance; } /* no lonely last word */
.replies:empty + .waiting { margin-top: 0; }

/* Fallback when Slack could not be reached: call instead */
.phones { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 2px; }
.phones-label { margin: 0; font: bold 17px/1.2 var(--chicago); }
.phones .mac-btn { min-width: 0; padding: 10px 18px; font-size: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
