/* Inkbath's page around the bath: Atkinson Hyperlegible for every word (kits/brand/fonts.css), a warm paper ground,
   dark ink text; the bath (bath/) brings its own colours. Phones first: 360 × 640 up. */
@font-face {
  font-family: G;
  font-style: italic;
  src: url('./fonts/garamond-italic.woff2') format('woff2');
  font-display: swap;
}

:root {
  --paper: #f4eee3;
  --paper2: #fbf7ef;
  --ink: #1f2230;
  --muted: #55586a;
  --line: #d8ccb6;
  --accent: #b23a2a;
  --err: #a12a1c;
  /* the shop's bar over the page, where it is (its own --shop-bar, products/front/README.md) */
  --bar: var(--shop-bar, 0px);
  /* how far a fixed layer's bottom runs under the browser's bars (app.js measureBelow), and the phone's home bar */
  --below: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shop-bubble: #1f2230;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    400 16px/1.45 A,
    system-ui,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
body:not(.page) {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---- the bath: the whole screen under the shop's bar */
#bath {
  position: fixed;
  inset: var(--bar) 0 var(--below) 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* till the bath and its style sheet are in, a drop of ink on the page, its rings spreading: it's loading (bath.css
   shows the bath over it) */
.ib {
  visibility: hidden;
}
#bath::before,
#bath::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 45%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  z-index: -1;
}
#bath::before {
  background: var(--ink);
}
#bath::after {
  border: 2px solid var(--ink);
  animation: bath-loading 1.4s ease-out infinite;
}
@keyframes bath-loading {
  from {
    scale: 1;
    opacity: 0.8;
  }
  to {
    scale: 4;
    opacity: 0;
  }
}
.help-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}
#bath > .help-link,
body > .help-link {
  position: fixed;
  top: var(--bar);
  left: 0;
  z-index: 5;
}
.help-link span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
}
.help-word {
  display: none;
}
/* a wide screen has the room to say what the (?) opens: a paper pill, "How it works" beside a dark (?), and the lip
   keeps clear of it */
@media (min-width: 700px) {
  #bath .ib-top {
    --side-room: 172px;
  }
  .bath-slot-help {
    padding: 6px 0 0 8px;
  }
  .help-link:has(.help-word) {
    grid-auto-flow: column;
    gap: 8px;
    width: auto;
    height: 34px;
    padding: 0 14px 0 3px;
    border-radius: 17px;
    background: var(--paper);
    color: var(--ink);
    font-size: 15px;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
  }
  .help-link:has(.help-word) span {
    width: 28px;
    height: 28px;
    background: var(--ink);
    color: var(--paper);
    box-shadow: none;
  }
  .help-word {
    display: inline;
  }
}

/* ---- the how-to the (?) opens: five short loops of the bath's own engine, over the bath */
.howto {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(10 8 24 / 0.45);
  overscroll-behavior: contain;
}
.howto::backdrop {
  background: rgb(14 14 26 / 0.55);
}
.howto[open] {
  animation: howto-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes howto-in {
  from {
    opacity: 0;
    translate: 0 16px;
  }
}
.howto-in {
  padding: 18px 22px 20px;
}
.howto-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.howto h2 {
  margin: 0;
  font:
    italic 500 28px/1.1 G,
    Georgia,
    serif;
}
.howto-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}
.howto-x svg {
  width: 22px;
  height: 22px;
}
.howto-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.howto-steps li {
  counter-increment: step;
}
.howto-steps canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  background: #efe6d6;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}
.howto-steps h3 {
  margin: 10px 0 2px;
  font-size: 16px;
}
.howto-steps h3::before {
  content: counter(step) '. ';
}
.howto-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
.howto-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 18px;
}
.howto-foot .fine {
  margin: 0;
}
/* the card's way out, sized to its words beside the help link (a phone gives it the row) */
.howto-foot .btn.howto-go {
  width: auto;
  min-width: 240px;
  padding-inline: 32px;
}
/* a phone: the loops two by two, smaller, so the first steps and their words show at once */
@media (max-width: 520px) {
  .howto-in {
    padding: 14px 16px 16px;
  }
  .howto h2 {
    font-size: 24px;
  }
  .howto-steps {
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px;
  }
  .howto-steps h3 {
    font-size: 15px;
  }
  .howto-steps p {
    font-size: 13px;
  }
}

/* while ordering is closed: the opens-soon line at the water's foot, plain words on the water, no box */
.soon-first {
  position: absolute;
  inset: auto 0 14px;
  margin: 0 auto;
  max-width: 86%;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 6px var(--paper2);
  pointer-events: none;
}
/* a shared marble's ways on, at the water's foot once it has played (kits/share), or what kept it from opening */
.shared-ways {
  position: absolute;
  inset: auto 0 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 auto;
  max-width: min(92%, 420px);
}
.shared-ways[hidden] {
  display: none;
}
.shared-ways p {
  flex: 1 0 100%;
  margin: 0;
  padding: 9px 16px;
  border-radius: 18px;
  background: rgba(26, 28, 42, 0.78);
  color: var(--paper2);
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
}
.shared-ways .btn {
  flex: 1 1 140px;
  box-shadow: 0 6px 18px rgba(18, 9, 3, 0.35);
}
.shared-ways .btn.ghost {
  background: var(--paper2);
}
/* the link itself, to copy by hand where it couldn't be shared or copied (kits/share linkField) */
.share-link {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

/* ---- the sheet: slides up over the bath's lower part once the notebook is made */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--below);
  z-index: 10;
  max-height: min(calc(100dvh - var(--below) - var(--bar) - 150px), 340px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 30px rgb(20 16 10 / 0.22);
  transform: translateY(105%);
  transition: transform 0.46s cubic-bezier(0.2, 1.25, 0.35, 1);
  padding-bottom: var(--safe-bottom);
}
.sheet.open {
  transform: none;
}
.sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 8px auto 0;
}
.sheet-in {
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 18px 18px;
}
.sheet-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
h1 {
  font:
    italic 500 26px/1.1 G,
    Georgia,
    serif;
  margin: 4px 0 0;
  letter-spacing: 0.005em;
}
/* the price big and bold, what it includes quieter after it */
.price {
  margin: 0 0 8px;
  font-size: 18px;
}
.price span {
  font-size: 14px;
  color: var(--muted);
}
.what {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}
/* the remake promise under the order button: the sheet's quiet type, the whole line a link to the terms */
.remake {
  margin: 8px 0 0;
  font-size: 14px;
  text-align: center;
  text-wrap: balance; /* two lines in Dutch and German at 390 px: the question on one, the answer on the next */
}
.remake a {
  color: var(--muted);
  text-underline-offset: 2px;
}
fieldset.paper {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
fieldset.paper legend {
  font-weight: 700;
  font-size: 14px;
  padding: 0;
  margin-bottom: 4px;
}
.choice {
  position: relative;
  display: block;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper2);
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.choice svg {
  width: 22px;
  height: 27px;
  flex: none;
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.6;
}
.choice svg path {
  stroke-width: 1.3;
  stroke: #7d8296;
}
.choice input:checked + span {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.choice input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.choice:active span {
  transform: scale(0.97);
}
.field {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.field > span {
  font-weight: 700;
  font-size: 14px;
}
.field input {
  font: inherit;
  font-size: 17px;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--ink);
}
.field small {
  color: var(--muted);
  font-size: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper2);
  font:
    700 16px/1.2 A,
    sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
}
/* waiting on the cover's check: calm, not greyed out like a refusal */
.btn[aria-busy='true'] {
  opacity: 1;
  cursor: progress;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    opacity: 0.78;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy='true'] {
    animation: none;
  }
}
.btn.big {
  width: 100%;
  min-height: 52px;
  font-size: 17px;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.row .btn {
  flex: 1 1 140px;
  gap: 8px;
}
/* a line icon before a button's words, drawn like the paper choices' */
.btn .icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.row.stack {
  flex-direction: column;
}
.row.stack .btn {
  flex: none;
}
a {
  color: var(--ink);
}
.err {
  color: var(--err);
  font-weight: 700;
}
.soon,
.note {
  background: var(--paper2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 0;
}
.added {
  display: grid;
  gap: 10px;
}
.big-note {
  font:
    italic 500 24px/1.2 G,
    Georgia,
    serif;
  margin: 4px 0 0;
}
.fine,
.small {
  color: var(--muted);
  font-size: 14px;
}
.fine {
  margin: 12px 0 0;
}
.foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.foot a {
  color: var(--ink);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.foot .ai {
  margin: 8px 0 0;
  text-wrap: balance;
}

/* ---- the order's page */
.status {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 18px 28px;
}
.status .cover {
  display: block;
  width: min(62%, 240px);
  height: auto;
  margin: 8px auto 18px;
  border-radius: 3px 10px 10px 3px;
  box-shadow:
    0 1px 0 rgb(0 0 0 / 0.08),
    6px 10px 24px rgb(20 16 10 / 0.25),
    inset 6px 0 8px rgb(0 0 0 / 0.12);
}
/* a line whose one link is hidden: the invoice's, until there is one */
.status p:has(> a[hidden]:only-child) {
  display: none;
}
/* under the status: a cancel taken back, "Delete my details" confirmed once (kits/payments/order.js) */
.order-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
}
.order-actions:empty {
  display: none;
}
.order-actions-note,
.order-actions-ask p {
  margin: 0;
}
.order-actions-ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.btn.quiet {
  align-self: flex-start;
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.kicker {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.mono {
  font-family: ui-monospace, monospace;
}

@media (prefers-reduced-motion: reduce) {
  .sheet {
    transition: none;
  }
  .howto[open] {
    animation: none;
  }
}
