/* CSPMPJ. Six keycaps in a plum case, typed once. */

@font-face { font-family: "Sora"; src: url("fonts/sora-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --ground: #E6E4EE;
  --ground-2: #DAD7E5;
  --case: #3B2F4A;
  --case-hi: #4D3F60;
  --cap: #FBFBFD;
  --cap-side: #CFCCDA;
  --cap-shadow: #A9A4BA;
  --legend: #23212B;
  --ink: #23212B;
  --muted: #555066;
  --line: rgba(35, 33, 43, 0.16);
  --on-case: #F4F1FA;
  --on-case-muted: #CFC5E0;
  --error: #9C1F2E;
  --error-light: #FFC9CF;

  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.025em; text-wrap: balance; }
a { color: inherit; }

.wrap { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: clamp(20px, 5vw, 48px); }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; top: 12px; left: 12px; z-index: 10; padding: 10px 14px; background: var(--case); color: var(--on-case); border-radius: 8px; transform: translateY(-160%); }
.skip:focus { transform: none; }
:focus-visible { outline: 3px solid var(--case); outline-offset: 3px; }

/* ---------- bar ---------- */
.bar-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.375rem; line-height: 1; letter-spacing: 0.08em; text-decoration: none; }
.bar-go { font-size: 1.0625rem; font-weight: 600; text-underline-offset: 4px; text-decoration-thickness: 2px; }

/* ---------- hero ---------- */
.hero { padding-bottom: clamp(64px, 10vh, 112px); }
.hero-in { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: clamp(16px, 5vh, 56px); }

/* the case and the keys */
.board {
  width: min(100%, 760px);
  padding: clamp(12px, 2.4vw, 22px);
  border-radius: clamp(14px, 2.4vw, 22px);
  background: linear-gradient(180deg, var(--case-hi), var(--case));
  box-shadow: 0 28px 44px -24px rgba(35, 25, 50, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  container-type: inline-size;
}
.keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2.2cqw; }
.key {
  display: block;
  aspect-ratio: 1;
  border-radius: 2.4cqw;
  background: var(--cap-side);
  box-shadow: 0 1.4cqw 0 var(--cap-shadow), 0 1.8cqw 2.4cqw rgba(20, 12, 30, 0.45);
}
.cap {
  display: grid;
  place-items: center;
  height: 100%;
  margin: 0 1.1cqw;
  border-radius: 2cqw;
  transform: translateY(-0.9cqw);
  background: linear-gradient(180deg, #FFFFFF, var(--cap) 60%, #EFEEF4);
  box-shadow: inset 0 -0.5cqw 0 rgba(0, 0, 0, 0.06);
  font-family: var(--display);
  font-weight: 600;
  font-size: 7.4cqw;
  line-height: 1;
  color: var(--legend);
}

/* One motion: the name is typed once, key by key. */
.js .key { animation: press 0.26s ease-in-out both; }
.js .key:nth-child(1) { animation-delay: 0.35s; }
.js .key:nth-child(2) { animation-delay: 0.53s; }
.js .key:nth-child(3) { animation-delay: 0.71s; }
.js .key:nth-child(4) { animation-delay: 0.89s; }
.js .key:nth-child(5) { animation-delay: 1.07s; }
.js .key:nth-child(6) { animation-delay: 1.25s; }
@keyframes press {
  0%, 100% { transform: none; box-shadow: 0 1.4cqw 0 var(--cap-shadow), 0 1.8cqw 2.4cqw rgba(20, 12, 30, 0.45); }
  45% { transform: translateY(1.1cqw); box-shadow: 0 0.3cqw 0 var(--cap-shadow), 0 0.6cqw 1cqw rgba(20, 12, 30, 0.4); }
}

.hero h1 {
  margin-top: clamp(40px, 7vh, 64px);
  font-size: clamp(2.25rem, 1.3rem + 3vw, 3.75rem);
  line-height: 1.04;
  max-width: 14em;
}
.hero .lede { margin-top: 18px; max-width: 30rem; font-size: 1.3125rem; line-height: 1.5; color: var(--muted); }
.hero .join { margin-top: 30px; width: min(100%, 32rem); }
.hero .done-line { justify-content: center; }

/* ---------- form ---------- */
.row { display: flex; gap: 8px; }
.field {
  flex: 1 1 auto; min-width: 0; height: 56px; padding: 0 16px;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
  background: #FFFFFF; border: 2px solid #A49FB4; border-radius: 10px;
}
.field::placeholder { color: #6A6578; }
.field:focus-visible { border-color: var(--case); outline-offset: 2px; }
.field[aria-invalid="true"] { border-color: var(--error); }
.btn {
  flex: none; height: 56px; padding: 0 24px;
  font-family: var(--display); font-size: 1rem; font-weight: 600;
  color: var(--on-case); background: var(--case); border: 0; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 0 #261D31;
}
.btn:hover { background: var(--case-hi); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #261D31; }
.btn:disabled { cursor: progress; opacity: 0.8; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.fine { margin-top: 14px; font-size: 0.9375rem; color: var(--muted); }
.oops { margin-top: 10px; font-size: 0.9375rem; font-weight: 600; color: var(--error); }
.oops:empty { display: none; }
.nojs { display: none; margin-top: 8px; font-size: 0.9375rem; font-weight: 600; color: var(--error); }
html:not(.js) .nojs { display: block; }
.done-line { display: flex; align-items: center; gap: 10px; font-size: 1.1875rem; }
.done-line b { font-weight: 600; }
.tick { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--case); stroke-width: 1.8; }
.tick path { stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.again { padding: 0; font: inherit; color: inherit; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.when-joined { display: none; }
.is-joined .when-open { display: none; }
.is-joined .when-joined { display: inline; }

/* ---------- facts and questions ---------- */
.band { padding-block: clamp(72px, 11vw, 136px); }
#facts { background: var(--ground-2); }
.band h2 { font-size: clamp(1.875rem, 1.3rem + 1.6vw, 2.5rem); line-height: 1.1; }
.cols { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 40rem); justify-content: space-between; gap: 40px; }

.facts { border-top: 2px solid var(--case); }
.fact { display: grid; grid-template-columns: 8.5rem 1fr; gap: 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.fact dt { color: var(--muted); }
.fact dd { font-weight: 600; }

.qs { border-top: 2px solid var(--case); }
.q { border-bottom: 1px solid var(--line); }
.q summary { position: relative; padding: 20px 44px 20px 0; font-weight: 600; cursor: pointer; list-style: none; }
.q summary::-webkit-details-marker { display: none; }
.q summary::before, .q summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 16px; height: 2px; background: var(--ink); transition: transform 0.2s ease; }
.q summary::after { transform: rotate(90deg); }
.q[open] summary::after { transform: rotate(0deg); }
.q p { padding-bottom: 22px; max-width: 36rem; color: var(--muted); }

/* ---------- close: the case colour ---------- */
.close { padding-block: clamp(80px, 12vw, 144px); background: var(--case); color: var(--on-case); }
.close h2 { color: var(--on-case); font-size: clamp(1.875rem, 1.3rem + 1.6vw, 2.5rem); line-height: 1.1; max-width: 18em; }
.close .lede { margin-top: 14px; color: var(--on-case-muted); }
.close .join { margin-top: 32px; max-width: 32rem; }
.close .field { color: var(--on-case); background: #2E2439; border-color: #7A6C90; }
.close .field::placeholder { color: #BDB2CF; }
.close .field:focus-visible { border-color: var(--on-case); }
.close .btn { color: var(--case); background: var(--cap); box-shadow: 0 4px 0 var(--cap-shadow); }
.close .btn:hover { background: #FFFFFF; }
.close .fine { color: var(--on-case-muted); }
.close .oops, .close .nojs { color: var(--error-light); }
.close .tick { stroke: var(--on-case); }
.close :focus-visible { outline-color: var(--on-case); }

.foot { background: var(--case); color: var(--on-case-muted); font-size: 0.9375rem; }
.foot-in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 32px; padding-block: 26px 34px; border-top: 1px solid rgba(244, 241, 250, 0.14); }
.foot .brand-name { font-family: var(--display); font-weight: 700; letter-spacing: 0.08em; color: var(--on-case); }
.foot a { text-underline-offset: 3px; }
.foot :focus-visible { outline-color: var(--on-case); }

/* ---------- smaller screens ---------- */
@media (max-width: 860px) {
  .cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 460px) {
  .row { flex-direction: column; }
  .btn { width: 100%; }
  .hero h1 { font-size: 2.25rem; }
  .hero .lede { font-size: 1.1875rem; }
  .fact { grid-template-columns: 6.5rem 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .key { animation: none; }
  .q summary::before, .q summary::after { transition: none; }
  .btn:active { transform: none; }
}
