/* ---------- Reference uploader: iMessage "+" → attachment sheet ---------- */
@font-face{font-family:Caveat;font-style:normal;font-weight:600;font-display:swap;src:url(assets/fonts/caveat-latin-600-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Caveat;font-style:normal;font-weight:600;font-display:swap;src:url(assets/fonts/caveat-latin-ext-600-normal.woff2) format('woff2');unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:Caveat;font-style:normal;font-weight:600;font-display:swap;src:url(assets/fonts/caveat-cyrillic-600-normal.woff2) format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}

.brief-preview{--r-ink:#1f1f22;--r-grey:#76767c;--r-ease:cubic-bezier(.22,1,.36,1);--r-spring:cubic-bezier(.34,1.45,.5,1);--r-well:rgba(118,118,128,.075)}

/* The + button */
.im-plus{position:relative;padding:0;border:0;cursor:pointer;font:inherit;transition:transform .45s var(--r-spring),background-color .25s ease,color .25s ease;-webkit-tap-highlight-color:transparent}
.im-plus svg{transition:transform .45s var(--r-spring)}
@media(hover:hover){.im-plus:hover{background:#e5e5ea;color:#5d5d63}}
.im-plus:active{transform:scale(.9)}
.im-plus:focus-visible{outline:2px solid #91baff;outline-offset:2px}
.brief-preview.is-refs-open .im-plus{background:#e5e5ea;color:#3a3a40}
.brief-preview.is-refs-open .im-plus svg{transform:rotate(45deg)}
.im-plus-count{position:absolute;top:-5px;right:-5px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:linear-gradient(135deg,#ff7eaa,#ffa98a);color:#fff;font-size:10.5px;font-weight:600;line-height:17px;text-align:center;box-shadow:0 0 0 2px #fff,0 3px 8px -2px rgba(255,110,150,.6);animation:refs-pop .5s var(--r-spring)}
.im-plus-count[hidden]{display:none}
@keyframes refs-pop{from{transform:scale(.3);opacity:0}to{transform:none;opacity:1}}

/* The conversation steps back while the sheet is up */
.brief-chat{transition:opacity .35s var(--r-ease),transform .45s var(--r-ease)}
.brief-preview.is-refs-open .brief-chat{opacity:.22;transform:scale(.97) translateY(-6px)}

/* The sheet rises out of the + */
.refs-sheet{position:absolute;left:10px;right:10px;bottom:60px;z-index:6;display:flex;flex-direction:column;max-height:calc(100% - 140px);padding:14px 14px 12px;border-radius:24px;
 background:rgba(255,255,255,.9);-webkit-backdrop-filter:blur(24px) saturate(1.8);backdrop-filter:blur(24px) saturate(1.8);
 box-shadow:inset 0 1px 0 #fff,0 1px 2px rgba(28,25,40,.05),0 12px 30px -10px rgba(28,25,40,.18),0 40px 70px -30px rgba(28,25,40,.28);
 transform-origin:22px calc(100% + 30px);opacity:0;transform:translateY(16px) scale(.92);
 transition:opacity .2s ease,transform .3s var(--r-ease)}
.refs-sheet.is-open{opacity:1;transform:none;transition:opacity .22s ease,transform .55s var(--r-spring)}
.refs-sheet[hidden]{display:none}
.refs-sheet.is-open>*{animation:refs-rise .5s cubic-bezier(.16,1,.3,1) both}
.refs-sheet.is-open>:nth-child(2){animation-delay:40ms}.refs-sheet.is-open>:nth-child(3){animation-delay:80ms}.refs-sheet.is-open>:nth-child(4){animation-delay:110ms}
@keyframes refs-rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

.refs-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 12px;padding:0 2px}
.refs-titles{min-width:0}
.refs-head h4{margin:0;font-size:17px;font-weight:600;letter-spacing:-.022em;color:var(--r-ink)}
.refs-sub{margin:2px 0 0;font-size:12.5px;color:var(--r-grey)}
.refs-count{display:inline-flex;align-items:center;flex:none;margin-left:10px;font-size:12.5px;color:var(--r-grey);font-variant-numeric:tabular-nums}
.refs-count svg{width:26px;height:26px;margin-right:6px;transform:rotate(-90deg);fill:none;stroke-width:3.2;stroke-linecap:round}
.refs-count circle:first-child{stroke:rgba(118,118,128,.16)}
.refs-ring-bar{stroke:#ff8db8;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset .6s var(--r-spring)}
.refs-count b{color:var(--r-ink);font-weight:600}

/* Drop zone */
.refs-drop{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;flex:none;padding:14px 16px;border-radius:18px;background:var(--r-well);cursor:pointer;
 transition:background-color .3s ease,transform .45s var(--r-spring)}
.refs-drop>*+*{margin-left:14px}
.refs-input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.refs-drop:has(.refs-input:focus-visible){outline:2px solid #91baff;outline-offset:2px}
@media(hover:hover){.refs-drop:hover{background:rgba(118,118,128,.11)}}
.refs-drop:active{transform:scale(.985)}
.refs-drop.is-over{background:radial-gradient(130% 150% at 15% 0%,rgba(255,173,205,.42),rgba(255,201,223,.22) 55%,rgba(255,210,182,.24));transform:scale(1.02)}
.refs-drop.is-gulp{animation:refs-gulp .5s var(--r-spring)}
@keyframes refs-gulp{30%{transform:scale(.965,.94)}65%{transform:scale(1.01,1.02)}}
.refs-drop.is-shake{animation:refs-shake .42s var(--r-ease)}
@keyframes refs-shake{20%{translate:-6px}45%{translate:5px}70%{translate:-3px}}
.refs-sheet.is-full .refs-drop{opacity:.6;cursor:default}

/* The little stack of pictures inside the drop zone */
.refs-stack{position:relative;display:block;width:50px;height:44px;--fan:1;transition:transform .45s var(--r-spring)}
.refs-stack i{position:absolute;left:12px;top:4px;width:28px;height:36px;border-radius:8px;box-shadow:0 0 0 2px #fff,0 4px 10px -3px rgba(28,25,40,.25);
 transition:transform .55s var(--r-spring)}
.refs-stack i:nth-child(1){background:linear-gradient(160deg,#c9d8ff,#9db5ff);transform:rotate(calc(-12deg * var(--fan))) translateX(calc(-7px * var(--fan)))}
.refs-stack i:nth-child(2){background:linear-gradient(160deg,#e9d5ff,#c7a7ff);transform:rotate(calc(12deg * var(--fan))) translateX(calc(7px * var(--fan)))}
.refs-stack i:nth-child(3){background:linear-gradient(160deg,#ffd0e1,#ffab9a)}
.refs-stack i:nth-child(3)::after{content:"";position:absolute;left:6px;right:6px;bottom:7px;height:9px;border-radius:5px 5px 3px 3px;background:rgba(255,255,255,.55);clip-path:polygon(0 100%,35% 20%,55% 60%,75% 35%,100% 100%)}
@media(hover:hover){.refs-drop:hover .refs-stack{--fan:1.35}}
.refs-drop.is-over .refs-stack{--fan:1.8}
.refs-drop.is-over .refs-stack i:nth-child(3){transform:translateY(-6px) scale(1.06)}
.refs-drop-text{display:flex;flex-direction:column;min-width:0}
.refs-drop-text b{font-size:15px;font-weight:600;letter-spacing:-.015em;color:var(--r-ink)}
.refs-drop-text .r-over,.refs-drop-text .r-full{display:none}
.refs-drop.is-over .r-idle,.refs-sheet.is-full .r-idle{display:none}
.refs-drop.is-over .r-over{display:block}
.refs-sheet.is-full .refs-drop:not(.is-over) .r-full{display:block}
.refs-browse{margin-top:2px;font-size:13px;color:#087bff}
.refs-sheet.is-full .refs-browse{color:var(--r-grey)}

/* Pinned tiles */
.refs-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;flex:0 1 auto;min-height:0;margin:0;padding:0;list-style:none;overflow:auto;scrollbar-width:none}
.refs-sheet.has-files .refs-grid{margin-top:12px;padding:2px}
.refs-tile{position:relative;aspect-ratio:1;border-radius:12px;overflow:hidden;background:#f2f2f6;box-shadow:0 .5px 1px rgba(28,25,40,.08),0 4px 10px -4px rgba(28,25,40,.18);transform-origin:50% 50%}
.refs-tile img,.refs-tile video{display:block;width:100%;height:100%;object-fit:cover}
.refs-play{position:absolute;left:50%;top:50%;width:22px;height:22px;margin:-11px 0 0 -11px;border-radius:50%;background:rgba(255,255,255,.85);box-shadow:0 2px 6px rgba(28,25,40,.25)}
.refs-play::after{content:"";position:absolute;left:8.5px;top:6px;border:5px solid transparent;border-left:7px solid #1f1f22;border-right:0}
.refs-doc{display:grid;place-items:center;width:100%;height:100%;background:linear-gradient(180deg,#fff,#f1f1f5)}
.refs-doc b{padding:2px 6px;border-radius:6px;background:#1f1f22;color:#fff;font-size:9.5px;font-weight:700;letter-spacing:.02em}
.refs-name{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.refs-tile.is-file .refs-name{position:absolute;left:5px;right:5px;bottom:4px;width:auto;height:auto;clip:auto;font-size:9px;line-height:1.2;color:var(--r-grey);text-align:center;overflow:hidden;text-overflow:ellipsis}
.refs-tile.is-file .refs-doc{padding-bottom:10px}
.refs-remove{position:absolute;top:4px;right:4px;display:grid;place-items:center;width:20px;height:20px;padding:0;border:0;border-radius:50%;background:rgba(28,25,40,.55);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#fff;cursor:pointer;opacity:0;transform:scale(.7);transition:opacity .2s ease,transform .35s var(--r-spring)}
.refs-remove svg{width:10px;height:10px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
.refs-tile:hover .refs-remove,.refs-remove:focus-visible{opacity:1;transform:none}
.refs-remove:focus-visible{outline:2px solid #91baff;outline-offset:1px}
@media(hover:none){.refs-remove{opacity:1;transform:none}}

.refs-foot{display:flex;align-items:center;justify-content:space-between;flex:none;margin-top:12px;padding:0 2px}
.refs-note{margin:0 10px 0 0;min-width:0;font-size:12px;line-height:1.35;color:#d0477c;opacity:0;transform:translateY(3px);transition:opacity .25s ease,transform .35s var(--r-ease)}
.refs-note.is-on{opacity:1;transform:none}
.refs-done{position:relative;isolation:isolate;flex:none;height:34px;padding:0 18px;border:1.5px solid transparent;border-radius:999px;color:#c2416f;font:inherit;font-size:14px;font-weight:600;cursor:pointer;
 background:linear-gradient(#fff,#fff) padding-box,linear-gradient(100deg,#ffc4d8,#ffd9c6) border-box;transition:transform .15s var(--r-ease),color .25s ease,box-shadow .3s ease}
.refs-done::before{content:"";position:absolute;inset:-1.5px;z-index:-1;border-radius:inherit;background:linear-gradient(100deg,#ff7eaa,#ff9f86 55%,#ffbf8a);opacity:0;transition:opacity .3s ease}
@media(hover:hover){.refs-done:hover{color:#fff;box-shadow:0 10px 20px -10px rgba(255,110,150,.7)}.refs-done:hover::before{opacity:1}}
.refs-done:active{transform:scale(.96)}
.refs-done:focus-visible{outline:2px solid #91baff;outline-offset:2px}

/* Pinned files ride along with the message, as a fanned iMessage stack */
.im-attach{position:relative;align-self:flex-end;width:118px;height:92px;margin:0 2px 8px 0;animation:refs-pop .5s var(--r-spring)}
.im-attach[hidden]{display:none}
.im-attach-card{position:absolute;right:calc(var(--i) * 13px);bottom:0;width:66px;height:84px;border-radius:14px;overflow:hidden;background:#f2f2f6;
 box-shadow:0 0 0 2px #fff,0 6px 14px -6px rgba(28,25,40,.35);transform:rotate(calc((var(--i) - (var(--n) - 1) / 2) * -7deg));transform-origin:50% 100%;z-index:calc(10 - var(--i))}
.im-attach-card img,.im-attach-card video{width:100%;height:100%;object-fit:cover;display:block}
.im-attach-card .refs-doc b{font-size:10px}
.im-attach-more{position:absolute;right:-4px;top:-2px;z-index:11;padding:2px 7px;border-radius:999px;background:rgba(28,25,40,.62);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);color:#fff;font-size:11px;font-weight:600}

/* Handwritten hint under the iMessage card */
.refs-hint{grid-column:2;position:relative;height:56px;margin-top:-8px;padding:26px 0 0 66px;pointer-events:none;transition:opacity .45s ease}
.refs-hint.is-done{opacity:0}
.brief.is-done .refs-hint{opacity:0}
.refs-hint-arrow{position:absolute;left:8px;top:-16px;width:64px;height:56px;fill:none;stroke:#b4b4bb;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.refs-hint-arrow path{stroke-dasharray:1;stroke-dashoffset:1}
.refs-hint.is-drawn .refs-hint-arrow path:first-child{animation:refs-draw .9s cubic-bezier(.6,.1,.3,1) .15s forwards}
.refs-hint.is-drawn .refs-hint-arrow path:last-child{animation:refs-draw .35s ease-out 1s forwards}
@keyframes refs-draw{to{stroke-dashoffset:0}}
.refs-hint-text{display:inline-block;font-family:Caveat,"Bradley Hand","Segoe Print","Comic Sans MS",cursive;font-size:23px;font-weight:600;line-height:1;color:#7c7c83;transform:rotate(-3deg);transform-origin:0 50%;opacity:0}
.refs-hint.is-drawn .refs-hint-text{animation:refs-hand .6s cubic-bezier(.16,1,.3,1) .5s forwards}
@keyframes refs-hand{from{opacity:0;transform:rotate(-3deg) translateY(6px)}to{opacity:1;transform:rotate(-3deg)}}
@media(max-width:900px){.refs-hint{grid-column:auto;margin-top:-18px}}

@media(prefers-reduced-motion:reduce){
 .refs-sheet,.refs-sheet.is-open,.brief-chat,.refs-drop,.refs-stack i,.refs-ring-bar,.im-plus,.im-plus svg{transition:none}
 .refs-sheet.is-open>*,.im-attach,.im-plus-count,.refs-drop.is-gulp,.refs-drop.is-shake{animation:none}
 .refs-hint-arrow path{stroke-dashoffset:0}.refs-hint-text{opacity:1}
 .refs-hint.is-drawn .refs-hint-arrow path,.refs-hint.is-drawn .refs-hint-text{animation:none}
}
.refs-tile.is-file .refs-doc{padding-top:10px}
@media(hover:none){.refs-remove{top:3px;right:3px;width:18px;height:18px}}

/* Locked after sending: the + becomes a lock until "Send another brief". */
.im-plus .im-lock{display:none;width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round;stroke-linecap:round}
.im-plus.is-locked{cursor:not-allowed;background:#f2f2f6;color:#b4b4bb}
.im-plus.is-locked svg:first-child{display:none}
.im-plus.is-locked .im-lock{display:block}
.im-plus.is-locked .im-plus-count{background:#c7c7cc;box-shadow:0 0 0 2px #fff}
.im-plus.is-nope{animation:refs-shake .42s var(--r-ease)}
.im-plus-tip{position:absolute;left:10px;bottom:56px;z-index:7;max-width:calc(100% - 20px);padding:7px 11px;border-radius:12px;background:rgba(40,40,44,.92);color:#fff;font-size:12.5px;line-height:1.3;
 opacity:0;transform:translateY(4px);pointer-events:none;transition:opacity .2s ease,transform .3s var(--r-ease)}
.im-plus-tip.is-on{opacity:1;transform:none}
.im-plus-tip::after{content:"";position:absolute;left:18px;top:100%;border:5px solid transparent;border-top-color:rgba(40,40,44,.92)}
.im-bar{position:relative}
