/* Neare setup guide
   One screen, one action. Type and targets sized for older eyes and hands. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("../fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Brand colours, from getneare.com */
  --petrol: #20404a;     /* the brand anchor: buttons, numbers, rules */
  --deep: #17323a;       /* deepest: kept for the serious messages */
  --porcelain: #fafaf7;  /* page ground */
  --mist: #dce6e7;       /* picture panels and quiet notes */
  --copper: #b4652f;     /* accent: where you are, what to notice */
  --paper: var(--porcelain);
  --panel: var(--mist);
  --brand: var(--petrol);
  --accent: var(--copper);
  --ink: #1b2a2e;        /* text */
  --ink-soft: #46565a;
  --line: #a3b3b6;
  --go: var(--petrol);
  --stop: #a8201a;
  --sticker: #f5f0e6;    /* the cream of the bag stickers */
  --focus: var(--copper);
  --room: var(--brand);
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
  --sticker-font: "Playfair Display", Georgia, "Times New Roman", serif;
  --gutter: 18px;
  --badge-room: 66px;   /* set to 12px if the host badge is ever removed */
  --column: 640px;
}

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

html {
  font-size: 125%;               /* 20px body before the reader's own settings */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html[data-size="1"] { font-size: 145%; }
html[data-size="2"] { font-size: 165%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}
#screen:focus { outline: none; }

/* ---------- Top bar ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 10px var(--gutter) 6px;
}
.brand {
  font-family: var(--sticker-font);
  font-size: 1.25rem;
  font-weight: 500;
}
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool {
  min-height: 44px;
  padding: 4px 12px;
  border: 2px solid var(--brand);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.tool[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* ---------- Progress ---------- */

.progress {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 6px var(--gutter) 10px;
}
.progress ol {
  display: flex;
  align-items: center;
  gap: 0;
}
.progress li {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
}
.progress li:last-child { flex: 0 0 auto; }
.progress li::after {
  content: "";
  flex: 1 1 auto;
  height: 3px;
  margin: 0 4px;
  background: var(--line);
}
.progress li:last-child::after { display: none; }
.progress li.is-done::after { background: var(--brand); }
.dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1;
}
.is-done .dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.is-now .dot {
  width: 38px;
  height: 38px;
  border: 3px solid var(--accent);
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}
#progress-text {
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* ---------- Screen ---------- */

#screen {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 10px var(--gutter) 28px;
}
#screen > * + * { margin-top: 18px; }

h1 {
  font-size: 1.7rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.25;
  font-weight: 800;
}
p, li { max-width: 34em; }
strong { font-weight: 800; }

.title { display: flex; align-items: flex-start; gap: 12px; }
.num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-top: -0.05rem;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.soft { color: var(--ink-soft); }

/* Picture panels: same cool grey as the printed guide */
.art {
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
}
.art svg { width: 100%; height: auto; }
.art svg text { font-family: var(--font); font-weight: 700; font-size: 15px; fill: var(--ink); }
.art svg text.on-dark { fill: #fff; }
.art svg text.small { font-size: 13px; font-weight: 600; }
.photo img { width: 100%; height: auto; border-radius: 14px; }
figcaption { margin-top: 8px; font-size: 0.9rem; color: var(--ink-soft); }

/* Words and a picture that belong together */
.pair { display: flex; flex-direction: column; gap: 18px; }
.pair.pic-first > .art, .pair.pic-first > .photo { order: -1; }
.words > * + * { margin-top: 18px; }
[hidden] { display: none !important; }

/* Numbered actions inside a step */
.do { counter-reset: do; display: grid; gap: 14px; }
.do > li {
  counter-increment: do;
  position: relative;
  padding-left: 2.5rem;
  min-height: 1.9rem;
}
.do > li::before {
  content: counter(do);
  position: absolute;
  left: 0;
  top: -0.05rem;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 2px solid var(--brand);
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

.plain { display: grid; gap: 10px; }
.plain > li { position: relative; padding-left: 1.3rem; }
.plain > li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.58em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--brand);
}

/* Things that must not be missed */
.keep, .emergency {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--deep);
  color: #fff;
  font-weight: 700;
}
.warn {
  padding: 14px 18px;
  border-radius: 14px;
  background: #fbeceb;
}
.note {
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--panel);
}

.address {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  user-select: all;
  -webkit-user-select: all;
}

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.3rem;
  padding: 10px 18px;
  border: 3px solid var(--brand);
  border-radius: 16px;
  background: var(--paper);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-next { background: var(--brand); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-quiet { border-width: 2px; font-size: 1rem; font-weight: 700; }

.choices { display: grid; gap: 12px; }
.choices .btn { justify-content: flex-start; text-align: left; }

/* Choices all look the same, so none reads as already picked.
   The one under the pointer or finger fills in. */
.choices .btn:active { background: var(--brand); color: #fff; }
@media (hover: hover) {
  .choices .btn:hover { background: var(--brand); color: #fff; }
  .btn-back:hover, .btn-quiet:hover, .tool:hover, .jump button:hover { background: var(--mist); }
  .btn-next:hover { background: var(--deep); border-color: var(--deep); }
  .check:hover { background: var(--mist); }
}

/* ---------- Bottom bar ---------- */

.nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  /* The strip under the buttons is left empty for the host's badge, which
     is pinned to the bottom-right corner. Without it the badge covers Next. */
  padding: 12px var(--gutter) calc(var(--badge-room) + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 2px solid var(--brand);
}
.nav .btn-back { flex: 0 0 34%; }
.nav .btn-next { flex: 1 1 auto; }
.nav [hidden] { display: none; }

/* ---------- Welcome ---------- */

.greeting {
  margin: -10px calc(var(--gutter) * -1) 0;
  padding: 30px var(--gutter) 32px;
  background: var(--brand);
  color: #fff;
}
.greeting h1 {
  font-family: var(--sticker-font);
  font-weight: 500;
  font-size: 3.2rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.greeting p { margin-top: 16px; font-size: 1.2rem; line-height: 1.4; max-width: 24em; }
.ready { padding: 18px; border-radius: 14px; background: var(--panel); }
.ready > p { margin-bottom: 12px; font-weight: 700; }
.ready .sticker { max-width: 17rem; }
.sticker {
  display: flex;
  align-items: center;
  min-height: 4.4rem;
  padding: 10px 20px;
  border-radius: 4px;
  background: var(--sticker);
  box-shadow: 0 1px 0 rgba(23, 50, 58, 0.25), 0 6px 14px rgba(23, 50, 58, 0.12);
}
.sticker-name {
  font-family: var(--sticker-font);
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--ink);
}

/* ---------- Kit checklist ---------- */

.checks { display: grid; gap: 12px; }
.check {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 2px 14px;
  align-items: start;
  width: 100%;
  padding: 14px 16px;
  border: 3px solid var(--brand);
  border-radius: 16px;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.check .box {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 3px solid var(--brand);
  border-radius: 10px;
  background: var(--paper);
}
.check .box svg { width: 70%; height: 70%; opacity: 0; }
.check b { font-size: 1.1rem; font-weight: 800; line-height: 1.3; }
.check span.what { color: var(--ink-soft); }
.check[aria-pressed="true"] { border-color: var(--go); background: var(--mist); }
.check[aria-pressed="true"] .box { border-color: var(--go); background: var(--go); }
.check[aria-pressed="true"] .box svg { opacity: 1; }

/* ---------- Timer ---------- */

.timer {
  padding: 18px;
  border-radius: 14px;
  background: var(--panel);
  text-align: center;
}
.timer-clock {
  font-size: 4.2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.timer-say { margin: 8px auto 14px; font-weight: 700; }
.timer.is-done { background: #fff; box-shadow: inset 0 0 0 3px var(--brand); }
.timer.is-done .timer-clock { color: var(--go); }

/* ---------- Sensor bags ---------- */

.bag {
  margin: -10px calc(var(--gutter) * -1) 0;
  padding: 16px var(--gutter) 20px;
  background: var(--room);
  color: #fff;
}
.bag p { font-weight: 700; margin-bottom: 10px; }
.bag .sticker { max-width: 19rem; }

.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick .btn { min-height: 3rem; font-size: 1rem; padding: 8px 10px; }
.pick .btn[aria-pressed="true"] { background: var(--brand); color: #fff; }

/* ---------- Not an alarm / finish ---------- */

.does { display: grid; gap: 18px; }
.does > div { padding-top: 14px; border-top: 3px solid var(--brand); }
.does h2 { margin-bottom: 8px; }
.emergency { font-size: 1.2rem; line-height: 1.3; font-weight: 800; }
.email { font-weight: 800; font-size: 1.1rem; word-break: break-word; }

/* ---------- Help ---------- */

dialog {
  width: min(100% - 24px, 560px);
  max-height: calc(100dvh - 24px);
  padding: 22px 20px;
  border: 3px solid var(--brand);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}
dialog::backdrop { background: rgba(23, 50, 58, 0.6); }
dialog > * + * { margin-top: 16px; }
dialog h2 { font-size: 1.6rem; }
dialog h3 { font-size: 1.1rem; font-weight: 800; }
.jump { display: grid; gap: 8px; }
.jump button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 3rem;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.jump .num { width: 1.8rem; height: 1.8rem; font-size: 1rem; margin: 0; }

@media (min-width: 700px) {
  :root { --gutter: 28px; }
  body { background: var(--panel); }
  .top, .progress, #screen, .nav { background: var(--paper); }
  h1 { font-size: 2rem; }
}

/* Tablets on their side and computers: picture beside the words.
   Pictures float right; everything else keeps to the left column. */
@media (min-width: 900px) {
  :root { --column: 1080px; --gutter: 44px; }
  #screen { display: flow-root; padding-top: 18px; padding-bottom: 40px; }
  #screen > * { max-width: 640px; }
  #screen.has-art > * { max-width: 52%; }
  #screen > .title, #screen > .bag,
  #screen.has-art > .title, #screen.has-art > .bag { max-width: none; }
  #screen.has-art > .art {
    float: right;
    width: 42%;
    max-width: 42%;
  }
  #screen > [data-fridge-view] { max-width: none; }
  #screen .pair {
    display: grid;
    grid-template-columns: 52% 42%;
    justify-content: space-between;
    align-items: start;
    max-width: none;
  }
  #screen .pair > .words { grid-column: 1; grid-row: 1; }
  #screen .pair > .art, #screen .pair > .photo { grid-column: 2; grid-row: 1; order: 0; }
  #screen > .checks, #screen > .does {
    max-width: none;
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
  }
  .bag, .greeting { margin-top: -18px; }
  #screen > .greeting { max-width: none; padding-top: 48px; padding-bottom: 48px; }
  .greeting h1 { font-size: 4rem; }
  /* Back at the far left, Next at the far right: going forward is always
     the same big button in the same corner, under the picture. */
  .nav { justify-content: space-between; padding-top: 16px; }
  .nav .btn-back { flex: 0 0 220px; }
  .nav .btn-next { flex: 0 0 42%; margin-left: auto; }
  /* A lone main button (the first page) sits in the middle. */
  .nav .btn-back[hidden] + .btn-next { margin-right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:active { transform: none; }
}

@media print {
  .top, .nav, .progress { display: none; }
}
