/* Chapter II: the painting and its cast, set on a parchment page */
@font-face { font-family: 'Anton'; src: url('../fonts/anton.woff2') format('woff2'); font-display: swap; }
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
:root { --volt: #9db9ff; --meme: 'Anton', Impact, 'Haettenschweiler', 'Arial Narrow Bold', sans-serif; --spring: cubic-bezier(.2, 1.5, .4, 1); --spin: 0deg; }
.tstage { display: grid; justify-items: center; gap: 16px; margin: 8px 0 6px; --plate: min(100%, 640px); }
[hidden] { display: none !important; }
.hexed {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1rem;
  width: var(--plate); padding: .7rem 1rem; border-radius: 12px; text-align: center;
  background: rgba(126, 34, 18, .1); border: 1px dashed rgba(124, 34, 18, .45);
  font-size: 1.1rem;
}
.hexed__back { font: 400 1rem var(--meme); letter-spacing: .08em; text-transform: uppercase; color: var(--red); text-decoration: underline; text-underline-offset: .25em; }

/* the plate: painting, live layers and the caption */
.tplate {
  --charge: 0;
  position: relative; width: var(--plate); aspect-ratio: 1; container-type: inline-size;
  border-radius: clamp(10px, 1.6cqi, 18px); overflow: hidden; isolation: isolate; background: #2a1420;
  box-shadow: 0 0 0 1px rgb(255 214 160 / .16), 0 40px 90px -30px rgb(0 0 0 / .9),
    0 0 calc(30px + var(--charge) * 90px) calc(var(--charge) * 18px) rgb(120 150 255 / calc(.15 + var(--charge) * .55));
  cursor: pointer; touch-action: manipulation;
}
.plate__img, .plate__gl, .plate__fx, .plate__flash { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate__img { object-fit: cover; }
.plate__gl { opacity: 0; transition: opacity .6s ease; }
.plate__gl.is-live { opacity: 1; }
.plate__fx { mix-blend-mode: screen; pointer-events: none; }
.plate__flash { background: radial-gradient(circle at 85% 15%, #fff, #fff6e8 45%, #ffe2c0); opacity: 0; pointer-events: none; }

/* the meme caption, set live */
.meme {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 2.1cqi 3cqi 3.4cqi; pointer-events: none; text-align: center;
  font-family: var(--meme); font-weight: 400; text-transform: uppercase; color: #fff; letter-spacing: .012em;
  -webkit-text-stroke: .1em #000; paint-order: stroke fill;
  text-shadow: 0 0 .06em #000, 0 .03em .08em rgb(0 0 0 / .6);
}
.meme__line { display: block; max-width: 96cqi; line-height: 1.04; font-size: calc(var(--fit, 1) * 12.2cqi); }
.meme__line--bottom { width: 82cqi; text-wrap: balance; }
.meme .w { display: inline-block; will-change: transform, opacity; }
.js:not(.ready) .meme { visibility: hidden; animation: show-anyway 0s 2.5s forwards; }
@keyframes show-anyway { to { visibility: visible; } }

/* controls */
.controls { display: grid; justify-items: center; gap: .9rem; width: var(--plate); }
.tcast {
  position: relative; display: inline-flex; align-items: center; gap: .6rem; min-height: 3.6rem; padding: .7rem 2.2rem .7rem 1.8rem;
  border: 0; border-radius: 999px; cursor: pointer; isolation: isolate;
  font: 400 clamp(1.35rem, 1.1rem + 1vw, 1.75rem) var(--meme); letter-spacing: .08em; text-transform: uppercase; color: #fff;
  background: none; box-shadow: 0 14px 34px -12px rgb(91 114 255 / .9);
  text-shadow: 0 1px 0 rgb(0 0 0 / .5); transition: translate .25s, box-shadow .25s, filter .25s;
}
.tcast::after {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: linear-gradient(180deg, #4b3bd6, #2a1b8e); box-shadow: inset 0 1px 0 rgb(255 255 255 / .35);
}
.tcast::before {
  content: ''; position: absolute; inset: -3px; z-index: -1; border-radius: inherit;
  background: conic-gradient(from var(--spin), #9db9ff, #ff8a2a, #e8b45a, #b085ff, #9db9ff);
  animation: spin 4s linear infinite;
}
.tcast svg { width: 1.4rem; height: 1.4rem; fill: #ffe9a8; filter: drop-shadow(0 0 6px rgb(255 220 120 / .8)); }
.tcast:hover { translate: 0 -2px; filter: brightness(1.12); box-shadow: 0 20px 40px -12px rgb(91 114 255 / 1); }
.tcast:active { translate: 0 1px; }
.tcast[aria-disabled='true'] { cursor: progress; filter: saturate(.7); }
@keyframes spin { to { --spin: 360deg; } }
.notes { min-height: 1.6em; max-width: 34rem; text-align: center; color: var(--red); font-style: italic; text-wrap: balance; }

.hex { display: grid; gap: .35rem; margin-top: 1rem; }
.hex label, .hex__out label { font-variant: small-caps; letter-spacing: .06em; color: var(--red); font-size: 1.08rem; }
.hex label span { font-variant: normal; letter-spacing: 0; color: #6b4a2a; font-size: .95rem; }
.hex input, .hex__out input {
  width: 100%; min-height: 2.9rem; margin-bottom: .55rem; padding: .45rem .7rem; border: 0; border-bottom: 2px solid rgb(43 26 15 / .55);
  background: rgb(255 248 230 / .55); border-radius: 6px 6px 2px 2px; color: #2b1a0f; font-size: 1.15rem;
}
.hex input:focus-visible, .hex__out input:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.hex__make, .hex__actions button {
  min-height: 2.9rem; padding: .45rem 1.2rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--red); color: #fff3e0; font: 400 1.05rem var(--meme); letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 6px 14px -6px rgb(60 10 5 / .7);
}
.hex__make:hover, .hex__actions button:hover { background: #a3271a; }
.hex__out { display: grid; gap: .35rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px dashed rgb(43 26 15 / .35); }
.hex__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.hex__actions a { color: var(--red); font-weight: 400; }
.hex__status { min-height: 1.4em; color: #3f2a18; font-style: italic; }


.tplate { box-shadow: 0 0 0 2px #3c240d, 0 0 0 5px #b8892e, 0 14px 26px rgba(40, 20, 5, .4), 0 0 calc(10px + var(--charge) * 90px) calc(var(--charge) * 18px) rgb(120 150 255 / calc(var(--charge) * .7)); }
.tcast { color: #fff; }
.notes { margin: 0; }
.tstats { display: grid; gap: 4px; margin: 14px 0 16px; }
.tstats div { display: grid; grid-template-columns: 8.2em 1fr; gap: 12px; }
.tstats dt { font: 500 1em "Grenze Gotisch", serif; color: var(--red); }
.tstats dd { margin: 0; }
.slip { margin: 22px 0 8px; padding: 14px 18px; border-radius: 14px; background: rgba(126, 34, 18, .07); border: 1px dashed rgba(124, 34, 18, .4); }
.slip h2 { margin-top: .1em; }
.hex { max-width: 460px; margin-inline: auto; }
@media (max-width: 600px) { .tstats div { grid-template-columns: 1fr; gap: 0; } }
@media (prefers-reduced-motion: reduce) { .tcast::before { animation: none; } .tcast { transition: none; } }
html:not(.js) :is(.controls, .slip) { display: none !important; }
