/* The door keypad, about 1994.

   Not a screen. That is the point of this one in a set that is mostly screens:
   it is an object bolted to a wall, so the page is built around a painted
   breeze block wall with a metal unit on it and a shadow underneath.

   The worn keys are the whole idea and they are drawn rather than described: a
   lighter face, a softer edge, and a faint smudge where a finger has landed a
   few thousand times. If a visitor can see which four they are before reading a
   word, the page has already made its argument. */

:root {
  --kp-wall:   #8d8f88;
  --kp-metal:  #b9bcc0;
  --kp-metal2: #93979c;
  --kp-key:    #3e4247;
  --kp-key-worn: #7d8288;
  --kp-ink:    #23262a;
  --kp-paper:  #f7f6f3;
  --kp-green:  #4ad46a;
  --kp-red:    #e8493a;
  --kp-dim:    #6a6f76;
  --kp-orange: #E87722;
}

body {
  background: var(--kp-paper);
  color: var(--kp-ink);
  font: 16px/1.65 "Helvetica Neue", Helvetica, Arial, sans-serif;
  padding: 0 0 46px;
}

.kp { max-width: 780px; margin: 0 auto; padding: 0 26px; }

a { color: #1c5fa8; }

/* ── The wall ──────────────────────────────────────────────────────────── */

.kp-wall {
  margin: 0 -26px 30px;
  padding: 46px 26px 52px;
  background-color: var(--kp-wall);
  /* Painted block: courses of mortar lines, offset on alternate rows. */
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.10) 1px, transparent 1px);
  background-size: 100% 46px, 92px 46px;
  display: flex; justify-content: center;
}

/* ── The unit ──────────────────────────────────────────────────────────── */

.kp-unit {
  width: 246px;
  background: linear-gradient(160deg, #cfd2d5 0%, var(--kp-metal) 38%, var(--kp-metal2) 100%);
  border-radius: 7px;
  padding: 14px 14px 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    inset 0 -2px 6px rgba(0,0,0,.22),
    0 10px 22px rgba(0,0,0,.4);
}

.kp-brand {
  margin: 0 0 10px;
  font: 700 9px/1 Arial, sans-serif;
  letter-spacing: .26em; text-transform: uppercase;
  color: #5b6067;
  text-align: center;
}

.kp-readout {
  display: flex; align-items: center; gap: 9px;
  background: #14171a;
  border-radius: 3px;
  padding: 9px 11px;
  margin-bottom: 13px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.7);
  min-height: 42px;
}
.kp-lamp {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: #3a3f45;
}
.kp-lamp.is-ok   { background: var(--kp-green); box-shadow: 0 0 8px var(--kp-green); }
.kp-lamp.is-bad  { background: var(--kp-red);   box-shadow: 0 0 8px var(--kp-red); }
.kp-display {
  color: #c8ccd2;
  font: 13px/1.35 ui-monospace, Consolas, "Courier New", monospace;
  letter-spacing: .08em;
}

.kp-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }

.kp-key {
  aspect-ratio: 1 / .78;
  border: 0; border-radius: 4px;
  background: linear-gradient(#4a4f55, var(--kp-key));
  color: #e6e9ec;
  font: 700 17px/1 Arial, sans-serif;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 0 #24272b;
}
.kp-key:hover { background: linear-gradient(#565c63, #464a50); }
.kp-key:active { transform: translateY(2px); box-shadow: inset 0 1px 4px rgba(0,0,0,.5); }
.kp-key:focus-visible { outline: 2px solid var(--kp-orange); outline-offset: 2px; }

/* Worn: a lighter, flatter, slightly polished face with a smudge on it. The
   four keys somebody has pressed several thousand times. */
.kp-key.is-worn {
  background:
    radial-gradient(ellipse at 50% 62%, rgba(255,255,255,.42) 0 42%, transparent 62%),
    linear-gradient(#9aa0a7, var(--kp-key-worn));
  color: #f2f4f6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 0 #5e6369;
}
.kp-key.is-worn:hover { background: linear-gradient(#a7adb4, #868b91); }

.kp-hint {
  margin: 12px 0 0;
  font: 11px/1.45 Arial, sans-serif;
  color: #4e535a;
  text-align: center;
}

/* ── The page ──────────────────────────────────────────────────────────── */

.kp h1 { font-size: clamp(24px, 4.2vw, 34px); line-height: 1.2; margin: 0 0 12px; }
.kp h2 { font-size: 20px; margin: 34px 0 8px; color: #7a3f10; }
.kp h3 { font-size: 15px; margin: 18px 0 2px; }
.kp p  { margin: 8px 0; max-width: 70ch; }
.kp-lead { font-size: 18px; color: #3a3f45; }
.kp-note { color: var(--kp-dim); font-size: 14px; }
.kp-list { margin: 8px 0; padding: 0 0 0 24px; max-width: 70ch; }
.kp-list li { margin-bottom: 9px; }

/* The arithmetic, set as three big numbers with the reasoning beside them. */
.kp-math { margin: 14px 0 0; }
.kp-math-row {
  display: flex; gap: 20px; align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid #e2e0da;
}
.kp-math dt {
  flex: 0 0 96px;
  font: 700 clamp(24px, 4vw, 32px)/1 "Helvetica Neue", Arial, sans-serif;
  color: var(--kp-ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.kp-math dd { margin: 0; flex: 1 1 auto; color: #45494f; }

@media (max-width: 520px) {
  .kp { padding: 0 16px; }
  .kp-wall { margin: 0 -16px 22px; padding: 30px 16px 34px; }
  .kp-math-row { flex-direction: column; gap: 4px; }
  .kp-math dt { text-align: left; flex: 0 0 auto; }
}

/* ── The form ──────────────────────────────────────────────────────────── */

.kp-box {
  background: #fff;
  border: 1px solid #ddd9d0;
  border-radius: 4px;
  padding: 18px 22px 22px;
  margin: 32px 0 0;
  max-width: 560px;
}
.kp-box h2 { margin-top: 0; }

.kp-field { margin: 0 0 12px; }
.kp-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.kp-field input, .kp-field textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #b6b2a8; border-radius: 2px; background: #fff;
  font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.kp-field input:focus, .kp-field textarea:focus { outline: 2px solid var(--kp-orange); outline-offset: 1px; }
.kp-field.is-bad input, .kp-field.is-bad textarea { border-color: var(--kp-red); background: #fff7f6; }

.rt-field-err { color: #a8291c; font-size: 13px; font-weight: 700; margin: 4px 0 0; }
.rt-err { border: 1px solid var(--kp-red); background: #fff7f6; color: #7d1c12; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }

.kp-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 16px 0 0; }
.kp-actions button {
  background: var(--kp-ink); color: #fff; border: 0;
  padding: 11px 30px; border-radius: 3px;
  font: 700 15px/1.2 "Helvetica Neue", Arial, sans-serif; cursor: pointer;
}
.kp-actions button:hover, .kp-actions button:focus { background: var(--kp-orange); }
