/* the minoko page. Site shell from style.css, article layout from devlog/post.css,
   and the demo stages use the catalogue's own paper, ink and fonts in both themes */

@font-face { font-family: "Satoshi"; src: url("fonts/Satoshi-Variable.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
.mk-page {
  --paper: #fbf6ee; --paper-2: #f3eadc; --paper-3: #fffdf8; --ink: #1e2240; --ink-soft: #565a77;
  --cobalt: #2d62e8; --tomato: #e3402a; --mustard: #efb43f; --blush: #f8d4cb;
}
.hand { font-family: "Mali", cursive; font-weight: 600; letter-spacing: 0; }

/* ---------- hero ---------- */
.mk-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: center; margin-bottom: 72px; }
.mk-hero h1 { font-size: clamp(48px, 9.5vw, 120px); letter-spacing: -.055em; line-height: .9; margin: 22px 0 24px; }
.mk-hero h1 span { color: var(--cobalt); font-style: italic; }
.dark .mk-hero h1 span { color: #7a9cf5; }
/* her things are cream in both themes, so in dark mode a light shadow would just melt into them */
.dark :is(.mk-hero-logo, .mk-sheet img) { box-shadow: 8px 8px 0 var(--orange); }
.dark .mk-btn { box-shadow: 4px 4px 0 var(--orange); }
.dark .mk-btn:hover { box-shadow: 6px 6px 0 var(--orange); }
.mk-hero .dek { max-width: 26em; }
.mk-hero-logo {
  display: block; width: clamp(150px, 20vw, 220px); height: auto; padding: 22px; box-sizing: content-box;
  background: var(--paper); border: 2px solid var(--line); border-radius: 22px; box-shadow: 8px 8px 0 var(--line);
  transform: rotate(3deg);
}
.mk-btn {
  display: inline-block; margin-top: 32px; padding: 14px 22px; border: 2px solid var(--line); border-radius: 99px;
  background: var(--paper); color: var(--ink); font-weight: 700; text-decoration: none; box-shadow: 4px 4px 0 var(--line);
  transition: transform .15s, box-shadow .15s;
}
.mk-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--orange); }

/* ---------- demo stages: her paper, her ink ---------- */
.demo-body.paper { background: var(--paper); color: var(--ink); font-family: "Satoshi", "Space Grotesk", sans-serif; }
.demo > .paper + figcaption { padding-top: 12px; }
.prose .paper :is(p, ul, label) { margin: 0; }
.label { font-size: 15px; line-height: 1.3; color: var(--ink-soft); text-align: center; }

/* the table */
.table-body { position: relative; height: clamp(360px, 44vw, 460px); overflow: hidden; touch-action: none; }
.snap {
  position: absolute; left: var(--x); top: var(--y); width: clamp(96px, 14vw, 150px); aspect-ratio: 3 / 4; object-fit: cover;
  border: 7px solid var(--paper-3); border-bottom-width: 22px; border-radius: 3px;
  box-shadow: 0 10px 22px rgb(30 34 64 / .18); rotate: var(--r); cursor: grab; user-select: none; z-index: 2;
  transition: scale .2s, box-shadow .2s;
}
.snap-sm { width: clamp(76px, 10vw, 110px); }
.snap.lift { scale: 1.06; box-shadow: 0 18px 32px rgb(30 34 64 / .25); cursor: grabbing; }
.table-middle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; pointer-events: none; z-index: 1; }
.table-middle img { width: clamp(80px, 11vw, 110px); height: auto; }
.table-middle p { font-size: 16px; color: var(--tomato); rotate: -3deg; }

/* the letter: ruled paper, every line on a rule (all heights are multiples of --L, --R is where the rule sits in each band) */
.letter-body { display: flex; flex-direction: column; align-items: center; gap: 28px; overflow: hidden; padding-block: 56px 32px; }
.letter { position: relative; width: min(380px, 100%); perspective: 3000px; }
.letter-inside {
  --L: 30px; --R: 23.5px;
  background: var(--paper-3) linear-gradient(transparent calc(var(--R) - 1px), rgb(45 98 232 / .13) calc(var(--R) - 1px) var(--R), transparent var(--R)) 0 0 / 100% var(--L);
  border-radius: 6px; box-shadow: 0 10px 28px rgb(30 34 64 / .14); padding: calc(var(--L) * 2) 28px calc(var(--L) * 1.5);
  font: 500 16px/var(--L) "Mali", cursive; color: var(--ink);
}
.prose .letter-inside p { margin: 0 0 var(--L); }
.letter-hi { font-size: 28px; line-height: calc(var(--L) * 2); font-weight: 600; color: var(--cobalt); position: relative; top: 9px; }
.prose .letter-inside .letter-hi { margin-bottom: 0; }
.letter em { font-style: normal; font-weight: 600; color: var(--tomato); }
.say { color: var(--ink-soft); }
.prose .letter-inside .letter-sign { margin: 0; font-size: 18px; position: relative; top: -1px; }
.letter-sign span { display: block; width: max-content; font-size: 40px; font-weight: 600; line-height: calc(var(--L) * 2); color: var(--tomato); rotate: -4deg; transform-origin: left bottom; position: relative; top: 9.5px; }
/* the cover swings open around its left edge. backface-visibility isn't reliable here, so the script swaps the sides at 90° */
.letter-cover { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; cursor: pointer; }
.letter.open .letter-cover { pointer-events: none; }
.letter-face, .letter-back { position: absolute; inset: 0; border-radius: 6px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 10px 28px rgb(30 34 64 / .14); }
.letter-face {
  display: grid; place-items: center; background: var(--blush) radial-gradient(var(--paper-3) 1.6px, transparent 1.8px) 0 0 / 22px 22px;
}
.letter-face img { width: 40%; height: auto; }
.letter-back { background: var(--paper-2) radial-gradient(rgb(30 34 64 / .09) 1.4px, transparent 1.6px) 0 0 / 22px 22px; transform: rotateY(180deg); visibility: hidden; }

/* turn it over */
.turn-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; justify-items: center; }
.turn-card { display: grid; gap: 14px; width: min(260px, 100%); }
.flip-stage { perspective: 1200px; }
.flip-main, .peel img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; box-shadow: 0 10px 24px rgb(30 34 64 / .16); }
.flip-main { transition: transform .16s ease-in; }
.flip-main.out { transform: rotateY(90deg); }
.flip-main.in { transform: rotateY(-90deg); transition: none; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumbs button { padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; overflow: hidden; min-height: 44px; }
.thumbs button[aria-current="true"] { border-color: var(--ink); }
.thumbs button:focus-visible, .peel:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
.thumbs img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }

@property --peel { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
.peel {
  --peel: 0%; position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, #fbfaf7 40%, #e6e2da); transition: --peel .5s cubic-bezier(.2, .8, .2, 1);
}
.peel img { box-shadow: none; clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--peel)), calc(100% - var(--peel)) 100%, 0 100%); }
.peel::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: var(--peel); height: var(--peel); border-top-left-radius: 45% 45%;
  background: linear-gradient(to bottom right, #fffefb 10%, #ece6dc 40%, #d6cdbf 51%, transparent 51.5%);
  filter: drop-shadow(-2px -2px 3px rgb(30 34 64 / .28));
}
.peel[aria-pressed="true"], .peel:focus-visible { --peel: 22%; }
@media (hover: hover) { .peel:hover { --peel: 22%; } }

/* the wishlist */
.wish-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: start; }
.wish-pick { display: grid; gap: 16px; }
.prose .wish-items { list-style: none; padding: 0; display: grid; gap: 10px; }
.prose .wish-items li { margin: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--paper-3); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px 8px 8px; }
.wish-items li::marker { content: none; }
.wish-items img { width: 52px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.wish-items b { display: block; font-size: 16px; line-height: 1.2; }
.wish-items small { font-size: 13px; color: var(--ink-soft); }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button {
  width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink);
  font: 700 18px/1 "Satoshi", sans-serif; cursor: pointer;
}
.qty button:hover { background: var(--mustard); }
.qty button:focus-visible, .field input:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.qty output { min-width: 2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.field input { font: 500 16px "Satoshi", sans-serif; color: var(--ink); background: var(--paper-3); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
.mail { background: var(--paper-3); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 5px 5px 0 var(--cobalt); overflow: hidden; }
.mail-head { display: grid; gap: 2px; margin: 0; padding: 10px 14px; border-bottom: 2px solid var(--ink); background: var(--paper-2); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.prose .mail-body {
  margin: 0; padding: 14px; border: 0; border-radius: 0; box-shadow: none; background: none; color: var(--ink);
  font: 500 15px/1.55 "Satoshi", sans-serif; white-space: pre-wrap; overflow-wrap: anywhere;
}
.prose .mail-body::before { content: none; }

/* the line sheet */
.prose .mk-sheet { margin-top: 1.6em; display: grid; justify-items: center; gap: 12px; }
.mk-sheet img { width: min(340px, 80%); height: auto; border: 2px solid var(--line); box-shadow: 8px 8px 0 var(--line); rotate: -1.5deg; }
.mk-sheet figcaption { font-size: 15px; color: var(--muted); text-align: center; max-width: 30em; }
.prose pre .s { color: #9ccf8a; }

/* end (same as the Emberbound page) */
.game-end { max-width: var(--col); margin-top: 96px; padding-top: 22px; border-top: 2px solid var(--line); }
.game-end .mono { font-size: 13px; color: var(--muted); }
.game-end .back { display: inline-block; font-size: clamp(34px, 6vw, 64px); font-weight: 700; letter-spacing: -.045em; line-height: 1; text-decoration: none; margin-top: 14px; }
.game-end .back:hover { color: var(--orange); }
.game-end .also { margin-top: 18px; font-size: 17px; }
.game-end .also a { text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }

@media (max-width: 860px) {
  .mk-hero { grid-template-columns: minmax(0, 1fr); }
  .mk-hero-logo { order: -1; justify-self: center; }
  .wish-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .turn-body { grid-template-columns: minmax(0, 1fr); }
  /* on a phone the table is taller than wide, so the photos go round the edges instead */
  .table-body { height: 480px; }
  .snap { width: 84px; border-width: 5px; border-bottom-width: 15px; left: min(var(--mx), calc(100% - 84px)); top: var(--my); }
  .snap-sm { width: 70px; left: min(var(--mx), calc(100% - 70px)); }
  .snap:nth-of-type(1) { --mx: 3%;  --my: 3%; }
  .snap:nth-of-type(2) { --mx: 72%; --my: 2%; }
  .snap:nth-of-type(3) { --mx: 70%; --my: 72%; }
  .snap:nth-of-type(4) { --mx: 3%;  --my: 70%; }
  .snap:nth-of-type(5) { --mx: 38%; --my: 4%; }
  .snap:nth-of-type(6) { --mx: 40%; --my: 76%; }
  .table-middle p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .flip-main, .peel, .snap, .mk-btn { transition: none; }
}
