/* Each paper surface owns its silhouette. The invitation itself stays unmasked:
   its moving clip, flip, selectable text and open calendar menus keep working. */
:root {
  --stationery-radius: 3px;
  --stationery-clip: none;
  --stationery-mask: none;
  --stationery-cap: 142px;
  --stationery-point: 108px;
  --stationery-heart-lobe: 66px;
  --stationery-notch: 18px;
  --stationery-scallop: 11px;
  --stationery-texture: linear-gradient(120deg, #fff0, #fff0);
  --stationery-texture-size: auto;
  --stationery-wash: linear-gradient(120deg, #fff0, #fff0);
  --stationery-ornament-color: var(--paper-accent);
  --stationery-sample-icon: '♡';
}

.stationery-card-art { display: none; position: absolute; inset: 0; pointer-events: none; user-select: none; }
html[data-card-shape] .card-face { background: transparent; border-radius: 0; box-shadow: none; }
html[data-card-shape] .stationery-card-art { display: block; filter: drop-shadow(0 18px 24px color-mix(in srgb, var(--night) 30%, transparent)); }
.stationery-card-silhouette, .stationery-card-sample::before {
  position: absolute; inset: 0;
  background-color: var(--paper);
  background-image: var(--stationery-texture), var(--stationery-wash);
  background-size: var(--stationery-texture-size), 100% 100%, 100% 100%, 100% 100%;
  border-radius: var(--stationery-radius);
  clip-path: var(--stationery-clip);
  -webkit-mask: var(--stationery-mask);
  mask: var(--stationery-mask);
}
html[data-card-shape] .card-content { position: relative; z-index: 1; }
html[data-card-shape] .card-border { z-index: 2; border-radius: var(--stationery-radius); }
.stationery-card-finish { position: absolute; inset: 20px; border: 1px solid transparent; border-radius: inherit; }
.stationery-card-ornaments { display: none; position: absolute; inset: 0; color: var(--stationery-ornament-color); }
.stationery-art-corner { position: absolute; width: clamp(86px, 19%, 126px); height: auto; opacity: .55; }
.stationery-art-corner--nw { top: 17px; left: 17px; }
.stationery-art-corner--ne { top: 17px; right: 17px; transform: scaleX(-1); }
.stationery-art-corner--sw { bottom: 17px; left: 17px; transform: scaleY(-1); }
.stationery-art-corner--se { bottom: 17px; right: 17px; transform: scale(-1); }
.stationery-art-topper { position: absolute; width: 64px; height: 39px; top: 19px; left: calc(50% - 32px); opacity: .7; }

/* Paper stocks: the grains use small, deliberately quiet patterns so copy and
   custom text colours remain as clear as on the original stationery. */
:is(html, .stationery-card-sample)[data-card-texture="smooth"] {
  --stationery-texture: linear-gradient(115deg, color-mix(in srgb, var(--paper) 95%, white), transparent 55%);
  --stationery-texture-size: 100% 100%;
}
:is(html, .stationery-card-sample)[data-card-texture="cotton"] {
  --stationery-texture: radial-gradient(ellipse at 20% 25%, color-mix(in srgb, var(--paper-accent) 13%, transparent) .45px, transparent .9px), radial-gradient(ellipse at 65% 70%, #ffffff80 .45px, transparent .95px);
  --stationery-texture-size: 5px 7px, 7px 5px;
}
:is(html, .stationery-card-sample)[data-card-texture="linen"] {
  --stationery-texture: repeating-linear-gradient(0deg, color-mix(in srgb, var(--paper-accent) 9%, transparent) 0 .6px, transparent .6px 3px), repeating-linear-gradient(90deg, color-mix(in srgb, var(--paper-accent) 8%, transparent) 0 .6px, transparent .6px 3px);
  --stationery-texture-size: 3px 3px, 3px 3px;
}
:is(html, .stationery-card-sample)[data-card-texture="handmade"] {
  --stationery-texture: radial-gradient(ellipse at 24% 29%, color-mix(in srgb, var(--paper-accent) 12%, transparent) .6px, transparent 1.5px), radial-gradient(ellipse at 71% 64%, #ffffff80 .8px, transparent 2px), repeating-linear-gradient(108deg, transparent 0 17px, color-mix(in srgb, var(--paper-accent) 5%, transparent) 18px, transparent 19px 31px);
  --stationery-texture-size: 17px 23px, 21px 13px, 100% 100%;
}
:is(html, .stationery-card-sample)[data-card-texture="parchment"] {
  --stationery-texture: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--paper-accent) 13%, transparent), transparent 46%), radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--paper-accent) 12%, transparent), transparent 44%), radial-gradient(ellipse at 30% 70%, color-mix(in srgb, var(--paper-accent) 9%, transparent) .5px, transparent 1px);
  --stationery-texture-size: 100% 100%, 100% 100%, 5px 8px;
}
:is(html, .stationery-card-sample)[data-card-texture="marble"] {
  --stationery-texture: repeating-linear-gradient(128deg, transparent 0 78px, color-mix(in srgb, var(--paper-accent) 10%, transparent) 79px, transparent 80px 84px, color-mix(in srgb, var(--paper-accent) 5%, transparent) 86px, transparent 90px 176px), repeating-linear-gradient(48deg, transparent 0 131px, color-mix(in srgb, var(--gold) 16%, transparent) 132px, transparent 133px 268px), radial-gradient(ellipse at 20% 65%, #ffffff55, transparent 60%);
  --stationery-texture-size: 100% 100%, 100% 100%, 100% 100%;
}

/* Die cuts. Heart and star cut only the backing, never the live content. The
   straight central section grows naturally when the invitation gets longer. */
:is(html, .stationery-card-sample)[data-card-shape="rectangle"] { --stationery-radius: 3px; --stationery-clip: none; --stationery-mask: none; }
:is(html, .stationery-card-sample)[data-card-shape="rounded"] { --stationery-radius: 32px; --stationery-clip: none; --stationery-mask: none; }
:is(html, .stationery-card-sample)[data-card-shape="arch"] { --stationery-radius: 50% 50% 3px 3px / var(--stationery-cap) var(--stationery-cap) 3px 3px; --stationery-clip: none; --stationery-mask: none; }
:is(html, .stationery-card-sample)[data-card-shape="oval"] { --stationery-radius: 50% / var(--stationery-cap); --stationery-clip: none; --stationery-mask: none; }
:is(html, .stationery-card-sample)[data-card-shape="heart"] {
  --stationery-radius: 0px;
  --stationery-mask: none;
  --stationery-clip: polygon(0 var(--stationery-heart-lobe), 2% calc(var(--stationery-heart-lobe) * .55), 8% calc(var(--stationery-heart-lobe) * .18), 18% 0, 30% 0, 41% calc(var(--stationery-heart-lobe) * .22), 50% calc(var(--stationery-heart-lobe) * .7), 59% calc(var(--stationery-heart-lobe) * .22), 70% 0, 82% 0, 92% calc(var(--stationery-heart-lobe) * .18), 98% calc(var(--stationery-heart-lobe) * .55), 100% var(--stationery-heart-lobe), 100% calc(100% - var(--stationery-point)), 95% calc(100% - var(--stationery-point) * .66), 83% calc(100% - var(--stationery-point) * .38), 50% 100%, 17% calc(100% - var(--stationery-point) * .38), 5% calc(100% - var(--stationery-point) * .66), 0 calc(100% - var(--stationery-point)));
}
:is(html, .stationery-card-sample)[data-card-shape="star"] {
  --stationery-radius: 0px;
  --stationery-mask: none;
  --stationery-clip: polygon(50% 0, 63% calc(var(--stationery-point) * .62), 88% calc(var(--stationery-point) * .24), 88% var(--stationery-point), 100% calc(var(--stationery-point) * 1.13), 95% 50%, 100% calc(100% - var(--stationery-point) * 1.13), 88% calc(100% - var(--stationery-point)), 88% calc(100% - var(--stationery-point) * .24), 63% calc(100% - var(--stationery-point) * .62), 50% 100%, 37% calc(100% - var(--stationery-point) * .62), 12% calc(100% - var(--stationery-point) * .24), 12% calc(100% - var(--stationery-point)), 0 calc(100% - var(--stationery-point) * 1.13), 5% 50%, 0 calc(var(--stationery-point) * 1.13), 12% var(--stationery-point), 12% calc(var(--stationery-point) * .24), 37% calc(var(--stationery-point) * .62));
}
:is(html, .stationery-card-sample)[data-card-shape="ticket"] {
  --stationery-radius: 12px;
  --stationery-clip: none;
  --stationery-mask: radial-gradient(circle var(--stationery-notch) at 0 30%, transparent 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--stationery-notch) at 100% 30%, transparent 98%, #000) right / 51% 100% no-repeat;
}
:is(html, .stationery-card-sample)[data-card-shape="scalloped"] {
  --stationery-radius: 0px;
  --stationery-clip: none;
  --stationery-mask: radial-gradient(circle var(--stationery-scallop), #000 98%, transparent) calc(var(--stationery-scallop) * -1) calc(var(--stationery-scallop) * -1) / calc(var(--stationery-scallop) * 2) calc(var(--stationery-scallop) * 2), linear-gradient(#000 0 0) center / calc(100% - var(--stationery-scallop) * 2) calc(100% - var(--stationery-scallop) * 2) no-repeat;
}
html[data-card-shape="rounded"] .card-border { border-radius: 23px; }
html[data-card-shape="arch"] .card-content { padding-top: 100px; }
html[data-card-shape="arch"] .card-back-content { padding-top: 109px; }
html[data-card-shape="arch"] .card-border { border-radius: 50% 50% 0 0 / calc(var(--stationery-cap) - 12px) calc(var(--stationery-cap) - 12px) 0 0; }
html[data-card-shape="oval"] .card-content { padding: 107px 68px 91px; }
html[data-card-shape="oval"] .card-back-content { padding-top: 113px; padding-bottom: 109px; }
html[data-card-shape="oval"] .card-border { border-radius: 50% / calc(var(--stationery-cap) - 12px); }
html[data-card-shape="heart"] .card-content { padding-top: 91px; padding-bottom: 125px; }
html[data-card-shape="star"] .card-content { padding: 137px 63px 134px; }
html:is([data-card-shape="heart"], [data-card-shape="star"]) .card-border { border: 0; border-radius: 0; }
html:is([data-card-shape="heart"], [data-card-shape="star"]) .stationery-card-finish { border: 0; }
html[data-card-shape="heart"] .stationery-art-topper { top: 57px; width: 50px; height: 30px; left: calc(50% - 25px); }
html[data-card-shape="heart"] .stationery-art-corner--nw, html[data-card-shape="heart"] .stationery-art-corner--ne { top: 29px; }
html[data-card-shape="heart"] .stationery-art-corner--sw, html[data-card-shape="heart"] .stationery-art-corner--se { bottom: 108px; }
html[data-card-shape="star"] .stationery-art-topper { top: 72px; }
html[data-card-shape="star"] .stationery-art-corner--nw, html[data-card-shape="star"] .stationery-art-corner--ne { top: 129px; width: 90px; }
html[data-card-shape="star"] .stationery-art-corner--sw, html[data-card-shape="star"] .stationery-art-corner--se { bottom: 129px; width: 90px; }
html[data-card-shape="ticket"] .card-border { inset: 13px 26px; border-radius: 3px; border-top-style: dashed; border-bottom-style: dashed; }
html[data-card-shape="scalloped"] .card-border { inset: 19px; border-radius: 2px; }
html:is([data-card-shape="arch"], [data-card-shape="oval"]) .stationery-art-corner--nw, html:is([data-card-shape="arch"], [data-card-shape="oval"]) .stationery-art-corner--ne { top: 104px; width: 90px; }
html[data-card-shape="oval"] .stationery-art-corner--sw, html[data-card-shape="oval"] .stationery-art-corner--se { bottom: 104px; width: 90px; }
html:is([data-card-shape="heart"], [data-card-shape="star"], [data-card-shape="oval"]) .letter-flourish { bottom: 104px; }

/* Special editions share the selected stock, palette and cut. */
:is(html, .stationery-card-sample)[data-card-design="minimal"] { --stationery-wash: linear-gradient(120deg, #fff0, #fff0); --stationery-sample-icon: '♡'; }
:is(html, .stationery-card-sample)[data-card-design="botanical"] {
  --stationery-wash: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--paper-accent) 10%, transparent), transparent 39%), radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--paper-accent) 9%, transparent), transparent 37%);
  --stationery-ornament-color: color-mix(in srgb, var(--paper-accent) 76%, #4e6749);
  --stationery-sample-icon: '❦';
}
:is(html, .stationery-card-sample)[data-card-design="celestial"] {
  --stationery-wash: radial-gradient(ellipse at 50% 0, color-mix(in srgb, var(--paper-accent) 11%, transparent), transparent 47%), radial-gradient(ellipse at 0 100%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 34%);
  --stationery-ornament-color: var(--paper-accent);
  --stationery-sample-icon: '☾';
}
:is(html, .stationery-card-sample)[data-card-design="art-deco"] {
  --stationery-wash: conic-gradient(from 140deg at 50% 0, transparent 0deg 11deg, color-mix(in srgb, var(--paper-accent) 5%, transparent) 11deg 22deg, transparent 22deg 37deg, color-mix(in srgb, var(--paper-accent) 5%, transparent) 37deg 48deg, transparent 48deg 360deg);
  --stationery-ornament-color: var(--paper-accent);
  --stationery-sample-icon: '◇';
}
:is(html, .stationery-card-sample)[data-card-design="royal"] {
  --stationery-wash: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--gold) 19%, transparent), transparent 44%), radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--paper-accent) 10%, transparent), transparent 41%);
  --stationery-ornament-color: color-mix(in srgb, var(--paper-accent) 86%, var(--gold));
  --stationery-sample-icon: '♔';
}
:is(html, .stationery-card-sample)[data-card-design="enchanted"] {
  --stationery-wash: radial-gradient(ellipse at 0 0, color-mix(in srgb, var(--paper-accent) 12%, transparent), transparent 32%), radial-gradient(ellipse at 100% 100%, color-mix(in srgb, var(--paper-accent) 12%, transparent), transparent 32%), radial-gradient(ellipse at 100% 0, color-mix(in srgb, var(--gold) 14%, transparent), transparent 38%);
  --stationery-ornament-color: var(--paper-accent);
  --stationery-sample-icon: '✧';
}
html[data-card-design="botanical"] [data-stationery-ornament="botanical"],
html[data-card-design="celestial"] [data-stationery-ornament="celestial"],
html[data-card-design="art-deco"] [data-stationery-ornament="art-deco"],
html[data-card-design="royal"] [data-stationery-ornament="royal"],
html[data-card-design="enchanted"] [data-stationery-ornament="enchanted"] { display: block; }
html[data-card-design="botanical"] .card-border { border-color: color-mix(in srgb, var(--stationery-ornament-color) 34%, transparent); }
html[data-card-design="celestial"] .card-border { outline: 1px solid color-mix(in srgb, var(--paper-accent) 19%, transparent); outline-offset: -7px; }
html[data-card-design="art-deco"] .card-border { border-width: 2px; border-color: color-mix(in srgb, var(--paper-accent) 56%, transparent); }
html[data-card-design="art-deco"] .stationery-card-finish { border-color: color-mix(in srgb, var(--paper-accent) 25%, transparent); }
html[data-card-design="royal"] .card-border { border: 3px double color-mix(in srgb, var(--paper-accent) 57%, transparent); outline: 1px solid color-mix(in srgb, var(--paper-accent) 20%, transparent); outline-offset: -10px; }
html[data-card-design="royal"] .stationery-art-corner { opacity: .75; }
html[data-card-design="enchanted"] .card-border { border-color: color-mix(in srgb, var(--paper-accent) 28%, transparent); }
html[data-card-design="enchanted"] .stationery-card-finish { inset: 26px; border: 1px dotted color-mix(in srgb, var(--paper-accent) 24%, transparent); }
html:is([data-card-design="royal"], [data-card-design="art-deco"], [data-card-design="enchanted"], [data-card-design="celestial"]):is([data-card-shape="heart"], [data-card-shape="star"]) .card-border { border: 0; outline: 0; }
html:is([data-card-design="art-deco"], [data-card-design="enchanted"]):is([data-card-shape="heart"], [data-card-shape="star"]) .stationery-card-finish { border: 0; }
html:not([data-card-design="minimal"])[data-card-shape="rectangle"] .card-content,
html:not([data-card-design="minimal"])[data-card-shape="rounded"] .card-content,
html:not([data-card-design="minimal"])[data-card-shape="ticket"] .card-content,
html:not([data-card-design="minimal"])[data-card-shape="scalloped"] .card-content { padding-top: 70px; padding-bottom: 45px; }
html:not([data-card-design="minimal"])[data-card-shape="rectangle"] .card-back-content,
html:not([data-card-design="minimal"])[data-card-shape="rounded"] .card-back-content,
html:not([data-card-design="minimal"])[data-card-shape="ticket"] .card-back-content,
html:not([data-card-design="minimal"])[data-card-shape="scalloped"] .card-back-content { padding-top: 75px; }

/* Tiny stock/cut/edition previews work with data attributes on the sample
   itself, and need no added SVG or copied invitation markup. */
.stationery-card-sample {
  /* Compare one choice at a time. Full-size inherited shape coordinates would
     otherwise overwhelm a tiny stock or collection preview. */
  --stationery-radius: 3px; --stationery-clip: none; --stationery-mask: none;
  --stationery-texture: linear-gradient(115deg, color-mix(in srgb, var(--paper) 95%, white), transparent 55%);
  --stationery-texture-size: 100% 100%;
  --stationery-wash: linear-gradient(120deg, #fff0, #fff0);
  --stationery-ornament-color: var(--paper-accent); --stationery-sample-icon: '♡';
  --stationery-cap: 21px; --stationery-point: 14px; --stationery-heart-lobe: 14px;
  --stationery-notch: 6px; --stationery-scallop: 3px;
  display: block; position: relative; width: 59px; height: 75px; margin: 3px auto 8px;
  color: var(--paper-accent); filter: drop-shadow(0 3px 3px #0002);
}
.stationery-card-sample::before { content: ''; border: 1px solid color-mix(in srgb, var(--paper-accent) 22%, transparent); }
.stationery-card-sample::after {
  content: var(--stationery-sample-icon); position: absolute; inset: 12px 8px;
  display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--paper-accent) 28%, transparent);
  border-radius: min(12px, var(--stationery-cap));
  font: 25px/1 Georgia, serif; color: var(--stationery-ornament-color); opacity: .8;
  background: linear-gradient(currentColor, currentColor) center calc(100% - 7px) / 18px 1px no-repeat;
}
.stationery-card-sample[data-card-shape="rounded"] { --stationery-radius: 12px; }
.stationery-card-sample[data-card-shape="oval"]::after { border-radius: 50%; inset: 14px 9px; }
.stationery-card-sample[data-card-shape="arch"]::after { border-radius: 50% 50% 0 0 / 13px 13px 0 0; }
.stationery-card-sample:is([data-card-shape="heart"], [data-card-shape="star"])::after { border: 0; inset: 17px 9px; }
.stationery-card-sample[data-card-design="art-deco"]::after { border-radius: 0; border-width: 2px 1px; outline: 1px solid color-mix(in srgb, var(--paper-accent) 20%, transparent); outline-offset: -4px; }
.stationery-card-sample[data-card-design="royal"]::after { border: 3px double color-mix(in srgb, var(--paper-accent) 55%, transparent); border-radius: 3px; }
.stationery-card-sample[data-card-design="enchanted"]::after { border-style: dotted; border-radius: 50% 50% 3px 3px / 20px 20px 3px 3px; }
.stationery-card-sample[data-card-design="botanical"]::after { border-radius: 50% 0 50% 0 / 12px 0 12px 0; }
.stationery-card-sample[data-card-texture="marble"] { --stationery-texture-size: 28% 28%, 31% 31%, 100% 100%; }

@media (max-width: 600px) {
  :root { --stationery-cap: 94px; --stationery-point: 80px; --stationery-heart-lobe: 50px; --stationery-notch: 13px; --stationery-scallop: 8px; }
  html[data-card-shape] .card-content { overflow-wrap: anywhere; }
  html[data-card-shape="rounded"] .card-content { padding-inline: 25px; }
  html[data-card-shape="arch"] .card-content { padding-top: 81px; }
  html[data-card-shape="oval"] .card-content { padding: 82px 27px 78px; }
  html[data-card-shape="heart"] .card-content { padding: 73px 25px 102px; }
  html[data-card-shape="star"] .card-content { padding: 105px 32px 105px; }
  html[data-card-shape="scalloped"] .card-content { padding-inline: 29px; }
  html[data-card-shape="ticket"] .card-border { inset-inline: 19px; }
  html[data-card-shape="scalloped"] .card-border { inset: 14px; }
  html[data-card-shape="heart"] .stationery-art-topper { top: 40px; width: 43px; left: calc(50% - 21.5px); height: 26px; }
  html[data-card-shape="star"] .stationery-art-topper { top: 55px; width: 51px; left: calc(50% - 25.5px); height: 31px; }
  .stationery-art-corner { width: 76px; opacity: .4; }
  .stationery-art-corner--nw, .stationery-art-corner--ne { top: 14px; }
  .stationery-art-corner--sw, .stationery-art-corner--se { bottom: 14px; }
  .stationery-art-corner--nw, .stationery-art-corner--sw { left: 12px; }
  .stationery-art-corner--ne, .stationery-art-corner--se { right: 12px; }
  html:is([data-card-shape="arch"], [data-card-shape="oval"]) .stationery-art-corner--nw, html:is([data-card-shape="arch"], [data-card-shape="oval"]) .stationery-art-corner--ne { top: 75px; width: 65px; }
  html[data-card-shape="oval"] .stationery-art-corner--sw, html[data-card-shape="oval"] .stationery-art-corner--se { bottom: 75px; width: 65px; }
  html[data-card-shape="heart"] .stationery-art-corner--sw, html[data-card-shape="heart"] .stationery-art-corner--se { bottom: 89px; width: 65px; }
  html[data-card-shape="star"] .stationery-art-corner--nw, html[data-card-shape="star"] .stationery-art-corner--ne { top: 100px; width: 58px; }
  html[data-card-shape="star"] .stationery-art-corner--sw, html[data-card-shape="star"] .stationery-art-corner--se { bottom: 100px; width: 58px; }
  html:not([data-card-design="minimal"]):is([data-card-shape="rectangle"], [data-card-shape="rounded"], [data-card-shape="ticket"], [data-card-shape="scalloped"]) .card-content { padding-top: 65px; padding-bottom: 39px; }
  html:is([data-card-shape="heart"], [data-card-shape="star"], [data-card-shape="oval"]) .card-tools { justify-content: center; }
  html:is([data-card-shape="heart"], [data-card-shape="star"], [data-card-shape="oval"]) .bookmark-menu { margin-left: 0; }
  html:is([data-card-shape="heart"], [data-card-shape="star"]) .back-heading { grid-template-columns: minmax(0, 1fr); }
  html:is([data-card-shape="heart"], [data-card-shape="star"]) .note-emblem { display: none; }
  html:is([data-card-shape="heart"], [data-card-shape="star"]) .back-toolbar { flex-wrap: wrap; }
  html:is([data-card-shape="heart"], [data-card-shape="star"]) .back-edition { max-width: none; }
  html[data-card-shape] .domain { white-space: normal; }
}
@media (forced-colors: active) {
  html[data-card-shape] .card-face { border: 1px solid CanvasText; background: Canvas; color: CanvasText; }
  .stationery-card-art { display: none !important; }
  .stationery-card-sample::before { background: Canvas; border-color: CanvasText; }
  .stationery-card-sample::after { color: CanvasText; }
}
