/* ChorePlay's website: the invite page, the start page, privacy, terms and help. Mobile first, no
   external resources.
   Colours: this :root block (and its dark twin right below) is the only place colours live.
   Brand colours come from package 31; swap the values here and nothing else. */

:root {
  color-scheme: light dark;

  --bg: #f1eeea;          /* warm light grey page */
  --surface: #fffdfb;     /* cards */
  --surface-2: #e5dfd8;   /* soft buttons, switcher, callouts */
  --chip-active: #fffdfb; /* selected language */
  --ink: #26211e;         /* text */
  --ink-muted: #5d544d;   /* secondary text (AA on bg, surface and surface-2) */
  --line: #d6cec6;        /* hairlines (decorative) */
  --control-line: #7f746b; /* outline of secondary buttons (3:1 non-text contrast) */
  --tile: #fffdfb;        /* code tiles ("fridge magnets") */
  --tile-edge: #cbc1b7;   /* the tile's thickness */
  --primary: #2f2926;     /* primary button */
  --on-primary: #fffdfb;
  --accent: #f3c65b;      /* honey: step numbers and the "copied" state */
  --on-accent: #26211e;
  --focus: #26211e;

  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: 16px;
  --radius-card: 28px;
  --radius-control: 18px;
  --radius-tile: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #27231f;
    --surface-2: #35302b;
    --chip-active: #4d4640;
    --ink: #f4efe9;
    --ink-muted: #bfb5ab;
    --line: #3d3731;
    --control-line: #8f847a;
    --tile: #302b27;
    --tile-edge: #0f0d0c;
    --primary: #f4efe9;
    --on-primary: #1c1917;
    --accent: #e8b84a;
    --on-accent: #1c1917;
    --focus: #f4efe9;
  }
}

/* Base */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: calc(34rem + 2 * var(--gutter));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.js-pending body > * {
  opacity: 0;
}

main {
  flex: 1;
}

h1,
h2,
p,
ol {
  margin: 0;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

.offscreen {
  position: fixed;
  top: -100vh;
  left: 0;
  opacity: 0;
}

/* Header: wordmark and language switcher */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: max(1rem, env(safe-area-inset-top)) 0 0;
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: 8px;
}

.langs ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  list-style: none;
  background: var(--surface-2);
  border-radius: 999px;
}

.langs a {
  display: grid;
  place-items: center;
  min-width: 2.625rem;
  min-height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.langs a:hover {
  color: var(--ink);
}

.langs a[aria-current="true"] {
  background: var(--chip-active);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}

/* Headline */

h1 {
  margin: 2rem 0 0.75rem;
  font-size: clamp(2rem, 8.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  font-size: 1.125rem;
}

p,
li {
  text-wrap: pretty;
}

main > p + p {
  margin-top: 1rem;
}

/* The code: six chunky tiles, like letter magnets on the fridge */

.code-card {
  margin-top: 1.75rem;
  padding: 1.25rem 1.25rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.code-label {
  margin-bottom: 0.875rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  font-weight: 700;
}

.code {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 3.5rem));
  justify-content: center;
  gap: clamp(0.3rem, 1.6vw, 0.6rem);
  -webkit-user-select: all;
  user-select: all;
}

.tile {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  box-shadow: 0 4px 0 var(--tile-edge);
  font-size: clamp(1.625rem, 8.5vw, 2.375rem);
  font-weight: 800;
  line-height: 1;
  transform: rotate(var(--tilt, 0deg));
  animation: tile-in 420ms cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: var(--delay, 0ms);
}

.tile:nth-child(1) { --tilt: -2deg; --delay: 0ms; }
.tile:nth-child(2) { --tilt: 1.5deg; --delay: 60ms; }
.tile:nth-child(3) { --tilt: -1deg; --delay: 120ms; }
.tile:nth-child(4) { --tilt: 2deg; --delay: 180ms; }
.tile:nth-child(5) { --tilt: -1.5deg; --delay: 240ms; }
.tile:nth-child(6) { --tilt: 1deg; --delay: 300ms; }

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translateY(-0.75rem) rotate(calc(var(--tilt, 0deg) * -3));
  }
}

.code-deco {
  justify-content: start;
  grid-template-columns: repeat(auto-fill, 3rem);
  margin-top: 2rem;
  -webkit-user-select: none;
  user-select: none;
}

.code-deco .tile {
  font-size: 1.5rem;
}

.code-deco + h1 {
  margin-top: 1.25rem;
}

.note {
  margin-top: 0.875rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.status:empty {
  display: none;
}

.status {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Buttons */

.btn-soft {
  display: block;
  min-height: 2.75rem;
  margin: 1.25rem auto 0;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn-soft.is-done {
  background: var(--accent);
  color: var(--on-accent);
}

.callout .btn-soft {
  margin: 1rem 0 0;
  background: var(--surface);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0.625rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-control);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.btn-main {
  font-size: 1.125rem;
}

.btn-sub {
  font-size: 0.8125rem;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-secondary {
  border-color: var(--control-line);
  color: var(--ink);
}

.btn-inline {
  display: inline-flex;
  margin-top: 0.5rem;
}

/* No store link yet: looks like a label, not a button */
.btn.is-soon {
  background: transparent;
  border: 2px dashed var(--control-line);
  color: var(--ink-muted);
}

.open-line {
  text-align: center;
  text-wrap: balance;
}

.open-line a {
  white-space: nowrap;
  font-weight: 700;
  border-radius: 6px;
}

.callout {
  margin-top: 1.5rem;
  padding: 1rem 1.125rem;
  background: var(--surface-2);
  border-radius: var(--radius-control);
}

/* Steps: a real sequence, so numbered */

.steps {
  margin-top: 2.5rem;
}

.steps h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.steps ol {
  margin-top: 1rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  min-height: 2rem;
  padding: 0.2rem 0 0 2.75rem;
  counter-increment: step;
}

.steps li + li {
  margin-top: 0.875rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}

.var {
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Start page: no store link yet (package 34) */

.soon {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.5rem 1.125rem;
  border: 2px dashed var(--control-line);
  border-radius: 999px;
  color: var(--ink-muted);
  font-weight: 700;
}

main > .soon + .callout {
  margin-top: 1.5rem;
}

/* Long pages: privacy policy, terms, help (package 34) */

.doc h1 {
  font-size: clamp(1.875rem, 7.5vw, 2.5rem);
  hyphens: auto;
  overflow-wrap: break-word;
}

.doc-meta {
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.doc .lede {
  margin-top: 0.75rem;
}

.doc h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.25;
  hyphens: auto;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.doc h3 {
  margin: 1.75rem 0 0.375rem;
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.3;
}

.doc section {
  scroll-margin-top: 1rem;
}

.doc p + p,
.doc ul + p,
.doc p + ul {
  margin-top: 0.75rem;
}

.doc ul {
  margin: 0;
  padding-left: 1.25rem;
}

.doc li + li {
  margin-top: 0.5rem;
}

.doc li::marker {
  color: var(--ink-muted);
}

.doc a {
  overflow-wrap: anywhere;
}

.summary {
  margin-top: 1.75rem;
  padding: 1.25rem 1.25rem 1.375rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.doc .summary h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
}

.toc {
  margin-top: 2rem;
}

.doc .toc h2 {
  margin: 0 0 0.25rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
}

.doc .toc ul {
  padding: 0;
  list-style: none;
}

.doc .toc li + li {
  margin-top: 0;
}

.toc a {
  display: inline-block;
  padding: 0.3125rem 0;
  font-weight: 600;
}

.contact-card {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font-style: normal;
}

.doc .contact-card + p {
  margin-top: 1rem;
}

.contact-line {
  display: block;
}

a.contact-line {
  margin-top: 0.25rem;
  font-weight: 700;
}

.contact-box {
  margin-top: 1.75rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.doc .contact-box h2 {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  font-size: 0.9375rem;
  font-weight: 700;
}

.mail-btn {
  overflow-wrap: anywhere;
}

.doc .contact-box .note {
  margin-top: 0.875rem;
}

/* Footer */

.foot {
  margin-top: 3rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.foot p + p {
  margin-top: 0.25rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: -0.375rem 0 0.5rem;
}

.foot-links a {
  display: inline-block;
  padding: 0.375rem 0;
  color: var(--ink);
  font-weight: 700;
  border-radius: 6px;
}

.foot-links a[aria-current="page"] {
  color: var(--ink-muted);
  text-decoration: none;
}

/* Wider screens: a little more air, same single column */

@media (min-width: 40rem) {
  h1 {
    margin-top: 3.5rem;
  }

  .code-card {
    padding: 1.75rem;
  }

  .actions {
    align-items: stretch;
  }
}

@media (hover: hover) {
  .btn-primary:hover {
    filter: brightness(1.15);
  }

  .btn-secondary:not(.is-soon):hover {
    background: var(--surface-2);
  }

  .btn-soft:hover {
    filter: brightness(0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile {
    animation: none;
  }

  .btn-soft {
    transition: none;
  }
}
