/* Craftdue · Tape & Level, for the public pay page. Mirrors src/theme/tokens.ts: the yellow
   blade carries what is owed, graphite is the tape case, and blade yellow always carries
   #1F1D18 ink. */
@font-face {
  font-family: 'Archivo Title';
  src: url('/fonts/Archivo-Title.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/Archivo-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('/fonts/Archivo-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Martian Mono';
  src: url('/fonts/MartianMono-CondensedRegular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --ground: #efeee8;
  --surface: #fbfbf8;
  --ink: #1f1d18;
  --ink2: #4a473f;
  --rule: #cfcdc4;
  --case: #2b2923;
  --case-ink: #f6f3ea;
  --case-dim: #c4bfb1;
  --red: #c4161c;
  --blade: #ffc20d;
  --blade-hi: #ffd54a;
  --blade-lo: #e3a400;
  --blade-ink: #1f1d18;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #161510;
    --surface: #211f1a;
    --ink: #f3f0e6;
    --ink2: #c6c1b4;
    --rule: #3a372f;
    --case: #2e2b25;
    --red: #ff6b5f;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
::selection {
  background: var(--blade);
  color: var(--blade-ink);
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font:
    400 17px/1.5 'Archivo',
    system-ui,
    sans-serif;
}
main {
  max-width: 440px;
  margin: 0 auto;
  padding: 56px 16px 40px;
}

h1 {
  margin: 0;
  font:
    400 30px/1.12 'Archivo Title',
    'Archivo',
    system-ui,
    sans-serif;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
main[aria-busy='true'] h1 {
  color: var(--ink2);
}
/* The owner's document accent: a strip above the heading. Fills mirror ACCENTS in
   src/domain/document-design.ts (tests/customer-page.test.ts compares them). */
h1[class^='accent-'] {
  padding-top: 14px;
  border-top: 6px solid var(--rule);
}
h1.accent-navy {
  border-top-color: #1f3a5f;
}
h1.accent-forest {
  border-top-color: #2f5d3a;
}
h1.accent-brick {
  border-top-color: #9c3d2e;
}
h1.accent-slate {
  border-top-color: #3e4a56;
}
h1.accent-plum {
  border-top-color: #5b3a5e;
}
.reference {
  display: inline-block;
  margin: 12px 0 0;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font:
    400 13px/1.4 'Martian Mono',
    ui-monospace,
    monospace;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
}

/* The case holds the blade; the blade carries the amount, ruled like a tape. */
.case {
  margin: 28px 0 0;
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: var(--case);
  box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.55);
}
.case-label {
  margin: 0 2px 10px;
  font:
    400 12px/1.2 'Martian Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--case-dim);
}
.blade {
  position: relative;
  padding: 14px 16px 22px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--blade-hi), var(--blade) 45%, var(--blade-lo));
  color: var(--blade-ink);
  overflow: hidden;
}
.blade::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 14px;
  background:
    repeating-linear-gradient(90deg, rgb(31 29 24 / 0.55) 0 1.5px, transparent 1.5px 40px) 0 0 /
      100% 14px no-repeat,
    repeating-linear-gradient(90deg, rgb(31 29 24 / 0.35) 0 1px, transparent 1px 8px) 0 6px / 100%
      8px no-repeat;
}
.amount {
  margin: 0;
  font:
    400 44px/1.05 'Archivo Title',
    'Archivo',
    system-ui,
    sans-serif;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
}

/* Paid in full is level: the spirit-level vial with its bubble centred. */
.level {
  display: block;
  width: 72px;
  height: 24px;
  margin: 0 0 18px;
}
.level .tube {
  fill: var(--case);
}
.level .liquid {
  fill: #cfe04a;
}
.level .bubble {
  fill: #f6f3ea;
}
.level .mark {
  stroke: var(--case);
  stroke-width: 1.5;
}
@media (prefers-reduced-motion: no-preference) {
  .level .bubble {
    animation: settle 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}
@keyframes settle {
  from {
    transform: translateX(-14px);
  }
  to {
    transform: translateX(0);
  }
}

.lines {
  margin-top: 20px;
}
.lines p {
  margin: 0 0 8px;
  white-space: pre-line;
}
.lines p + p {
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  font:
    400 15px/1.5 'Martian Mono',
    ui-monospace,
    monospace;
  font-variant-numeric: tabular-nums;
}

button {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 24px;
  border: 0;
  border-radius: 12px;
  background: var(--blade);
  color: var(--blade-ink);
  font:
    600 18px/1.2 'Archivo',
    system-ui,
    sans-serif;
  cursor: pointer;
  box-shadow:
    inset 0 -3px 0 var(--blade-lo),
    0 6px 14px -8px rgb(0 0 0 / 0.45);
  transition:
    background-color 120ms ease-out,
    transform 120ms ease-out;
}
button:hover {
  background: var(--blade-hi);
}
button:active {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 var(--blade-lo);
}
button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
button[disabled] {
  cursor: progress;
  opacity: 0.7;
}

.decide {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.decide label {
  display: block;
  margin-top: 16px;
  font-weight: 600;
}
.decide input:not([type='checkbox']),
.decide textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.decide .tick {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}
.decide .tick input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex: none;
}
.decide details {
  margin-top: 24px;
}
.decide summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--ink2);
  text-decoration: underline;
}
button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: none;
}
button.secondary:hover {
  background: var(--ground);
}

.error {
  margin: 12px 0 0;
  color: var(--red);
  font-weight: 600;
}
.error:empty {
  display: none;
}

footer {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink2);
}
footer svg {
  flex: none;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

/* One moment: the blade is drawn out of the case when an amount is shown. */
@media (prefers-reduced-motion: no-preference) {
  .case.drawn .blade {
    animation: draw 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}
@keyframes draw {
  from {
    clip-path: inset(0 100% 0 0 round 8px);
  }
  to {
    clip-path: inset(0 0 0 0 round 8px);
  }
}

/* The issued quote or invoice, in the order the PDF prints it (customer-view.js). */
.document {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}
.document section {
  margin-top: 16px;
}
.document .label {
  margin: 0 0 4px;
  font:
    400 12px/1.4 'Martian Mono',
    ui-monospace,
    monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink2);
}
.document .text {
  margin: 0 0 8px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.document h2,
.document h3 {
  margin: 0;
  font:
    400 22px/1.2 'Archivo Title',
    'Archivo',
    system-ui,
    sans-serif;
}
.document h3 {
  font-size: 18px;
}
.document .parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.document .table {
  overflow-x: auto;
}
.document table {
  width: 100%;
  border-collapse: collapse;
}
.document th,
.document td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.document th {
  font-size: 12px;
  color: var(--ink2);
  border-bottom: 2px solid var(--ink);
}
.document .number {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.document .choice {
  text-align: center;
  white-space: nowrap;
}
.document .choice input {
  width: 22px;
  height: 22px;
  margin: 0;
}
.document .group th {
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: 13px;
}
.decide .option-total {
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}
.document .totals {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
}
.document .totals p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0;
  font-variant-numeric: tabular-nums lining-nums;
}
.document .totals .grand {
  padding-top: 8px;
  border-top: 2px solid var(--ink);
  font-weight: 600;
}
.document .photos figure {
  margin: 0 0 12px;
}
.document .photos img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}
.document img.logo {
  display: block;
  max-height: 56px;
  max-width: 180px;
}
.document .photos figcaption {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink2);
}
