/* 04's middle card, three options behind ?mid= (js/mid-options.js). No switch = today's cream card. */

/* ---------- 01 Glass: a block of clear acrylic on the lagoon ---------- */
html[data-mid="glass"] .desk__head {
  border-radius: 22px; overflow: hidden; isolation: isolate;
  /* the body: frosted enough that the words read, clear enough that the water shows through, a touch brighter */
  background: linear-gradient(155deg, rgba(255, 255, 255, .46), rgba(236, 252, 250, .26) 48%, rgba(222, 247, 246, .36));
  -webkit-backdrop-filter: blur(9px) saturate(1.3) brightness(1.1); backdrop-filter: blur(9px) saturate(1.3) brightness(1.1);
  /* the edges catch the light: a hard bright line on top, softer down the sides, the thickness tinted at the bottom */
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 1.5px 0 0 rgba(255, 255, 255, .55), inset -1px 0 0 rgba(255, 255, 255, .35),
    inset 0 -1.5px 0 rgba(255, 255, 255, .5), inset 0 -22px 34px -18px rgba(18, 120, 130, .22),
    /* the block's thickness: its side face, catching light, just below and right of the top face */
    2px 4px 0 0 rgba(178, 238, 234, .75), 3px 5px 0 0 rgba(255, 255, 255, .35), 0 1px 2px rgba(10, 60, 66, .14);
}
/* the bevel: a band round the edge where the glass is thickest, bright at the corners that face the sun */
html[data-mid="glass"] .desk__head::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 11px; z-index: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, .3) 16%, rgba(200, 245, 240, .1) 45%,
    rgba(170, 236, 230, .16) 70%, rgba(190, 244, 238, .42) 88%, rgba(255, 255, 255, .75) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* the inner edge of the bevel, one fine bright line */
html[data-mid="glass"] .desk__head::after {
  left: 11px; right: 11px; top: 11px; bottom: 11px; height: auto; background: none; border-radius: 12px; z-index: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42);
}
html[data-mid="glass"] .desk__head > :not(.mg-caust):not(.mg-sheen) { position: relative; z-index: 2; }
/* the water's light rippling through the block: two drifting copies of the lagoon's own caustic lines */
.mg-caust { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; border-radius: inherit; }
.mg-caust i { position: absolute; inset: -30%; background: url(../media/desk/caustic.png) center / 70% auto; opacity: .5;
  will-change: transform; animation: mg-cau-a 13s ease-in-out infinite alternate; }
.mg-caust i + i { opacity: .32; background-size: 95% auto; animation: mg-cau-b 17s ease-in-out infinite alternate; }
@keyframes mg-cau-a { from { transform: translate(-4%, 2%) rotate(-2deg); } to { transform: translate(5%, -3%) rotate(1deg); } }
@keyframes mg-cau-b { from { transform: translate(4%, -2%) scale(1.04); } to { transform: translate(-5%, 3%) scale(1); } }
/* a broad soft highlight across the face, moved by the script as the block rocks */
.mg-sheen { position: absolute; inset: -40% -60%; z-index: 1; pointer-events: none; will-change: transform;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 255, 255, .34) 47%, rgba(255, 255, 255, .1) 52%, transparent 58%); }
html[data-mid="glass"] .desk__head .label { color: rgba(15, 59, 64, .7); }
html[data-mid="glass"] .desk__head .h2 { text-shadow: 0 1px 0 rgba(255, 255, 255, .55); }
html[data-mid="glass"] .desk__hint { text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
/* its shadow on the sand is lighter (glass lets light through), and the light it bends lands in the middle and along
   the far edges (.mg-glint, screen-blended, laid on the shadow by the script) */
html[data-mid="glass"] .dk-csh__s--head { --c: rgb(132, 190, 194); background: radial-gradient(closest-side, rgb(214, 238, 236), var(--c)); }
.mg-glint { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen; opacity: 0; will-change: transform, opacity; }
.mg-glint i { position: absolute; inset: 4%; border-radius: 18px; overflow: hidden;
  box-shadow: inset -14px -16px 22px -12px rgba(255, 252, 226, .7);
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, rgba(0, 0, 0, .35) 85%, transparent);
  mask-image: radial-gradient(closest-side, #000 55%, rgba(0, 0, 0, .35) 85%, transparent); }
.mg-glint i::before { content: ""; position: absolute; inset: -20%; background: url(../media/desk/caustic.png) center / 60% auto; opacity: .75;
  animation: mg-cau-a 9s ease-in-out infinite alternate; }

/* ---------- 02 Airmail: the back of a big airmail postcard ---------- */
html[data-mid="airmail"] .desk__head {
  width: min(550px, 37vw); padding: 32px 30px 28px; text-align: left; border-radius: 2px; top: 48.5%;
  display: grid; grid-template-columns: 1.25fr auto 1fr; column-gap: 24px; align-items: stretch;
  background: #FFFDF8 radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, .9), rgba(246, 238, 222, .35));
}
/* the striped airmail border, coral and ocean blue */
html[data-mid="airmail"] .desk__head::before {
  content: ""; position: absolute; inset: 0; padding: 9px; pointer-events: none;
  background: repeating-linear-gradient(-45deg, #FF5D5D 0 13px, #FFFDF8 13px 19px, #1E8FBF 19px 32px, #FFFDF8 32px 38px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
html[data-mid="airmail"] .desk__head::after { display: none; }
.ma-msg { align-self: center; }
html[data-mid="airmail"] .desk__head .label { margin-bottom: 14px; }
html[data-mid="airmail"] .desk__head .h2 { font-size: clamp(28px, 2.55vw, 44px); line-height: .98; }
.ma-rule { width: 1px; background: rgba(15, 59, 64, .2); margin: 4px 0; }
.ma-side { display: flex; flex-direction: column; justify-content: space-between; min-height: 100%; }
.ma-post { position: relative; align-self: flex-end; width: 80px; height: 94px; margin: -12px -8px 0 0; }
.ma-post .pstamp { inset: 0; --r: 3.4px; }
.ma-post .pstamp__price { font-size: 34px; font-weight: 700; font-style: normal; letter-spacing: -.03em; }
.ma-post .pm { position: absolute; width: 140px; left: -92px; top: 50px; color: var(--ink); }
/* the address lines, the hint written along them */
.ma-to { margin-top: 18px; padding-top: 2px; background: repeating-linear-gradient(to bottom, transparent 0 29px, rgba(15, 59, 64, .22) 29px 30px); }
html[data-mid="airmail"] .ma-to .desk__hint { margin: 0; font-size: 17px; line-height: 30px; transform: rotate(-1.5deg); transform-origin: 0 50%; padding-left: 4px; min-height: 90px; }

/* ---------- 03 Seabed: the words on the bottom, under the water ---------- */
html[data-mid="seabed"] .desk__head { background: none; box-shadow: none; rotate: 0deg; width: min(600px, 40vw); padding: 24px 20px; }
html[data-mid="seabed"] .desk__head::after { display: none; }
html[data-mid="seabed"] .desk__head .h2 { font-size: clamp(40px, 4vw, 70px); line-height: 1.02; }
html[data-mid="seabed"] .desk__head .h2 em { display: block; }   /* one line each */
html[data-mid="seabed"] .desk__head .h2, html[data-mid="seabed"] .desk__head .h2 * { color: transparent !important; -webkit-text-fill-color: transparent; text-shadow: none; background: none; }
html[data-mid="seabed"] .desk__head .label { color: #fff; text-shadow: 0 1px 2px rgba(8, 60, 70, .35), 0 1px 10px rgba(8, 60, 70, .5); display: flex; align-items: center; justify-content: center; gap: 14px; }
html[data-mid="seabed"] .desk__head .label::before, html[data-mid="seabed"] .desk__head .label::after { content: ""; width: 34px; height: 1px; background: rgba(255, 255, 255, .8); }
html[data-mid="seabed"] .desk__hint { color: #fff; text-shadow: 0 1px 10px rgba(8, 60, 70, .5); font-size: 18px; }
/* the bottom the words are drawn on: same place as the headline card, under the water's light and the palm shadows */
.sb-floor { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 0; pointer-events: none; }
.sb-floor canvas { position: absolute; }

@media (max-width: 760px) {
  html[data-mid="glass"] .desk__head { border-radius: 16px; }
  html[data-mid="glass"] .desk__head::before { padding: 7px; }
  html[data-mid="glass"] .desk__head::after { left: 7px; right: 7px; top: 7px; bottom: 7px; border-radius: 9px; }
  html[data-mid="airmail"] .desk__head { width: 84vw; padding: 24px 20px 20px; grid-template-columns: 1fr; row-gap: 0; top: 47%; }
  html[data-mid="airmail"] .desk__head::before { padding: 6px; background-size: auto; }
  html[data-mid="airmail"] .desk__head .label { margin-bottom: 8px; }
  .ma-msg { padding-right: 62px; }   /* the headline wraps before the stamp and its postmark */
  html[data-mid="airmail"] .desk__head .h2 { font-size: 30px; }
  .ma-rule { width: auto; height: 1px; margin: 14px 0 0; }
  .ma-side { display: block; }
  .ma-post { position: absolute; right: 12px; top: 12px; width: 52px; height: 61px; margin: 0; --r: 2.4px; }
  .ma-post .pstamp__price { font-size: 22px; }
  .ma-post .pstamp__top, .ma-post .pstamp__bot { font-size: 6px; }
  .ma-post .pm { width: 84px; left: -30px; top: 62px; }   /* beside the short second line */
  .ma-to { margin-top: 8px; background: repeating-linear-gradient(to bottom, transparent 0 25px, rgba(15, 59, 64, .22) 25px 26px); }
  html[data-mid="airmail"] .ma-to .desk__hint { font-size: 14px; line-height: 26px; min-height: 52px; }
  html[data-mid="seabed"] .desk__head { width: 88vw; }
  html[data-mid="seabed"] .desk__head .h2 { font-size: 38px; }
  html[data-mid="seabed"] .desk__hint { font-size: 14px; }
  .sb-floor { top: 47%; }
}
@media (prefers-reduced-motion: reduce) { .mg-caust i, .mg-glint i::before { animation: none; } }
