/* Load after story.css. The close control never shares the scrolling paper. */
#details {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: min(620px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  height: auto;
  max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin: auto;
  padding: 0;
  border: 1px solid #d9d0d9;
  border-radius: 18px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: #faf9f6;
  box-shadow: 0 24px 85px #2c21312b;
}

#details[open] { display: flex; flex-direction: column; }
#details:not([open]) { display: none; }

#details #close-details {
  position: relative;
  inset: auto;
  z-index: 3;
  flex: 0 0 44px;
  align-self: flex-end;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 6px 8px 0 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #443547;
  font: 400 29px/1 Arial, sans-serif;
  background: #faf9f6;
  touch-action: manipulation;
}

#details #close-details:focus-visible {
  outline: 2px solid #70587a;
  outline-offset: 2px;
}

#details #dialog-copy {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 6px clamp(22px, 5vw, 40px) 30px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overflow-wrap: anywhere;
}

#details h2 {
  margin: 0 0 24px;
  font: italic clamp(29px, 4.6vw, 42px)/1.12 Georgia, serif;
  text-wrap: balance;
}

#details p, #details li, #details summary, #details small {
  font-size: 16px;
  line-height: 1.55;
}

#details p { margin: 16px 0; }
#details li { padding: 7px 0; }
#details small { display: block; color: #746575; margin-top: 22px; }
#details summary { min-height: 44px; padding: 8px 0; cursor: pointer; }
#details a { max-width: 100%; min-height: 44px; line-height: 1.45; }
#details .price { font-size: clamp(44px, 8vw, 58px); line-height: 1.08; }

/* A separate paper sheet with its own background and real, selectable text. */
#details.receipt {
  width: min(566px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

#details.receipt #close-details {
  margin-right: 10px;
  margin-bottom: 8px;
  color: #4a3d2e;
  background: #f4ead9;
  border-color: #c9b698;
  box-shadow: 0 3px 12px #2e201f20;
}

#details.receipt #dialog-copy {
  --receipt-tilt-x: 0deg;
  --receipt-tilt-y: 0deg;
  --receipt-light-x: 50%;
  --receipt-light-y: 24%;
  --receipt-light-strength: .16;
  --receipt-shadow-x: 0px;
  --receipt-shadow-y: 16px;
  margin: 0 10px 10px;
  padding: clamp(24px, 5vw, 38px) clamp(22px, 5vw, 38px) 22px;
  color: #493c2e;
  background-color: #e5d4b8;
  background-image:
    radial-gradient(ellipse at var(--receipt-light-x) var(--receipt-light-y), rgb(255 251 234 / var(--receipt-light-strength)), transparent 64%),
    linear-gradient(90deg, #80562413, transparent 5%, transparent 95%, #79502419),
    linear-gradient(180deg, #91612d0d, transparent 7%, transparent 93%, #8656281c),
    url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22600%22%20height%3D%221000%22%20viewBox%3D%220%200%20600%201000%22%3E%3Cfilter%20id%3D%22grain%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%22.66%20.49%22%20numOctaves%3D%223%22%20seed%3D%2219%22%2F%3E%3CfeColorMatrix%20type%3D%22saturate%22%20values%3D%220%22%2F%3E%3C%2Ffilter%3E%3Cfilter%20id%3D%22fibres%22%3E%3CfeTurbulence%20type%3D%22fractalNoise%22%20baseFrequency%3D%22.036%20.29%22%20numOctaves%3D%222%22%20seed%3D%2241%22%2F%3E%3CfeColorMatrix%20type%3D%22saturate%22%20values%3D%220%22%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%22600%22%20height%3D%221000%22%20filter%3D%22url(%23grain)%22%20opacity%3D%22.21%22%2F%3E%3Crect%20width%3D%22600%22%20height%3D%221000%22%20filter%3D%22url(%23fibres)%22%20opacity%3D%22.085%22%2F%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%238e714d%22%20stroke-opacity%3D%22.20%22%20stroke-width%3D%22.7%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M34%2087q8-2%2017%203%20M129%20162l23-3%20M481%2076q-6%2011-4%2024%20M269%2059l16%207%20M532%20238l-9%2018%20M68%20303q12%205%2026%203%20M332%20216l7%2022%20M190%20383q10-3%2019-2%20M426%20425l28%205%20M557%20491l-5%2024%20M82%20529l17-6%20M282%20569q8%207%2018%207%20M390%20668l-15%209%20M149%20711l8%2021%20M516%20733q-9-3-20%201%20M48%20831l22%205%20M274%20868l-4%2018%20M452%20931l21-3%20M112%20953l-7%2017%20M365%20348l-12%207%22%2F%3E%3C%2Fg%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23fff4d8%22%20stroke-opacity%3D%22.32%22%20stroke-width%3D%22.8%22%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22M87%20134l18%204%20M349%20109l-6%2017%20M213%20279q8%203%2018%201%20M468%20326l16-5%20M113%20463l6%2020%20M344%20503l23%203%20M50%20658l14-4%20M242%20765l-5%2016%20M567%20853l-15%205%20M351%20958l11%207%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: local;
  border: 1px solid #c8b28e;
  border-radius: 3px;
  box-shadow: var(--receipt-shadow-x) var(--receipt-shadow-y) 36px #20171130, inset 0 1px #fff6dfb0, inset 0 0 18px #946c3412;
  transform: perspective(1000px) rotateX(var(--receipt-tilt-x)) rotateY(var(--receipt-tilt-y));
  transform-origin: 50% 20%;
  transition: transform 170ms ease-out, box-shadow 170ms ease-out;
}

#details.receipt #dialog-copy h2 {
  text-align: center;
  font-size: clamp(29px, 5vw, 39px);
  color: #453729;
}

#details.receipt #dialog-copy > ul {
  list-style: none;
  margin: 24px 0 20px;
  padding: 0;
  border-top: 1px dashed #a38c6d;
  border-bottom: 1px dashed #a38c6d;
}

#details.receipt #dialog-copy > ul > li {
  margin: 0;
  padding: 14px 0;
  border-top: 1px dashed #ad97775c;
}

#details.receipt #dialog-copy > ul > li:first-child { border-top: 0; }
#details.receipt #dialog-copy > p { color: #514332; }

#details.receipt #dialog-copy > .price {
  margin: 25px 0 10px;
  padding-top: 25px;
  border-top: 1px dashed #a38c6d;
  color: #3f3225;
  font: 400 clamp(49px, 9vw, 64px)/1 Georgia, serif;
  text-align: center;
  font-variant-numeric: lining-nums tabular-nums;
}

#details.receipt #dialog-copy > .price + p { margin: 12px 0 22px; text-align: center; }
#details.receipt #dialog-copy > small { color: #66533d; padding-top: 19px; border-top: 1px dashed #b19c7c; }

/* Perforation follows all content. Nothing is masked, cut off, or overprinted. */
#details.receipt #dialog-copy::after {
  content: "";
  display: block;
  height: 9px;
  margin-top: 26px;
  background: radial-gradient(circle at 2px 4px, #9c846440 1.2px, transparent 1.6px) 0 0 / 9px 9px repeat-x;
  pointer-events: none;
}

@media (max-width: 600px) {
  #details p, #details li, #details summary, #details small { font-size: 15px; }
  #details #dialog-copy { padding: 4px 22px 26px; }
  #details.receipt #dialog-copy { margin: 0 8px 8px; padding: 24px 21px 18px; }
  #details.receipt #close-details { margin-right: 8px; }
  #details.receipt #dialog-copy > ul { margin-top: 20px; }
  #details.receipt #dialog-copy > ul > li { padding: 12px 0; }
}

@media (prefers-reduced-motion: reduce) {
  #details.receipt #dialog-copy { transform: none; transition: none; }
}

body.static #details.receipt #dialog-copy { transform: none; transition: none; }
