/* Product page: one ticket, the photograph, the line to say, then the particulars. Grouped: layout, type, colour, motion. */

/* ---------- LAYOUT ---------- */

/* The opening ticket is packed tight so name, price and both actions stand above the bottom band. */
.ticket[data-layout="single"] {
  --photo-width: clamp(16rem, 44vh, 23rem);
  align-items: center;
  text-align: center;
  gap: 0;
  padding-block-start: 1.5rem;
}
.ticket[data-layout="single"] > * + * { margin-block-start: 0.5rem; }
.ticket[data-layout="single"] > h1 + p + p { margin-block-start: 0.15rem; }
.ticket[data-layout="single"] > :is(.mount, .pricetag) { inline-size: min(100%, var(--photo-width)); }
.ticket[data-layout="single"] > :is(.pair, .saying) { align-self: stretch; }
.ticket[data-layout="single"] > .saying { margin-block-start: clamp(2rem, 6vh, 3rem); }
.ticket[data-layout="single"] > .mount { padding: 0.75rem 0.75rem 0.6rem; --hem: 0.25rem; --seam: 0.4375rem; }
.mount > img { block-size: min(15rem, 29vh); aspect-ratio: auto; }
.mount > figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 0.75rem; min-block-size: 2.75rem; margin-block-start: 0.25rem; }
.mount > figcaption > button { min-block-size: 2.75rem; padding-inline: 0.5rem; border: 0; background: none; cursor: pointer; }

/* Saying: a barred heading, then the line to read out with its copy button. */
.saying { text-align: start; }
.saying > h2 { margin-block: 0 0.9rem; }
.saying > div { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.saying blockquote { flex: 1 1 14rem; margin: 0; padding: 0.9rem 1.1rem; }
.saying button { display: inline-grid; flex: 0 0 auto; min-inline-size: 9.5rem; }
.saying button > span { grid-area: 1 / 1; }
.saying button[aria-pressed="false"] > span:last-child,
.saying button[aria-pressed="true"] > span:first-child { visibility: hidden; }
html:not(.js) .saying button { display: none; }

/* Two-column ticket: lead and body beside the particulars, with the delivery note seated at the foot of the right column. */
.ticket[data-layout="columns"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  inline-size: min(100%, 64rem);
}
.ticket[data-layout="columns"] > div > * + * { margin-block-start: 1rem; }
.ticket[data-layout="columns"] > div:last-child { display: flex; flex-direction: column; }
.ticket[data-layout="columns"] > div:last-child > h2 { margin-block-end: 0; }
.particulars { margin: 0; padding: 0; }
.ticket[data-layout="columns"] > div > .particulars { margin-block-end: 1.5rem; }
.particulars > div { display: grid; grid-template-columns: minmax(6rem, 0.8fr) minmax(0, 1.4fr); gap: 0.25rem 1rem; padding-block: 0.7rem; border-block-start: var(--thread) solid; }
.particulars > div:first-child { border-block-start: 0; padding-block-start: 0; }
.particulars :is(dt, dd) { margin: 0; }
.ticket[data-layout="columns"] > div > .footnote { margin-block-start: auto; padding-block-start: 1rem; border-block-start: var(--twine) solid; }
.footnote > p { margin: 0; }

/* Alongside: the hand-off to other arrangements, three equal stubs with equal photographs. */
.alongside > .rack { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; margin-block: 1.25rem; }
@media (min-width: 48rem) {
  .alongside > .rack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.alongside > .rack > .stub > img { aspect-ratio: 4 / 3; block-size: auto; }
.alongside > .rack > .stub > .pricetag { flex-wrap: nowrap; }
.alongside > .rack > .stub > .pricetag > span:first-child { min-inline-size: 0; }
.alongside > .rack > .stub > .pricetag > span:last-child { flex: none; white-space: nowrap; }
.alongside > p { margin: 0; max-inline-size: 44rem; }

/* Enlarged: the dialog the script builds for the photograph. */
.enlarged { inline-size: min(92vw, 56rem); max-inline-size: none; max-block-size: 92vh; padding: 1.75rem; border: 0; --hem: 0.5rem; --seam: 0.9375rem; }
.enlarged[open] { display: grid; gap: 1rem; justify-items: end; }
.enlarged > img { inline-size: 100%; max-block-size: 68vh; object-fit: contain; }

/* ---------- TYPE ---------- */

.ticket[data-layout="single"] > p { line-height: 1.35; }
.ticket[data-layout="single"] > h1 + p + p { font-size: 1.0625rem; }
.ticket[data-layout="single"] > .pricetag > span { font-size: 1.25rem; }
.mount > figcaption > button { font: inherit; text-decoration: underline; text-underline-offset: 0.2em; }
.saying > h2 { font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.625rem); }
.saying blockquote { font-style: italic; font-size: 1.125rem; }
.ticket[data-layout="columns"] > div:first-child > h2 + p { font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3rem); }
.particulars dt { font-family: var(--jost); font-weight: 500; font-size: 1.125rem; }
.particulars dd { font-size: 1.0625rem; }
.footnote > p { font-size: 1.0625rem; }
.alongside > p { font-size: 1.0625rem; }

/* ---------- COLOUR ---------- */

.mount > figcaption > button { color: inherit; }
.saying blockquote { outline: var(--thread) solid var(--magenta); outline-offset: -0.35rem; }
.particulars > div { border-color: var(--magenta); }
.ticket[data-layout="columns"] > div > .footnote { border-color: var(--magenta); }
.enlarged {
  background: var(--blush);
  color: var(--magenta);
  outline: var(--twine) solid var(--magenta);
  outline-offset: calc(-1 * var(--hem));
  box-shadow: inset 0 0 0 var(--seam) var(--blush), inset 0 0 0 calc(var(--seam) + var(--thread)) var(--magenta);
}
.enlarged::backdrop { background: color-mix(in srgb, var(--magenta) 92%, transparent); }
.enlarged .action:focus-visible { outline-color: var(--magenta); }

/* ---------- MOTION ---------- */

.enlarged[open] { animation: settle 250ms ease-out; }
@keyframes settle { from { opacity: 0; } to { opacity: 1; } }
