/* ═══════════════════════════════════════════════════════════════════════════
   Bill Labs — ad gallery (/work).

   Phone first: the page IS an Instagram-style feed (white, system font,
   sticky top bar, tab bar fixed to the bottom). From 821px the same app sits
   inside a drawn iPhone, fixed in the middle of a dark page, and the page's
   scroll drives the phone's feed (feed.js). Desktop chrome uses the DTC
   page's tokens: ink, paper, lab red, Fraunces, JetBrains Mono.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --paper:#F4EEE3; --ink:#141211; --red:#B7261C; --red-deep:#8E1C14; --coral:#FF7A5C;
  --text-on-dark:#E7DFD2; --muted-on-dark:#A39C93;
  --display:Fraunces, "Iowan Old Style", Georgia, serif;
  --mono:"JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Instagram-ish app palette */
  --ig-bg:#fff; --ig-text:#0a0a0a; --ig-muted:#737373; --ig-line:#dbdbdb; --ig-blue:#0074cc; --ig-like:#ff3040;
  --ig-ring:conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  --sys:-apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease:cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing:border-box; }
[hidden] { display:none !important; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--ig-bg); color:var(--ig-text); font:400 14px/1.4 var(--sys); -webkit-font-smoothing:antialiased; }
h1, h2, p, ol, ul { margin:0; padding:0; }
ol, ul { list-style:none; }
img { display:block; max-width:100%; }
a { color:inherit; text-decoration:none; }
button { font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
:focus-visible { outline:2px solid var(--ig-blue); outline-offset:2px; border-radius:4px; }

.ic { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.ic--fill { fill:currentColor; stroke:none; }

/* ── Phone view (default) ───────────────────────────────────────────────── */
.desk, .spacer, .statusbar, .homebar { display:none; }

.app { min-height:100vh; padding-bottom:calc(50px + env(safe-area-inset-bottom, 0px)); }
.topbar {
  position:sticky; top:0; z-index:10; height:calc(50px + env(safe-area-inset-top, 0px));
  padding:env(safe-area-inset-top, 0px) 16px 0; display:flex; align-items:center; justify-content:space-between;
  background:rgba(255,255,255,.96); -webkit-backdrop-filter:saturate(180%) blur(12px); backdrop-filter:saturate(180%) blur(12px);
}
.topbar__mark { font:italic 600 26px/1 var(--display); font-variation-settings:"SOFT" 100, "WONK" 1; letter-spacing:-.02em; }
.topbar__icons { display:flex; gap:20px; }

.stories { display:flex; gap:14px; overflow-x:auto; padding:8px 14px 10px; scrollbar-width:none; border-bottom:1px solid #efefef; }
.stories::-webkit-scrollbar { display:none; }
.story { flex:none; width:68px; display:flex; flex-direction:column; align-items:center; gap:5px; font-size:11.5px; color:var(--ig-text); }
.story__ring { width:66px; height:66px; border-radius:50%; padding:2.5px; background:var(--ig-ring); }
.story.is-seen .story__ring { background:var(--ig-line); }
.story__ring .avatar { width:100%; height:100%; border:3px solid #fff; font-size:17px; }
.story__name { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.avatar { display:grid; place-items:center; border-radius:50%; background:var(--bg, #222); color:#fff; font-weight:700; letter-spacing:-.02em; }

.pinned { margin:10px 14px 4px; padding:10px 12px; border-radius:10px; background:#f5f5f5; color:var(--ig-muted); font-size:12px; line-height:1.4; }
.pinned b { color:var(--ig-text); font-weight:600; }

/* Post */
.post { padding-bottom:14px; }
.post__head { display:flex; align-items:center; gap:10px; padding:10px 12px; }
.post__head .avatar-ring { width:36px; height:36px; border-radius:50%; padding:2px; background:var(--ig-ring); flex:none; }
.post__head .avatar { width:100%; height:100%; border:2px solid #fff; font-size:11px; }
.post__who { flex:1; min-width:0; line-height:1.2; }
.post__handle { font-weight:600; font-size:14px; }
.post__sub { font-size:12px; color:var(--ig-text); }
.post__more { padding:6px; margin-right:-6px; }

.media { position:relative; background:#efefef; user-select:none; -webkit-user-select:none; touch-action:manipulation; overflow:hidden; }
.media img { width:100%; height:auto; aspect-ratio:var(--ar); object-fit:cover; -webkit-user-drag:none; }
.burst { position:absolute; left:50%; top:50%; width:96px; height:96px; margin:-48px 0 0 -48px; fill:#fff; filter:drop-shadow(0 4px 18px rgba(0,0,0,.35)); opacity:0; transform:scale(0); pointer-events:none; }
.burst.is-on { animation:burst .9s var(--ease); }
@keyframes burst { 0% { opacity:0; transform:scale(0); } 15% { opacity:1; transform:scale(1.2); } 30% { transform:scale(.95); } 45% { transform:scale(1); } 80% { opacity:1; } 100% { opacity:0; transform:scale(1); } }

.cta { display:flex; align-items:center; justify-content:space-between; padding:11px 12px; border-bottom:1px solid #efefef; font-weight:600; font-size:14px; color:var(--ig-text); }
.cta svg { width:16px; height:16px; }

.actions { display:flex; align-items:center; padding:8px 8px 4px; }
.actions button { padding:6px; display:grid; place-items:center; }
.actions .spacer-flex { flex:1; }
.like.is-on .ic { fill:var(--ig-like); stroke:var(--ig-like); }
.like.is-pop .ic { animation:pop .35s var(--ease); }
.save.is-on .ic { fill:currentColor; }
@keyframes pop { 50% { transform:scale(1.25); } }

.post__likes { padding:0 14px; font-size:14px; }
.post__likes.is-empty { color:var(--ig-text); }
.post__caption { padding:4px 14px 0; font-size:14px; overflow-wrap:anywhere; }
.post__caption b { font-weight:600; margin-right:5px; }
.post__caption.is-clamped .post__text { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.post__caption .more { color:var(--ig-muted); }
.post__meta { padding:6px 14px 0; font-size:12px; color:var(--ig-muted); }

/* End of feed */
.caught-up { padding:36px 24px 48px; text-align:center; border-top:1px solid #efefef; }
.caught-up__ring { display:inline-grid; place-items:center; width:84px; height:84px; border-radius:50%; padding:3px; background:var(--ig-ring); margin-bottom:14px; }
.caught-up__ring svg { width:100%; height:100%; border-radius:50%; background:#fff; padding:20px; fill:none; stroke:#d62976; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.caught-up h2 { font-size:20px; font-weight:400; margin-bottom:4px; }
.caught-up p { color:var(--ig-muted); }
.caught-up__cta { display:inline-block; margin-top:18px; padding:10px 18px; border-radius:8px; background:var(--ig-blue); color:#fff; font-weight:600; }
.caught-up__fine { margin:22px auto 0; max-width:30em; font-size:11.5px; line-height:1.45; }

/* Tab bar */
.tabbar {
  position:fixed; z-index:10; left:0; right:0; bottom:0;
  height:calc(50px + env(safe-area-inset-bottom, 0px)); padding-bottom:env(safe-area-inset-bottom, 0px);
  display:flex; justify-content:space-around; align-items:center; background:#fff; border-top:1px solid #efefef;
}
.tabbar a { padding:10px; display:grid; place-items:center; }
.tabbar__me span { display:grid; place-items:center; width:26px; height:26px; border-radius:50%; background:var(--ink); color:var(--paper); font:700 11px/1 var(--mono); letter-spacing:-.04em; outline:1.5px solid var(--ig-text); outline-offset:1.5px; }

/* ── Desktop: floating iPhone ───────────────────────────────────────────── */
@media (min-width:821px) {
  html { background:var(--ink); }
  body { background:var(--ink); color:var(--text-on-dark); }
  .spacer { display:block; }

  .desk {
    display:grid; position:fixed; inset:0; z-index:1; pointer-events:none;
    grid-template-columns:1fr 440px 1fr; grid-template-rows:auto 1fr auto;
    background:radial-gradient(120% 80% at 50% 45%, #2a2420 0%, var(--ink) 62%);
  }
  .desk > * { pointer-events:auto; }
  .masthead { grid-column:1 / -1; display:flex; align-items:center; justify-content:space-between; padding:20px clamp(20px, 4vw, 48px) 0; }
  .logo { padding:5px 10px; background:var(--paper); color:var(--ink); font:700 13px/1 var(--mono); }
  .nav { display:flex; gap:4px; }
  .nav a { padding:7px 12px; border-radius:999px; font:700 11px/1 var(--mono); letter-spacing:.14em; text-transform:uppercase; color:var(--text-on-dark); transition:background-color .2s; }
  .nav a:hover { background:rgba(244,238,227,.1); }
  .nav a[aria-current] { background:var(--paper); color:var(--ink); }

  .label { display:block; font:700 11px/1 var(--mono); letter-spacing:.2em; text-transform:uppercase; color:var(--coral); margin-bottom:18px; }
  .desk__intro { grid-column:1; grid-row:2; align-self:center; justify-self:end; max-width:340px; padding:0 40px 0 clamp(20px, 4vw, 48px); }
  .desk__intro h1 { font:600 clamp(34px, 3.6vw, 52px)/1.02 var(--display); font-variation-settings:"SOFT" 30, "WONK" 1; letter-spacing:-.02em; color:var(--paper); margin-bottom:18px; text-wrap:balance; }
  .desk__intro h1 em { font-style:italic; font-weight:500; color:var(--coral); }
  .desk__intro p { font:400 17px/1.5 var(--display); color:var(--text-on-dark); margin-bottom:26px; }
  .btn { display:inline-flex; align-items:center; min-height:50px; padding:0 24px; border-radius:999px; background:var(--red); color:var(--paper); font:700 12.5px/1 var(--mono); letter-spacing:.12em; text-transform:uppercase; transition:background-color .2s; }
  .btn:hover { background:var(--red-deep); }

  .desk__index { grid-column:3; grid-row:2; align-self:center; justify-self:start; max-width:300px; padding:0 clamp(20px, 4vw, 48px) 0 40px; }
  .desk__index ol { display:grid; gap:2px; margin-bottom:24px; }
  .desk__index button { display:flex; align-items:baseline; gap:10px; width:100%; padding:6px 0; text-align:left; font:500 17px/1.2 var(--display); color:var(--muted-on-dark); transition:color .2s; }
  .desk__index button:hover, .desk__index button.is-current { color:var(--paper); }
  .desk__index button.is-current::before { background:var(--coral); }
  .desk__index button::before { content:""; flex:none; width:6px; height:6px; border-radius:50%; background:#4a433d; transform:translateY(-2px); }
  .desk__index small { font:500 11px/1 var(--mono); letter-spacing:.06em; color:#8f877e; }
  .desk__index small.is-client { padding:3px 6px; border-radius:999px; background:rgba(255,122,92,.14); color:var(--coral); text-transform:uppercase; }
  .desk__note { font:400 12.5px/1.5 var(--sys); color:var(--muted-on-dark); }

  .desk__hint { grid-column:2; grid-row:3; justify-self:center; padding-bottom:10px; font:700 11px/1 var(--mono); letter-spacing:.2em; text-transform:uppercase; color:var(--muted-on-dark); transition:opacity .4s; }
  .desk__hint.is-gone { opacity:0; }

  @media (max-width:1180px) { .desk__index { display:none; } .desk { grid-template-columns:1fr 440px .35fr; } }
  @media (max-width:960px) { .desk__intro { display:none; } .desk { grid-template-columns:1fr 440px 1fr; } }

  /* The phone: drawn at 390×844 points, scaled to fit (--s from feed.js). */
  .phone {
    position:fixed; z-index:2; left:50%; top:50%; width:414px; height:868px;
    transform:translate(-50%, -50%) scale(var(--s, 1)); transform-origin:center;
    padding:12px; border-radius:66px;
    background:linear-gradient(145deg, #3a3633, #121110 40%, #2b2826);
    box-shadow:0 0 0 1.5px #4d4844, inset 0 0 0 1.5px #000, 0 50px 120px -30px rgba(0,0,0,.8), 0 30px 60px -30px rgba(183,38,28,.25);
  }
  .phone::before, .phone::after { content:""; position:absolute; width:4px; border-radius:2px; background:#2b2826; }
  .phone::before { left:-4px; top:180px; height:64px; box-shadow:0 84px 0 #2b2826; }
  .phone::after { right:-4px; top:220px; height:100px; }
  .phone__screen { position:relative; width:390px; height:844px; border-radius:54px; overflow:hidden; background:#fff; color:var(--ig-text); isolation:isolate; }

  .statusbar { display:flex; position:absolute; z-index:20; top:0; left:0; right:0; height:54px; align-items:center; justify-content:space-between; padding:4px 34px 0 46px; background:#fff; font:600 16px/1 var(--sys); }
  .statusbar__island { position:absolute; left:50%; top:11px; width:124px; height:36px; margin-left:-62px; border-radius:20px; background:#000; }
  .statusbar__icons { display:flex; gap:6px; align-items:center; }
  .statusbar__icons svg { fill:currentColor; }

  .app { position:absolute; inset:54px 0 0; min-height:0; padding:0; display:flex; flex-direction:column; }
  .topbar { position:relative; flex:none; height:48px; padding:0 16px; }
  /* Never scrolled by the user: wheel/trackpad over the phone must fall
     through to the page, whose scroll feed.js copies in here. */
  .scroller { flex:1; overflow:hidden; }
  .tabbar { position:relative; flex:none; height:82px; padding-bottom:30px; }
  .homebar { display:block; position:absolute; z-index:21; left:50%; bottom:8px; width:134px; height:5px; margin-left:-67px; border-radius:3px; background:#000; }
}

@media (prefers-reduced-motion:reduce) {
  .burst.is-on, .like.is-pop .ic { animation-duration:.01s; }
}
