@font-face {
  font-family: "Playpen Sans";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("fonts/playpen-sans-latin-wght-normal.woff2") format("woff2-variations");
}

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

:root {
  color-scheme: light dark;
  --ground: #d4b38a;
  --surface: #f6ecd8;
  --field: #fffaf0;
  --ink: #2b1609;
  --on-ink: #f6ecd8;
  --muted: #45200e;
  --line: #6b4a2e;
  --chevron: url("icons/chevron-light.svg");
  --rule: #8a7448;
  --accent: #3f5a1c;
  --on-accent: #ffffff;
  --error: #8a1a10;
  --placeholder: #d4b38a;
  --r-thumb: 10px;
  --r-field: 12px;
  --r-button: 14px;
  --r-toast: 16px;
  --r-card: 22px;
  --r-sheet: 26px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #170e09;
    --surface: #402b1f;
    --field: #2a1a12;
    --ink: #f6ecd8;
    --on-ink: #170e09;
    --muted: #ecd3a8;
    --line: #b8986a;
    --chevron: url("icons/chevron-dark.svg");
    --rule: #a08562;
    --accent: #b8d07a;
    --on-accent: #170e09;
    --error: #ffb4a0;
    --placeholder: #a08562;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.5;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

a {
  color: inherit;
}

h1,
h2,
.card-title,
.stepper output {
  font-family: "Playpen Sans", "Atkinson Hyperlegible Next", sans-serif;
  font-weight: 600;
}

h1,
h2 {
  line-height: 1.2;
}

h1 {
  margin: 0 0 6px;
  font-size: 1.875rem;
  line-height: 1.1;
}

.lede {
  margin: 0 0 20px;
  color: var(--muted);
}

h2 {
  margin: 0 0 12px;
  font-size: 1.375rem;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--r-card);
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-button);
  object-fit: cover;
}

.body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 8px 4px;
}

.detail {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 1rem;
}

.rows {
  margin: 0 0 24px;
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-card);
  list-style: none;
}

h1 + .rows {
  margin-top: 16px;
}

form + h2 {
  margin-top: 28px;
}

.share {
  gap: 8px;
  margin: 14px 0 18px;
}

.rows li + li {
  border-top: 1px solid var(--rule);
}

.row-link {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 3.5rem;
  padding: 12px 14px 12px 16px;
  font-weight: 700;
  text-decoration: none;
}

button.row-link {
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.row-link span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mark {
  color: var(--muted);
}

.row-link:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}

.row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
}

.row.guest {
  grid-template-columns: 1fr;
  gap: 0;
}

.row-body {
  min-width: 0;
}

.thumb {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: var(--r-thumb);
  background: var(--placeholder);
  object-fit: cover;
}

.preview {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-button);
  object-fit: cover;
}

.row-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-meta {
  color: var(--muted);
  font-size: 1rem;
}

form + form {
  margin-top: 12px;
}

.rows form {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.375rem;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: var(--r-button);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn[hidden] {
  display: none;
}

.btn[data-claimed],
.btn.quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.btn:focus-visible,
.form input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form label {
  font-weight: 700;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.form input,
.form textarea {
  min-height: 3.25rem;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--r-field);
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

.form input[list] {
  padding-right: 46px;
  background: var(--chevron) no-repeat right 14px center var(--field);
}

/* The browser's own suggestion arrow sits off-centre. It stays as the tap target, but our chevron is what shows. */
.form input[list]::-webkit-calendar-picker-indicator {
  opacity: 0;
}

.wanted {
  display: flex;
  gap: 16px;
  align-items: center;
}

.wanted input[type="number"] {
  width: 6rem;
}

.wanted:has(:checked) input[type="number"] {
  color: var(--muted);
}

/* The real tickbox covers the whole label, so the target is 44px tall like every other control. The box and its
   tick are drawn, as the radio choices are. */
.form .tick {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 2.75rem;
  cursor: pointer;
}

.form .tick::before {
  flex: none;
  box-sizing: border-box;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  content: "";
}

.form .tick:has(input:checked)::before {
  border-color: var(--ink);
  background: var(--ink);
}

.form .tick:has(input:checked)::after {
  position: absolute;
  top: 50%;
  left: 8px;
  box-sizing: border-box;
  width: 8px;
  height: 14px;
  border: solid var(--field);
  border-width: 0 3px 3px 0;
  content: "";
  transform: translateY(-60%) rotate(45deg);
}

.form .tick:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.form .tick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.form .tick input:focus-visible {
  outline: none;
}

@media (forced-colors: active) {
  .form .tick:has(input:checked)::before {
    border-color: Highlight;
    background: Highlight;
  }

  .form .tick:has(input:checked)::after {
    border-color: HighlightText;
  }
}

.picker {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 10px 14px;
  border: 2px dashed var(--line);
  border-radius: var(--r-field);
  background: var(--field);
  color: var(--muted);
  font-weight: 700;
}

.picker span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.form .picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.picker:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.error {
  margin: 0 0 16px;
  padding: 12px 14px;
  /* impeccable-disable-next-line side-tab: GOV.UK error pattern, see DESIGN.md */
  border-left: 4px solid var(--error);
  background: var(--surface);
  color: var(--error);
  font-weight: 700;
}

.status {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status:not(:empty) {
  margin-bottom: 14px;
}

@media (forced-colors: active) {
  .card,
  .rows {
    border: 1px solid CanvasText;
  }

  .btn {
    border-color: ButtonText;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn {
    transition:
      background-color 0.15s,
      transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .mini,
  .toast button {
    transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  }

  .btn:active,
  .mini:active,
  .toast button:active {
    transform: scale(0.97);
  }
}

.row-claim,
.who {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.who {
  font-size: 1.0625rem;
}

.switch,
.panel {
  margin: 0 0 24px;
}

.switch {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel {
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--surface);
}

.panel h2 {
  margin: 0 0 10px;
}

.panel p {
  margin: 0 0 10px;
}

.panel .form {
  gap: 12px;
  margin-top: 14px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.choices legend {
  padding: 0;
  margin-bottom: 10px;
  font-weight: 700;
}

.choices .choice {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 2.75rem;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-field);
  background: var(--field);
  font-weight: 400;
  cursor: pointer;
}

.choices .choice::before {
  flex: none;
  box-sizing: border-box;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--field);
  content: "";
}

.choices .choice:has(input:checked) {
  border-color: var(--ink);
}

.choices .choice:has(input:checked)::before {
  border-color: var(--ink);
  background: var(--ink);
  box-shadow: inset 0 0 0 4px var(--field);
}

.choices .choice:has(input:focus-visible) {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.choices .choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.choices .choice input:focus-visible {
  outline: none;
}

.choice-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.choice-label,
.choice-hint {
  display: block;
}

.choice-label {
  font-weight: 700;
}

.choice-hint {
  color: var(--muted);
  font-size: 1rem;
}

.change summary {
  width: max-content;
  list-style: none;
  cursor: pointer;
}

.change summary::-webkit-details-marker {
  display: none;
}

.change summary:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.change[open] summary {
  margin-bottom: 12px;
}

.sheet .choices {
  margin-bottom: 18px;
}

@media (forced-colors: active) {
  .choices .choice:has(input:checked)::before {
    border-color: Highlight;
    background: Highlight;
  }
}

.row-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.row-actions form {
  margin: 0;
}

.row-actions .row-end {
  margin-left: auto;
}

.mini {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: var(--r-field);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

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

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: min(448px, calc(100% - 32px));
  padding: 10px 10px 10px 18px;
  border-radius: var(--r-toast);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 700;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.25);
  transform: translateX(-50%);
}

.toast span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast form {
  flex-shrink: 0;
  margin: 0;
}

.toast button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 12px;
  border: 2px solid var(--on-ink);
  border-radius: var(--r-field);
  background: transparent;
  color: var(--on-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toast button:focus-visible {
  outline: 3px solid var(--on-ink);
  outline-offset: 3px;
}

main:has(.toast) {
  padding-bottom: 120px;
}

@media (forced-colors: active) {
  .toast {
    border: 2px solid CanvasText;
    color: CanvasText;
  }

  .toast button {
    border-color: ButtonText;
    color: ButtonText;
  }
}

.cards {
  display: grid;
  gap: 28px;
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) {
  main:has(> .cards) {
    max-width: 980px;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.photo {
  position: relative;
}

.card-title {
  margin: 0;
  font-size: 1.4375rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.card .detail {
  margin: 0;
  overflow-wrap: anywhere;
}

.tag {
  position: relative;
  margin: 18px 0 28px;
  padding: 26px 20px 22px 56px;
  border-radius: 40px var(--r-card) var(--r-card) 40px;
  background: var(--surface);
}

.tag h1 {
  font-size: clamp(1.75rem, 8vw, 2.25rem);
  line-height: 1.08;
  overflow-wrap: break-word;
  hyphens: auto;
}

.tag .lede {
  margin: 10px 0 0;
  overflow-wrap: anywhere;
}

.eyelet {
  position: absolute;
  top: 34px;
  left: 20px;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ground);
  box-shadow: inset 0 0 0 3px var(--line);
}

.twine {
  position: absolute;
  top: -18px;
  left: -16px;
  stroke: var(--accent);
}

.twine path + path {
  stroke: var(--surface);
}

.band {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 13px 40px 13px 48px;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.photo .band {
  position: absolute;
  right: -10px;
  bottom: 0;
  left: -10px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.18);
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%);
}

.body > .band {
  margin: -14px -18px 6px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%);
}

.band::before {
  position: absolute;
  top: 50%;
  left: 20px;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px currentColor;
  content: "";
}

.band::after {
  position: absolute;
  inset: 5px 26px 5px 6px;
  border-block: 2px dashed currentColor;
  content: "";
  pointer-events: none;
}

.band.mine {
  background: var(--ink);
  color: var(--on-ink);
}

.band.covered {
  border-top: 2px solid var(--line);
  background: var(--ground);
  color: var(--muted);
}

@media (forced-colors: active) {
  .band.mine {
    color: CanvasText;
  }
}

.card:has(.photo .band) .body {
  padding-top: 16px;
}

.price {
  margin: 0;
  font-weight: 700;
}

.shop {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 2.75rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.icon {
  flex: none;
}

.covered img {
  filter: grayscale(1);
  opacity: 0.55;
}

.covered .card-title {
  color: var(--muted);
}

.qty {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.units {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.unit {
  fill: currentColor;
}

.unit.mine {
  color: var(--ink);
}

.unit.taken {
  color: var(--rule);
}

.unit.free {
  color: var(--line);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.sheet {
  inset: auto 0 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--surface);
  color: var(--ink);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.sheet h2 {
  margin: 0 0 4px;
  font-size: 1.625rem;
  overflow-wrap: anywhere;
}

.sheet .detail {
  margin: 0 0 16px;
}

.sheet .btn + .btn {
  margin-top: 12px;
}

.stepper {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.stepper .mini {
  min-width: 3.75rem;
  min-height: 3.75rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.375rem;
}

.stepper .mini:disabled {
  border-color: var(--rule);
  color: var(--muted);
  cursor: default;
}

.stepper output {
  min-width: 3ch;
  font-size: 3rem;
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .sheet {
    transform: translateY(100%);
    transition:
      transform 150ms ease-in,
      display 150ms allow-discrete,
      overlay 150ms allow-discrete;
  }

  .sheet[open] {
    transform: none;
    transition-duration: 200ms;
    transition-timing-function: ease-out;
  }

  @starting-style {
    .sheet[open] {
      transform: translateY(100%);
    }
  }

  .sheet::backdrop {
    opacity: 0;
    transition:
      opacity 150ms,
      display 150ms allow-discrete,
      overlay 150ms allow-discrete;
  }

  .sheet[open]::backdrop {
    opacity: 1;
    transition-duration: 200ms;
  }

  @starting-style {
    .sheet[open]::backdrop {
      opacity: 0;
    }
  }
}

@media (forced-colors: active) {
  .sheet {
    border: 2px solid CanvasText;
  }
}

/* Page changes slide the way the person went: deeper pages come in from the right, and going back brings the page
   from the left. A moved item and its neighbour slide into each other's place while the page holds still. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-group(*) {
    animation-duration: 240ms;
    animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1);
  }

  /* A change with no direction swaps at once. The browser's cross-fade would say nothing about where the person went. */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-name: none;
  }

  html:active-view-transition-type(forward)::view-transition-old(root),
  html:active-view-transition-type(back)::view-transition-old(root),
  html:active-view-transition-type(forward)::view-transition-new(root),
  html:active-view-transition-type(back)::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
  }

  html:active-view-transition-type(forward)::view-transition-old(root) {
    animation-name: leave-left;
  }

  html:active-view-transition-type(forward)::view-transition-new(root) {
    animation-name: enter-right;
  }

  html:active-view-transition-type(back)::view-transition-old(root) {
    animation-name: leave-right;
  }

  html:active-view-transition-type(back)::view-transition-new(root) {
    animation-name: enter-left;
  }
}

@keyframes enter-right {
  from {
    opacity: 0;
    transform: translateX(32px);
  }
}

@keyframes enter-left {
  from {
    opacity: 0;
    transform: translateX(-32px);
  }
}

@keyframes leave-left {
  to {
    opacity: 0;
    transform: translateX(-32px);
  }
}

@keyframes leave-right {
  to {
    opacity: 0;
    transform: translateX(32px);
  }
}
