/*
 * The screen is the bell's indicator lamp (see DESIGN.md).
 * Paper = nothing happening. Signal yellow floods the screen while it rings. Green floods it when someone is coming.
 * One family (Schibsted Grotesk, variable), ink on paper, hairlines instead of boxes, pills for controls.
 */
@font-face {
  font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk-400_900-normal.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
}

:root {
  --paper: #f0efeb; --ink: #0e0e0c; --muted: #5c5c56; --line: #cfcec7; --wash: #e4e3dd;
  --ring: #ffd60a; --done: #35d07f; --alert: #b3261e;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0f0f0e; --ink: #f0efeb; --muted: #a3a39c; --line: #2e2e2a; --wash: #1c1c1a; --alert: #ff8a7a; }
}
/* On a flooded screen the lamp colour is the ground, in either scheme. */
body:is([data-state="ringing"], [data-state="done"]) { --paper: #f0efeb; --ink: #0e0e0c; --muted: #2f2f2a; --line: rgb(14 14 12 / 0.3); --wash: rgb(14 14 12 / 0.08); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); caret-color: var(--ink); accent-color: var(--ink);
  font: 400 1.0625rem/1.5 "Schibsted Grotesk", system-ui, sans-serif;
  min-height: 100dvh; padding: env(safe-area-inset-top) var(--gutter) calc(28px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased; transition: color 0.3s var(--ease);
}
::selection { background: var(--ink); color: var(--paper); }
[hidden] { display: none !important; }
main { max-width: 480px; margin: 0 auto; position: relative; }
main.wide { max-width: 860px; }

h1 { font-weight: 750; font-size: clamp(2.1rem, 9vw, 2.75rem); line-height: 1.02; letter-spacing: -0.035em; margin: 0 0 14px -0.04em; text-wrap: balance; }
h2 { font-weight: 700; font-size: 1.05rem; line-height: 1.2; letter-spacing: -0.01em; margin: 56px 0 0; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
p { margin: 0 0 12px; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; line-height: 1.4; }

:is(button, a, input, summary):focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }

/* ---------- The lamp ---------- */
.flood { position: fixed; inset: 0; z-index: -1; clip-path: circle(0 at var(--fx, 50%) var(--fy, 40%)); transition: clip-path 0.9s var(--ease); pointer-events: none; }
.flood.ring { background: var(--ring); }
.flood.done { background: var(--done); }
body[data-state="ringing"] .flood.ring, body[data-state="done"] :is(.flood.ring, .flood.done) { clip-path: circle(150vmax at var(--fx, 50%) var(--fy, 40%)); }
/* While it rings the lamp breathes. This is the page's idle motion. */
body[data-state="ringing"] .flood.ring { animation: lamp 1.8s ease-in-out 0.9s infinite; }
@keyframes lamp { 0%, 100% { background: #ffd60a; } 50% { background: #ffe873; } }

/* ---------- Top bar: where you are ---------- */
.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 18px 0 14px; border-bottom: 1.5px solid var(--ink); font-size: 0.9rem; line-height: 1.3; transition: border-color 0.3s var(--ease); }
.bar b { font-weight: 650; }
.bar span { color: var(--muted); text-align: right; }

/* ---------- Visitor: pick ---------- */
#pick h1 { margin-top: 44px; }
.linefield { display: block; margin: 30px 0 0; }
.linefield span { display: block; font-size: 0.84rem; color: var(--muted); }
.linefield input { font: inherit; font-weight: 500; width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); padding: 6px 0 10px; min-height: 44px; }
.linefield input:focus { outline: 0; border-bottom-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }

.index { list-style: none; margin: 34px 0 0; padding: 0; border-top: 1.5px solid var(--ink); }
.index li { border-bottom: 1px solid var(--line); }
.office {
  appearance: none; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter));
  display: flex; align-items: center; gap: 16px; padding: 20px var(--gutter); min-height: 82px; text-align: left; position: relative; isolation: isolate;
  transition: color 0.25s var(--ease);
}
.office::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform 0.4s var(--ease); }
.office > span { flex: 1; min-width: 0; font-weight: 700; font-size: clamp(1.6rem, 7.4vw, 2.1rem); line-height: 1.05; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.office svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.4s var(--ease); }
.office:active { color: var(--paper); }
.office:active::before { transform: scaleY(1); }
.office:active svg { transform: translateX(6px); }
@media (hover: hover) {
  .office:hover { color: var(--paper); }
  .office:hover::before { transform: scaleY(1); }
  .office:hover svg { transform: translateX(6px); }
}
.office:disabled { opacity: 0.5; }
#all { margin-top: 22px; }

/* ---------- Visitor and staff: the lit state ---------- */
.status { display: flex; flex-direction: column; min-height: calc(100dvh - 62px - env(safe-area-inset-top) - 28px - env(safe-area-inset-bottom)); }
.giant { font-weight: 800; font-size: clamp(3rem, 15.5vw, 4.6rem); line-height: 0.94; letter-spacing: -0.045em; margin: 9vh 0 22px -0.05em; overflow-wrap: anywhere; text-wrap: balance; }
.giant span { display: inline-block; }
/* A name with a very long word steps down a size instead of breaking mid-word. */
.giant.long { font-size: clamp(2.3rem, 11.4vw, 3.6rem); letter-spacing: -0.04em; }
.lede { font-size: 1.25rem; line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; max-width: 22ch; color: var(--ink); }
.clock { margin-top: 26px; font-size: 0.9rem; font-weight: 600; letter-spacing: 0.02em; }
.actions { margin-top: auto; padding-top: 32px; display: grid; gap: 10px; }
.aside { margin: 18px 0 0; text-align: center; }

/* ---------- Controls ---------- */
button, .btn {
  appearance: none; font: 650 1.0625rem/1.2 "Schibsted Grotesk", system-ui, sans-serif; letter-spacing: -0.01em; cursor: pointer; border-radius: 999px; border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink); padding: 13px 22px; min-height: 54px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.2s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
}
button:active, .btn:active { transform: scale(0.97); }
button.primary, .btn.primary { background: var(--ink); color: var(--paper); }
@media (hover: hover) {
  button:not(.text, .office):hover, .btn:hover { background: var(--ink); color: var(--paper); }
  :is(button, .btn).primary:hover { background: transparent; color: var(--ink); }
}
button.block, .btn.block { width: 100%; }
button.text { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1px; padding-inline: 8px; }
button.small { min-height: 42px; padding: 8px 16px; font-size: 0.93rem; }
button.danger { color: var(--alert); }
button:disabled { opacity: 0.5; cursor: default; }

input:is([type="text"], [type="email"], [type="tel"], [type="password"], [type="number"]):not(.linefield input) {
  font: inherit; width: 100%; padding: 12px 16px; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: transparent; color: var(--ink);
}
input:not(.linefield input):focus { border-color: var(--ink); }
input::placeholder { color: var(--muted); opacity: 1; }
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 6px; }

.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* Working surfaces are ruled, not boxed. */
.panel { padding: 0; }
.panel.pad { padding: 20px 0 0; }
.notice { background: var(--wash); border-radius: 14px; padding: 14px 18px; font-size: 0.97rem; }
.notice.alert { color: var(--alert); }
.notice strong { display: block; }

.toggle { display: flex; align-items: center; gap: 16px; padding: 16px 0; cursor: pointer; border-bottom: 1px solid var(--line); }
.toggle input { appearance: none; width: 52px; height: 30px; border-radius: 15px; background: transparent; border: 1.5px solid var(--ink); position: relative; flex: none; cursor: pointer; margin: 0; transition: background 0.3s var(--ease); }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--ink); transition: transform 0.3s var(--ease), background 0.3s var(--ease); }
.toggle input:checked { background: var(--ink); }
.toggle input:checked::after { transform: translateX(22px); background: var(--paper); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.chip { display: inline-flex; align-items: center; padding: 8px 16px; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 500; font-size: 0.97rem; cursor: pointer; user-select: none; position: relative; transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease); }
.chip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip:has(input:focus-visible) { outline: 2.5px solid var(--ink); outline-offset: 3px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.list .grow { min-width: 170px; }
.list .empty { color: var(--muted); }
.list .chips { padding-top: 0; }
.tag { font-size: 0.8rem; font-weight: 600; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.tag.alert { color: var(--alert); border-color: currentColor; }

.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); width: 100%; }
.fields input:first-child { font-weight: 650; }
.addrow { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 0; }
.addrow input { flex: 1 1 190px; width: auto !important; }

.home h1 { margin-top: 44px; }

/* ---------- Landing page: the page is its own demo of the lamp ---------- */
main.landing { max-width: 1040px; }
.hero { display: grid; gap: 44px; padding: 52px 0 76px; }
.hero h1 { font-weight: 800; font-size: clamp(2.9rem, 13.5vw, 5.6rem); line-height: 0.94; letter-spacing: -0.045em; margin: 0 0 24px -0.05em; }
.hero .lede { max-width: 31ch; }
.try { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0; font-size: 0.9rem; font-weight: 600; }
.try span { padding-bottom: 12px; }
/* Pling, the mascot: a bell on two feet. Stands on the top rule of the list and rings when the lamp is lit. */
.pling { width: 78px; height: 75px; flex: none; color: var(--ink); --skin: var(--ring); display: block; transform-origin: 50% 12%; }
.pling.big { width: 132px; height: 128px; }
.skin { fill: var(--skin, #ffd60a); }
.waves { opacity: var(--waves, 0); }
body[data-state="ringing"] .pling { --skin: #f0efeb; --waves: 1; animation: jingle 0.42s ease-in-out infinite alternate; }
@keyframes jingle { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.demo .index { margin-top: 0; }
.landing .status { min-height: calc(100dvh - 62px - env(safe-area-inset-top)); padding-bottom: 28px; }
.landing .status .lede { max-width: 26ch; }
.landing .status .actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.landing .status .actions button { min-width: 150px; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.2rem 1fr; gap: 6px 12px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(step); font-weight: 600; font-size: 0.9rem; color: var(--muted); padding-top: 0.5em; }
.steps h3 { margin: 0; font-weight: 700; font-size: clamp(1.45rem, 6vw, 1.9rem); line-height: 1.08; letter-spacing: -0.03em; }
.steps p { grid-column: 2; margin: 0; color: var(--muted); max-width: 44ch; }

.join { padding: 96px 0 72px; }
h2.big { border: 0; padding: 0; margin: 0 0 18px -0.04em; font-weight: 800; font-size: clamp(2.5rem, 11vw, 4.4rem); line-height: 0.96; letter-spacing: -0.045em; text-wrap: balance; }
.join .lede { max-width: 30ch; }
.join form { display: grid; gap: 4px 28px; margin-top: 12px; max-width: 760px; }
.join form button { margin-top: 26px; justify-self: start; min-width: 150px; }
.join .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#formMsg { margin: 14px 0 0; color: var(--alert); min-height: 1.4em; }
.foot { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0 8px; border-top: 1.5px solid var(--ink); font-size: 0.9rem; color: var(--muted); }

@media (min-width: 860px) {
  .hero { grid-template-columns: 7fr 5fr; gap: 72px; align-items: end; padding: 104px 0 120px; }
  .demo .office { width: 100%; margin: 0; padding-inline: 14px; }
  .steps li { grid-template-columns: 3rem 5fr 6fr; align-items: baseline; padding: 28px 0; }
  .steps p { grid-column: 3; }
  .join { padding: 140px 0 96px; }
  .join form { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .join form button { margin-top: 0; }
}

/* ---------- Reading pages: terms and privacy ---------- */
main.prose { max-width: 680px; }
.bar a { text-decoration: none; }
.prose article { padding: 52px 0 88px; }
.prose h1 { font-weight: 800; font-size: clamp(2.6rem, 11vw, 3.8rem); letter-spacing: -0.045em; margin-bottom: 12px; }
.prose h2 { margin: 52px 0 16px; }
.prose p, .prose li { max-width: 62ch; }
.prose ul { margin: 0 0 12px; padding-left: 1.15em; }
.prose li { margin-bottom: 8px; }
.foot a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.25s; }
::view-transition-group(office) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }

/* ---------- Printable door sign (A4) ---------- */
.poster { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff; padding: 0; min-height: 0; }
  body > *:not(.poster) { display: none !important; }
  .poster { display: flex; flex-direction: column; height: 297mm; color: #0e0e0c; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .poster .top { flex: 1; padding: 20mm 18mm 0; display: flex; flex-direction: column; }
  .poster h1 { font-weight: 850; font-size: 118pt; line-height: 0.88; letter-spacing: -0.05em; margin: 0 0 9mm -1.5mm; }
  .poster p { font-size: 19pt; line-height: 1.3; font-weight: 500; margin: 0; max-width: 125mm; }
  .poster .en { font-weight: 400; color: #5c5c56; margin-top: 3mm; }
  .poster img { width: 96mm; height: 96mm; margin: auto 0 14mm -5mm; }
  .poster .foot { background: #ffd60a; padding: 11mm 18mm 13mm; display: flex; justify-content: space-between; align-items: baseline; gap: 10mm; font-size: 15pt; }
  .poster .foot b { font-weight: 800; font-size: 30pt; letter-spacing: -0.03em; line-height: 1; }
}
