/* /bujo: a cutting mat with a notebook on it. Loaded after site.css, which supplies
   the label tape, receipt and paper. Everything here is scoped to body.mat. */

body.mat {
  --mat: #1f5348;
  --mat-line: rgba(214, 236, 214, .13);
  --mat-ink: #d5e6d3;
  --cover: #262a38;
  min-height: 100dvh;
  color: var(--ink);
  font: 15px/1.45 var(--mono);
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--mat-line) 1.5px, transparent 1.5px),
    linear-gradient(rgba(214, 236, 214, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 236, 214, .05) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  padding: 0 16px 56px;
  overflow-x: clip;
}
.mat [hidden] { display: none !important; }

/* printed ruler along the top edge of the mat */
.mat .ruler {
  height: 26px; margin: 0 -16px 26px;
  background:
    repeating-linear-gradient(90deg, var(--mat-ink) 0 1.5px, transparent 1.5px 100px) 0 0 / 100% 18px no-repeat,
    repeating-linear-gradient(90deg, var(--mat-ink) 0 1px, transparent 1px 10px) 0 0 / 100% 8px no-repeat;
  opacity: .6; border-bottom: 1px solid var(--mat-line);
}

.mat .top { max-width: 1240px; margin: 0 auto 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 26px; }
.mat .top h1 { transform: rotate(-1.2deg); }
.mat .top p { color: var(--mat-ink); max-width: 46ch; font-size: 16px; }
.mat .langs { order: -1; flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 16px; margin-bottom: -10px; font-size: 14px; }
.mat .langs a { color: var(--mat-ink); text-decoration: none; padding: 4px 0; }
.mat .langs a:hover { color: #fff; }
.mat .langs a[aria-current] { color: #fff; font-weight: 700; border-bottom: 3px solid var(--tape-yellow); }
@media (min-width: 760px) {
  .mat .top { position: relative; }
  .mat .langs { position: absolute; top: 0; right: 0; margin: 0; }
}

.mat .bench {
  max-width: 1240px; margin: 0 auto;
  display: grid; gap: 36px; align-items: start;
  grid-template-columns: minmax(0, 372px) minmax(0, 1fr) 250px;
}

/* ---- the order form ---- */
.mat .form {
  position: relative; background: var(--paper); padding: 30px 24px 28px;
  display: grid; gap: 28px;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 16px 26px -10px rgba(0,20,12,.6);
}
.mat fieldset { border: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.mat legend { margin: 0 0 12px -34px; transform: rotate(-1deg); }
.mat .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.mat .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; }
.mat label.f { display: grid; gap: 2px; font-size: 13px; color: var(--ink-soft); min-width: 0; }
.mat .form :is(input[type="number"], input[type="text"], select, textarea) {
  font: 700 16px/1.3 var(--mono); color: var(--ink); background: transparent;
  border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 5px 2px; width: 100%; min-width: 0;
}
.mat .form textarea { border: 2px solid var(--ink); padding: 8px; min-height: 96px; resize: vertical; font-weight: 400; font-size: 14px; }
.mat :is(input, select, textarea, button, a, summary):focus-visible { outline: 3px solid var(--tape-blue); outline-offset: 2px; }
.mat :is(.top, .tabs, .pager) :focus-visible { outline-color: var(--tape-yellow); }

.mat .swatches, .mat .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.mat :is(.swatches, .seg) label { position: relative; cursor: pointer; text-align: center; font-size: 13px; }
.mat :is(.swatches, .seg) input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.mat :is(.swatches, .seg) input:focus-visible ~ :is(i, span) { outline: 3px solid var(--tape-blue); outline-offset: 2px; }

/* offcuts of each paper */
.mat .swatches i {
  display: block; height: 66px; margin-bottom: 5px; background-color: #fff;
  box-shadow: 0 1px 4px rgba(50,35,10,.4); transition: transform .18s;
}
.mat .swatches label:nth-child(odd) i { transform: rotate(-2deg); }
.mat .swatches label:nth-child(even) i { transform: rotate(1.6deg); }
.mat .swatches label:hover i { transform: translateY(-3px); }
.mat .swatches input:checked ~ i { transform: translateY(-5px); box-shadow: 0 0 0 3px var(--stamp), 0 9px 9px -2px rgba(50,35,10,.4); }
.mat .swatches input:checked ~ span { font-weight: 700; color: var(--stamp); }
.mat .p-dots { background-image: radial-gradient(circle, #777 1.1px, transparent 1.6px); background-size: 11px 11px; }
.mat .p-grid { background-image: linear-gradient(#b5bdc4 1px, transparent 1px), linear-gradient(90deg, #b5bdc4 1px, transparent 1px); background-size: 11px 11px; }
.mat .p-lines { background-image: linear-gradient(transparent 10px, #a3adb6 10px); background-size: 11px 11px; }

/* covers: a tray of small books, scrolled */
.mat .covers {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 10px; align-items: end; max-height: 372px; overflow-y: auto;
  margin: 0 -24px; padding: 4px 24px 12px; border-block: 1px dashed #b9b2a1;
}
.mat .covers__group { grid-column: 1 / -1; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.mat :is(.covers, .paints) label { position: relative; cursor: pointer; text-align: center; font-size: 12px; line-height: 1.2; min-width: 0; align-self: start; }
.mat :is(.covers, .paints) input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.mat .covers canvas { display: block; width: 100%; height: auto; margin-bottom: 6px; box-shadow: 0 1px 4px rgba(50,35,10,.45); transition: transform .18s; }
.mat .covers label:hover canvas { transform: translateY(-2px); }
.mat :is(.covers, .paints) label span { display: block; hyphens: auto; overflow-wrap: break-word; }
.mat .covers input:checked ~ canvas { box-shadow: 0 0 0 3px var(--stamp); }
.mat :is(.covers, .paints) input:checked ~ span { font-weight: 700; color: var(--stamp); }
.mat :is(.covers, .paints) input:focus-visible ~ :is(canvas, i) { outline: 3px solid var(--tape-blue); outline-offset: 3px; }
.mat .paints { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mat .paints i { display: block; height: 26px; margin-bottom: 4px; box-shadow: 0 1px 3px rgba(50,35,10,.4); }
.mat .paints input:checked ~ i { box-shadow: 0 0 0 3px var(--stamp); }
.mat .shuffle { justify-self: start; min-height: 40px; padding: 8px 14px; border: 2px solid var(--ink); background: none; font: 700 14px/1 var(--mono); color: var(--ink); cursor: pointer; }
.mat .shuffle:hover { background: var(--ink); color: var(--paper); }

/* either/or: circled in red pen, like a paper form */
.mat .seg span { display: block; padding: 7px 4px; border: 2.5px solid transparent; border-radius: 50% 46% 52% 45% / 58% 46% 54% 48%; color: var(--ink-soft); }
.mat .seg label:hover span { color: var(--ink); }
.mat .seg input:checked + span { border-color: var(--stamp); color: var(--ink); font-weight: 700; transform: rotate(-1.5deg); }
.mat .seg .serif { font-family: 'Crimson Text', Georgia, serif; font-size: 18px; line-height: 1.2; }
.mat .seg .sans { font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif; font-size: 16px; }

.mat .checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; font-size: 14px; }
.mat .checks label { display: flex; gap: 9px; align-items: center; cursor: pointer; }
.mat .checks input { appearance: none; flex: none; width: 20px; height: 20px; border: 2px solid var(--ink); position: relative; cursor: pointer; }
.mat .checks input:checked::after { content: '×'; position: absolute; inset: -11px -4px; font: 800 30px/38px var(--label); color: var(--stamp); text-align: center; }
.mat .checks--one { grid-template-columns: 1fr; }
.mat .hours { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: end; }
.mat .hours > :nth-child(n+5) { grid-column: 1 / -1; }
.mat .hours p { font-size: 13px; color: var(--ink-soft); margin: 0; }
.mat details summary { cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.mat details p { font-size: 13px; color: var(--ink-soft); margin: 8px 0; }

/* ---- the notebook ---- */
.mat .preview { position: sticky; top: 18px; display: grid; gap: 18px; justify-items: center; min-width: 0; }
.mat .stage { width: 100%; display: flex; justify-content: center; padding-right: 84px; }
.mat .book {
  position: relative; padding: 11px 11px 13px 24px; border-radius: 5px 12px 12px 5px;
  background: linear-gradient(90deg, rgba(0,0,0,.4) 0 13px, rgba(255,255,255,.1) 14px 15px, transparent 22px), var(--cover);
  box-shadow: 0 2px 2px rgba(0,0,0,.4), 0 26px 34px -12px rgba(0,15,8,.75);
}
/* the block of pages under the one you're looking at */
.mat .leaf { position: relative; perspective: 1600px; box-shadow: 2px 1px 0 #ded9cb, 4px 2px 0 #f6f3e9, 6px 3px 0 #d3cdbc; }
.mat .leaf canvas { display: block; background: #fff; touch-action: manipulation; }
.mat .leaf .ghost { position: absolute; inset: 0; transform-origin: 0 50%; pointer-events: none; backface-visibility: hidden; box-shadow: 8px 0 20px rgba(0,0,0,.25); }
.mat .ribbon {
  position: absolute; left: 25%; bottom: -44px; width: 13px; height: 46px; background: linear-gradient(90deg, #8d1f19, #c4362c 60%, #8d1f19);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}
.mat .tabs { position: absolute; left: 100%; top: 26px; display: grid; gap: 6px; justify-items: start; }
.mat .tabs button {
  font: 600 12px/1 var(--label); color: #fff; background: var(--t, var(--tape-black)); border: 0; cursor: pointer;
  padding: 11px 10px; min-width: 64px; text-align: left; border-radius: 0 6px 6px 0; box-shadow: 2px 3px 4px rgba(0,0,0,.35); transition: min-width .15s;
}
.mat .tabs button:nth-child(5n+1) { --t: var(--tape-red); }
.mat .tabs button:nth-child(5n+2) { --t: var(--tape-yellow); color: #2a2410; }
.mat .tabs button:nth-child(5n+3) { --t: var(--tape-blue); }
.mat .tabs button:nth-child(5n+4) { --t: var(--tape-white); color: #2b2b2b; }
.mat .tabs button:hover, .mat .tabs button[aria-pressed="true"] { min-width: 82px; }
.mat .pager { display: flex; align-items: center; gap: 16px; margin-top: 28px; color: var(--mat-ink); font-size: 14px; }
.mat .pager span { min-width: 25ch; text-align: center; }
.mat .pager button { font: 700 18px/1 var(--mono); width: 44px; height: 44px; border: 2px solid currentColor; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.mat .pager button:hover:not(:disabled) { background: var(--mat-ink); color: var(--mat); }
.mat .pager button:disabled { opacity: .35; cursor: default; }
.mat .hint { color: var(--mat-ink); font-size: 13px; text-align: center; }

/* ---- the receipt, and the button that pays for it ---- */
.mat .till { position: sticky; top: 18px; display: grid; gap: 24px; justify-items: center; }
.mat .till .receipt { margin-top: 12px; filter: none; }
.mat .receipt__rows dt { flex: none; }
.mat .make {
  width: 100%; max-width: 290px; padding: 18px 14px; cursor: pointer; border: 0; border-radius: 6px;
  font: 800 17px/1 var(--label); letter-spacing: .1em; text-transform: uppercase;
  background: var(--tape-yellow); color: #2a2410; box-shadow: 0 6px 0 #a98700, 0 12px 14px rgba(0,15,8,.5);
}
.mat .make:hover { background: #ffd21f; }
.mat .make:active { transform: translateY(4px); box-shadow: 0 2px 0 #a98700, 0 4px 6px rgba(0,15,8,.5); }
.mat .make:disabled { cursor: progress; opacity: .75; }
.mat .make:focus-visible { outline-color: #fff; }
.mat #status { color: var(--mat-ink); font-size: 14px; min-height: 3em; text-align: center; max-width: 290px; overflow-wrap: anywhere; }
/* Buy Me a Coffee: their button, with a plain link for when their script is blocked */
.mat .coffee { display: grid; justify-items: center; gap: 10px; max-width: 290px; text-align: center; color: var(--mat-ink); font-size: 14px; }
.mat .coffee p { margin: 0; }
.mat .coffee:has(.bmc-btn-container) .coffee__fallback { display: none; }
.mat .coffee__fallback { color: #2a2410; background: #ffdd00; font: 800 15px/1 var(--label); padding: 12px 18px; border-radius: 8px; text-decoration: none; }
.mat #status.err { background: var(--paper); color: #a3241c; padding: 8px 10px; font-weight: 700; }

/* ---- how to use it, for the device picked in the form ---- */
.mat .howto { max-width: 1240px; margin: 64px auto 0; background: var(--paper); padding: 34px 32px 28px; display: grid; gap: 30px; box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 16px 26px -10px rgba(0,20,12,.6); }
.mat .howto__group { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 40px; align-items: start; }
.mat .howto h2 { grid-column: 1 / -1; justify-self: start; margin: 0 0 6px -46px; transform: rotate(-1deg); font-size: 1rem; }
.mat .howto ol, .mat .howto ul { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; font-size: 15px; line-height: 1.5; }
.mat .howto ol li::marker { font: 800 15px var(--label); color: var(--stamp); }
.mat .howto ul { color: var(--ink-soft); font-size: 14px; }
.mat .howto em { font-style: normal; font-weight: 700; color: var(--ink); }
.mat .howto a { color: var(--ink); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.mat .howto__foot { margin: 0; padding-top: 18px; border-top: 1px dashed #999; color: var(--ink-soft); font-size: 13px; }

@media (max-width: 1180px) {
  .mat .bench { grid-template-columns: minmax(0, 372px) minmax(0, 1fr); }
  .mat .form { grid-row: span 2; }
  .mat .preview, .mat .till { position: static; }
}
@media (max-width: 800px) {
  .mat .bench { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .mat .form { grid-row: auto; padding: 28px 20px; }
  .mat legend { margin-left: -26px; }
  .mat .howto { padding: 30px 20px 24px; margin-top: 52px; }
  .mat .howto__group { grid-template-columns: minmax(0, 1fr); }
  .mat .howto h2 { margin-left: -26px; white-space: normal; line-height: 1.25; max-width: calc(100% + 26px); }
  .mat .covers { margin-inline: -20px; padding-inline: 20px; }
  .mat .stage { padding-right: 0; }
  .mat .book { margin-top: 88px; }
  .mat .tabs { left: 0; right: 0; top: auto; bottom: 100%; grid-template-columns: repeat(4, 1fr); gap: 4px; justify-items: stretch; padding: 0 6px; }
  .mat .tabs button, .mat .tabs button:hover, .mat .tabs button[aria-pressed="true"] { min-width: 0; padding: 13px 2px; text-align: center; font-size: 11px; border-radius: 5px 5px 0 0; }
  .mat .tabs button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 3px; }
}
@media (prefers-reduced-motion: reduce) { .mat * { transition: none !important; } }
