/* Birthday Card Studio — stationery-shop display.
   Lilac linen table, cards leaning on their own lined envelopes, Bodoni headlines, Jost for the controls. */
@font-face { font-family: "Jost"; font-weight: 400; font-display: swap; src: url("/fonts/jost-400.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-weight: 500; font-display: swap; src: url("/fonts/jost-500.woff2") format("woff2"); }
@font-face { font-family: "Bodoni Moda"; font-weight: 400; font-display: swap; src: url("/fonts/bodoni-moda-400.woff2") format("woff2"); }
@font-face { font-family: "Bodoni Moda"; font-weight: 400; font-style: italic; font-display: swap; src: url("/fonts/bodoni-moda-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Bodoni Moda"; font-weight: 500; font-display: swap; src: url("/fonts/bodoni-moda-500.woff2") format("woff2"); }
@font-face { font-family: "Mrs Saint Delafield"; font-weight: 400; font-display: swap; src: url("/fonts/mrs-saint-delafield-400.woff2") format("woff2"); }
:root {
  --linen: #ece6ee; --linen-2: #e3dbe6; --paper: #fbf9fa; --paper-2: #f4f0f5;
  --ink: #241731; --ink-2: #463a55; --muted: #6f6180; --hair: rgba(36,23,49,.12); --hair-2: rgba(36,23,49,.22);
  --ribbon: #d93a68; --ribbon-d: #b72552; --foil: #b78c38;
  --display: "Bodoni Moda", "Didot", Georgia, serif; --script: "Mrs Saint Delafield", "Snell Roundhand", cursive;
  --ui: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); font: 400 16px/1.55 var(--ui); background: var(--linen);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .09 0 0 0 0 .19 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ribbon); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.msrx-bar { background: var(--ink); color: #d9cfe2; font-size: .76rem; letter-spacing: .02em; }
.msrx-bar > div { max-width: 1240px; margin: 0 auto; padding: 7px 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.msrx-bar a { color: #fff; text-decoration: none; font-weight: 500; }

header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 18px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; }
.brand b { display: block; font: 500 1.15rem/1.1 var(--display); letter-spacing: .005em; }
.brand small { display: block; font-size: .64rem; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
header nav { display: flex; gap: 22px; font-size: .88rem; }
header nav a { text-decoration: none; color: var(--ink-2); border-bottom: 1px solid transparent; padding-bottom: 2px; }
header nav a:hover { border-bottom-color: var(--ink-2); }

/* ---------- Hero: the headline is the input ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 34px 0 30px; }
.eyebrow { font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
.eyebrow b { color: var(--foil); font-weight: 600; }
.hero h1 { margin: 0; font: 400 clamp(2.6rem, 6.2vw, 5rem)/.98 var(--display); letter-spacing: -.015em; }
.hero h1 i { font-style: italic; }
.name-line { position: relative; display: block; margin: -2px 0 0; }
.name-line input[type=text] { width: 100%; border: 0; border-radius: 0; background: none; outline: none; box-shadow: none; padding: 0 0 4px; color: var(--ribbon);
  font: 400 clamp(3.6rem, 9vw, 7.4rem)/1.2 var(--script); border-bottom: 1.5px solid var(--hair-2); }
.name-line input[type=text]::placeholder { color: rgba(217,58,104,.32); }
.name-line input[type=text]:focus { box-shadow: none; border-bottom-color: var(--ribbon); }
.name-line .hint { position: absolute; right: 0; bottom: 12px; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.hero .lede { max-width: 470px; color: var(--ink-2); margin: 18px 0 22px; font-size: 1.02rem; }
.hero .lede b { font-weight: 500; color: var(--ink); }
.hero-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.from { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; background: var(--paper); border: 1px solid var(--hair); border-radius: 999px; min-width: 220px; }
.from span { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.from input[type=text] { border: 0; background: none; outline: none; box-shadow: none; padding: 0; font-size: .98rem; min-width: 0; flex: 1; }
.hero .privacy { font-size: .78rem; color: var(--muted); margin-top: 12px; }
.hero-photos { display: flex; gap: 6px; align-items: center; }
.hero-photos img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--paper); box-shadow: 0 2px 6px rgba(36,23,49,.2); }

/* The fan of live cards */
.fan { position: relative; height: min(560px, 46vw); }
.fan .tile { position: absolute; width: 46%; }
.fan .tile:nth-child(1) { left: 0; top: 12%; transform: rotate(-9deg); }
.fan .tile:nth-child(2) { left: 27%; top: 0; z-index: 2; transform: rotate(1deg); }
.fan .tile:nth-child(3) { right: 0; top: 14%; transform: rotate(9deg); z-index: 1; }
.fan .tile .cap, .fan .tile .photo-tag { display: none !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--hair-2);
  background: var(--paper); color: var(--ink); cursor: pointer; font-weight: 500; font-size: .92rem; text-decoration: none; white-space: nowrap; transition: background .15s, transform .15s, box-shadow .15s; }
.btn:hover { background: #fff; box-shadow: 0 4px 14px rgba(36,23,49,.08); }
.btn.primary { background: var(--ribbon); border-color: var(--ribbon); color: #fff; }
.btn.primary:hover { background: var(--ribbon-d); }
.btn.ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.wa { background: #1c8a52; border-color: #1c8a52; color: #fff; }
.btn.sm { height: 36px; padding: 0 14px; font-size: .82rem; }
.btn svg { flex: none; }

/* ---------- Rail ---------- */
.rail { position: sticky; top: 0; z-index: 6; background: rgba(236,230,238,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--hair); }
.rail .wrap { display: flex; gap: 16px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.search { flex: none; width: 260px; display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--hair); }
.search input { flex: 1; border: 0; background: none; outline: none; min-width: 0; font-size: .92rem; }
.search svg { opacity: .55; flex: none; }
.chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 15px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; font-size: .86rem; color: var(--ink-2); white-space: nowrap; }
.chip:hover { border-color: var(--hair-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- Gallery ---------- */
.cat-head { display: flex; align-items: baseline; gap: 16px; margin: 46px 0 18px; }
.cat-head h2 { margin: 0; font: 400 1.9rem/1.1 var(--display); }
.cat-head h2 i { font-style: italic; }
.cat-head .rule { flex: 1; height: 1px; background: var(--hair); transform: translateY(-6px); }
.cat-head span { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 34px 26px; }

/* A tile: envelope behind, card in front. */
.tile { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; color: inherit; }
.tile .table, .tile .env, .tile .card, .tile .cap { display: block; }
.tile .table { position: relative; aspect-ratio: 1 / 1.08; }
.tile .env { position: absolute; left: 16%; right: 2%; top: 22%; bottom: 6%; border-radius: 6px; background: var(--env, #f3e7ea);
  box-shadow: 0 14px 28px -12px rgba(36,23,49,.35), inset 0 0 0 1px rgba(255,255,255,.35); transform: rotate(7deg); transition: transform .35s cubic-bezier(.2,.9,.3,1.2); overflow: hidden; }
.tile .env::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 58%; background: var(--liner, #d93a68);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.28) 0 6px, transparent 6px 14px); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.tile .env::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.35), transparent 45%), linear-gradient(to top left, transparent 49.6%, rgba(36,23,49,.08) 50%, transparent 50.6%), linear-gradient(to top right, transparent 49.6%, rgba(36,23,49,.08) 50%, transparent 50.6%); }
.tile .card { position: absolute; left: 4%; top: 2%; width: 66%; aspect-ratio: 4 / 5; border-radius: 4px; overflow: hidden; background: var(--paper-2);
  box-shadow: 0 1px 1px rgba(36,23,49,.12), 0 18px 36px -14px rgba(36,23,49,.55); transform: rotate(-2.5deg); transition: transform .35s cubic-bezier(.2,.9,.3,1.2), box-shadow .35s; }
.tile canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .45s; }
.tile canvas.on { opacity: 1; }
.tile .card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.18), transparent 38%); pointer-events: none; }
.tile:hover .card, .tile:focus-visible .card { transform: rotate(0deg) translateY(-8px); box-shadow: 0 1px 1px rgba(36,23,49,.12), 0 28px 44px -16px rgba(36,23,49,.6); }
.tile:hover .env, .tile:focus-visible .env { transform: rotate(10deg) translateX(4%); }
.tile .cap { display: flex !important; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 2px 0; }
.tile .cap b { font: 400 1.06rem/1.2 var(--display); }
.tile .cap small { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tile .photo-tag { position: absolute; right: 6%; bottom: 10%; z-index: 2; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; background: var(--paper); color: var(--ink-2); padding: 5px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(36,23,49,.15); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); font-size: 1.05rem; }

footer { margin-top: 80px; border-top: 1px solid var(--hair); padding: 26px 0 44px; color: var(--muted); font-size: .84rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
footer .by { display: flex; align-items: center; gap: 10px; }
footer .by img { width: 26px; height: 26px; border-radius: 7px; }
footer a { color: var(--ink-2); }
footer .tag { font-size: .66rem; letter-spacing: .24em; text-transform: uppercase; }

/* ---------- Studio ---------- */
.studio { position: fixed; inset: 0; z-index: 50; background: var(--linen); display: none; flex-direction: column; }
.studio.open { display: flex; }
body.lock { overflow: hidden; }
.s-top { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: var(--paper); border-bottom: 1px solid var(--hair); }
.s-top .back { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--hair-2); background: none; cursor: pointer; font-size: .88rem; }
.s-top .mini-logo { width: 26px; height: 26px; border-radius: 7px; }
.s-top .title { flex: 1; min-width: 0; }
.s-top .title b { display: block; font: 400 1.15rem/1.15 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-top .title small { font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--hair-2); background: none; cursor: pointer; }
.icon-btn:hover { background: var(--paper-2); }
.s-top .nav { display: flex; gap: 6px; }
.s-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 430px; }
.stage { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; position: relative; }
.stage .frame { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
#preview { display: block; max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 2px 2px rgba(36,23,49,.12), 0 40px 70px -24px rgba(36,23,49,.55); touch-action: none; background: var(--paper-2); }
#preview.can-drag { cursor: grab; } #preview.dragging { cursor: grabbing; }
.stage .busy { position: absolute; top: 8px; right: 8px; font-size: .72rem; color: var(--muted); opacity: 0; transition: .2s; }
.stage .busy.on { opacity: 1; }
.strip { flex: none; display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding: 4px 2px; }
.strip button { flex: none; width: 48px; aspect-ratio: 4/5; border-radius: 4px; overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; background: var(--paper-2); box-shadow: 0 2px 6px rgba(36,23,49,.15); }
.strip button[aria-current="true"] { border-color: var(--ribbon); }
.strip canvas { width: 100%; height: 100%; display: block; }
.quick { flex: none; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.panel { min-height: 0; display: flex; flex-direction: column; background: var(--paper); border-left: 1px solid var(--hair); }
.tabs { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--hair); }
.tabs button { height: 52px; border: 0; background: none; cursor: pointer; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ribbon); }
.pane { flex: 1; overflow-y: auto; padding: 20px 20px 44px; display: none; }
.pane.on { display: block; }
.field { margin-bottom: 20px; }
.field > label, .field > .lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.field > label small, .field > .lbl small { text-transform: none; letter-spacing: 0; font-size: .76rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row.r3 { grid-template-columns: 116px 1fr; }
input[type=text], input[type=number], select, textarea { width: 100%; border-radius: 10px; border: 1px solid var(--hair-2); background: #fff; padding: 11px 12px; font-size: .96rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(36,23,49,.08); }
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--hair-2); background: #fff; cursor: pointer; font-size: .82rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ideas { margin-top: 10px; border: 1px solid var(--hair); border-radius: 12px; overflow: hidden; background: #fff; }
.ideas .groups { display: flex; gap: 6px; overflow-x: auto; padding: 10px; border-bottom: 1px solid var(--hair); scrollbar-width: thin; }
.ideas .groups button { flex: none; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hair); background: none; cursor: pointer; font-size: .78rem; }
.ideas .groups button[aria-pressed="true"] { background: var(--ribbon); border-color: var(--ribbon); color: #fff; }
.ideas ul { list-style: none; margin: 0; padding: 6px; max-height: 260px; overflow-y: auto; }
.ideas li button { width: 100%; text-align: left; background: none; border: 0; padding: 10px; border-radius: 8px; cursor: pointer; font-size: .9rem; line-height: 1.45; }
.ideas li button:hover { background: var(--paper-2); }
.fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 248px; overflow-y: auto; padding: 2px; }
.fonts button { height: 56px; border-radius: 10px; border: 1px solid var(--hair); background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px; overflow: hidden; }
.fonts button span { font-size: 1.15rem; line-height: 1.1; white-space: nowrap; }
.fonts button small { font: 400 .6rem/1.2 var(--ui); color: var(--muted); white-space: nowrap; }
.fonts button[aria-pressed="true"] { border-color: var(--ribbon); box-shadow: inset 0 0 0 1px var(--ribbon); }
.swatches { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--hair-2); cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { outline: 2px solid var(--ribbon); outline-offset: 2px; }
.swatches .def { width: auto; padding: 0 12px; border-radius: 999px; font-size: .74rem; background: #fff; }
.swatches input[type=color] { width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--ribbon); }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos .ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--paper-2); }
.photos .ph[aria-pressed="true"] { border-color: var(--ribbon); }
.photos .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .ph .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(36,23,49,.75); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.photos .add { aspect-ratio: 1; border-radius: 10px; border: 1.5px dashed var(--hair-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--muted); font-size: .8rem; background: #fff; }
.photos .add:hover { border-color: var(--ribbon); color: var(--ink); }
.photos .add b { font: 400 1.8rem/1 var(--display); color: var(--ribbon); }
.save-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.save-grid .btn { width: 100%; }
.note { font-size: .82rem; color: var(--ink-2); background: var(--paper-2); border: 1px solid var(--hair); padding: 12px 14px; border-radius: 10px; }
.check { display: flex; gap: 9px; align-items: center; font-size: .88rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ribbon); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; z-index: 100; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .9rem; box-shadow: 0 10px 30px rgba(36,23,49,.35); transition: .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 10px; padding-top: 18px; }
  .fan { height: 86vw; max-height: 520px; margin-top: 10px; }
  .rail .wrap { flex-wrap: wrap; gap: 10px; }
  .search { width: 100%; }
  .s-body { display: block; overflow-y: auto; }
  .stage { padding: 14px; }
  .stage .frame { flex: none; height: min(62vh, 118vw); }
  .panel { border-left: 0; border-top: 1px solid var(--hair); min-height: 70vh; }
  .tabs { position: sticky; top: 0; z-index: 2; background: var(--paper); }
  .pane { overflow: visible; }
  .s-top .nav .hide-m { display: none; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  header nav { gap: 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 26px 12px; }
  .tile .cap small { display: none; }
  .tile .cap b { font-size: .92rem; }
  .cat-head { margin-top: 34px; }
  .cat-head h2 { font-size: 1.45rem; }
  .from { min-width: 0; flex: 1; }
  .name-line .hint { display: none; }
  .s-top .back span { display: none; }
  .fonts { grid-template-columns: repeat(2, 1fr); }
  .quick .btn { flex: 1; padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { .tile .card, .tile .env, .toast { transition: none; } }
