/* =========================================================
   Project full-screen view + share sheet
   ========================================================= */

/* ---------- header share button ---------- */
.share-btn{
  display:inline-flex;align-items:center;justify-content:center;
  width:2.5rem;height:2.5rem;
  border:1.5px solid var(--line);border-radius:50%;
  background:var(--surface);color:var(--ink);
  transition:background-color .2s var(--ease),color .2s var(--ease),border-color .2s var(--ease);
}
.share-btn:hover{background:var(--ink);color:var(--paper);border-color:var(--ink)}
.share-btn svg{width:1.05rem;height:1.05rem}

/* ---------- share popover ---------- */
.share{
  position:fixed;inset:0;z-index:120;
  display:grid;place-items:center;
  padding:1.25rem;
  background:var(--scrim);
  backdrop-filter:blur(3px);
}
.share__pop{
  width:100%;max-width:26rem;
  padding:1.35rem;
  background:var(--surface);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg);
}
.share__title{font-family:var(--font-display);font-weight:700;font-size:1rem;margin-bottom:.2rem}
.share__sub{font-size:.85rem;color:var(--ink-3);margin-bottom:1rem}

.share__field{
  display:flex;align-items:center;gap:.5rem;
  padding:.55rem .75rem;
  background:var(--surface-2);
  border:1.5px solid var(--line);
  border-radius:var(--radius-sm);
  margin-bottom:1rem;
}
.share__field input{
  flex:1;min-width:0;
  border:0;background:transparent;
  font-size:.875rem;
  font-family:var(--font-body);
}
.share__field input:focus{outline:none}

.share__actions{
  display:grid;gap:.5rem;
  grid-template-columns:repeat(2,minmax(0,1fr));
}
/* With no native share available (desktop), Copy link is the one action
   that matters — let it span the row instead of leaving a gap. */
#shareNative[hidden] + #shareCopy{grid-column:1 / -1}
.share__actions button,
.share__actions a{
  display:flex;align-items:center;justify-content:center;gap:.45rem;
  padding:.75rem .9rem;min-height:2.9rem;
  border:1.5px solid var(--line);border-radius:var(--radius-sm);
  background:var(--surface);
  font-family:var(--font-display);font-weight:700;font-size:.875rem;
  color:var(--ink);
  text-align:center;
  transition:background-color .2s var(--ease),border-color .2s var(--ease);
}
.share__actions button:hover,
.share__actions a:hover{border-color:var(--ink);background:var(--paper-2)}
.share__actions .is-primary{background:var(--brand-solid);border-color:var(--brand-solid);color:var(--on-brand)}
.share__actions .is-primary:hover{background:var(--brand-deep);border-color:var(--brand-deep)}
.share__actions svg{width:1rem;height:1.05rem;flex:0 0 auto}

.share__note{
  margin-top:.85rem;font-size:.8rem;color:var(--ink-3);text-align:center;
  min-height:1.2em;
}
.share__note.is-ok{color:var(--brand-text);font-weight:600}

/* ---------- project overlay ----------
   A plain overlay rather than <dialog>: the share sheet has to paint
   above the project view, and a modal dialog lives in the browser's
   top layer where a sibling overlay cannot reach it. */
[hidden]{display:none !important}

.viewer{
  position:fixed;inset:0;z-index:100;
  background:var(--scrim);
  backdrop-filter:blur(4px);
  animation:viewerIn .28s var(--ease);
}
@keyframes viewerIn{from{opacity:0}to{opacity:1}}

.viewer__panel{
  position:absolute;inset:0;
  display:flex;flex-direction:column;
  background:var(--paper);
  overflow:hidden;
  animation:panelIn .34s var(--ease);
  outline:none;
}
@keyframes panelIn{from{opacity:0;transform:translateY(1.5rem)}to{opacity:1;transform:none}}

.viewer__bar{
  display:flex;align-items:center;gap:.75rem;
  padding:.75rem clamp(.9rem,3vw,1.5rem);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--line);
  flex:0 0 auto;
}
.viewer__bar h2{
  font-family:var(--font-display);font-weight:800;font-size:.95rem;letter-spacing:-.01em;
  margin:0;min-width:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.viewer__tools{margin-left:auto;display:flex;align-items:center;gap:.4rem}
.viewer__btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.4rem;
  min-height:2.5rem;padding:0 .85rem;
  border:1.5px solid var(--line);border-radius:999px;
  background:var(--surface);color:var(--ink-2);
  font-family:var(--font-display);font-weight:700;font-size:.8rem;
  transition:background-color .2s var(--ease),color .2s var(--ease),border-color .2s var(--ease);
}
.viewer__btn:hover:not(:disabled){background:var(--ink);color:var(--paper);border-color:var(--ink)}
.viewer__btn:disabled{opacity:.35;cursor:not-allowed}
.viewer__btn svg{width:.95rem;height:.95rem}
.viewer__btn--icon{width:2.5rem;padding:0}

/* long-form area */
.viewer__scroll{
  flex:1 1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.viewer__hero{
  position:relative;
  width:100%;aspect-ratio:21/9;
  /* Keep the artwork present without pushing the text below the fold. */
  max-height:min(38vh,360px);
  background:var(--tint);
  overflow:hidden;
}
.viewer__hero img{width:100%;height:100%;object-fit:cover}
.viewer__hero > div{position:absolute;inset:0}
@media (max-width:640px){
  .viewer__hero{aspect-ratio:4/3;max-height:min(34vh,280px)}
}

.viewer__inner{
  max-width:44rem;
  margin-inline:auto;
  padding:clamp(1.5rem,4vw,2.75rem) clamp(1.25rem,4vw,2rem) 4rem;
}

.viewer__meta{
  font-size:.85rem;color:var(--ink-3);
  margin-top:-.6rem;margin-bottom:.9rem;
}
.viewer__meta:empty{display:none}

/* Lock the page behind the viewer and the share sheet. */
html.is-locked{overflow:hidden}

.viewer__tags{display:flex;flex-wrap:wrap;gap:.4rem;margin-bottom:1.1rem}
.viewer__lede{
  font-size:clamp(1.05rem,1rem + .35vw,1.2rem);
  color:var(--ink-2);
  margin-bottom:1.75rem;
}

.viewer__metrics{
  display:flex;flex-wrap:wrap;gap:1.5rem 2.5rem;
  padding:1.25rem 0;
  border-block:1px solid var(--line);
  margin-bottom:1.75rem;
}
.viewer__metrics li{display:flex;flex-direction:column;gap:.1rem}
.viewer__metrics strong{
  font-family:var(--font-display);font-size:1.6rem;font-weight:800;letter-spacing:-.03em;color:var(--brand-text);
  line-height:1.15;
}
.viewer__metrics span{font-size:.8rem;color:var(--ink-3)}

.viewer__prose > * + *{margin-top:1.1rem}
.viewer__prose p{color:var(--ink-2);font-size:1.0125rem}

.viewer__gallery{
  display:grid;gap:.6rem;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,11rem),1fr));
  margin-top:1.75rem;
}
.viewer__gallery img{
  width:100%;aspect-ratio:4/3;object-fit:cover;
  border-radius:var(--radius-sm);border:1px solid var(--line);
  cursor:zoom-in;
}

.viewer__video{
  margin-top:1.75rem;
}
.viewer__video video{
  width:100%;max-height:60vh;border-radius:var(--radius);background:var(--ink);display:block;
}
.viewer__embed{margin-top:0}

/* The embedded post sits directly under the figures, labelled, so it is
   impossible to miss it at the foot of the page. */
.viewer__embedblock{
  margin:2rem 0;
  padding-top:1.5rem;
  border-top:1px solid var(--line);
}
.viewer__blocktitle{
  font-family:var(--font-display);
  font-size:.75rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;
  color:var(--ink-3);
  margin-bottom:.75rem;
}
.viewer__embedblock .embed{
  padding:0;background:none;border:0;
  display:flex;justify-content:center;
}
.viewer__embedblock .instagram-media,
.viewer__embedblock .tiktok-embed,
.viewer__embedblock .linkedin-embed,
.viewer__embedblock .fb-post{
  max-width:min(100%,34rem);width:100%;
}
.viewer__embedblock iframe{
  max-width:min(100%,34rem);border-radius:var(--radius);
}

.viewer__foot{
  display:flex;align-items:center;gap:1rem;flex-wrap:wrap;
  margin-top:2.25rem;padding-top:1.5rem;
  border-top:1px solid var(--line);
}
.viewer__nav{display:flex;gap:.5rem;margin-left:auto}

/* ---------- card affordance ---------- */
.work{cursor:pointer}
.work__open{
  position:absolute;top:1rem;right:1rem;z-index:2;
  display:inline-flex;align-items:center;gap:.4rem;
  min-height:2.25rem;padding:0 .8rem;
  border:0;border-radius:999px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  color:var(--ink);
  font-family:var(--font-display);font-weight:700;font-size:.75rem;
  box-shadow:var(--shadow-sm);
  opacity:0;
  transform:translateY(-4px);
  transition:opacity .22s var(--ease),transform .22s var(--ease),background-color .22s var(--ease);
}
.work:hover .work__open,
.work:focus-within .work__open{opacity:1;transform:none}
.work__open:hover{background:var(--surface);color:var(--brand-text)}
.work__open svg{width:.85rem;height:.85rem}

/* Touch devices get the control permanently — no hover to reveal it. */
@media (hover:none){
  .work__open{opacity:1;transform:none}
}

/* ---------- toast ---------- */
.viewer-toast{
  position:fixed;left:50%;bottom:1.5rem;transform:translateX(-50%);
  z-index:200;padding:.7rem 1.2rem;
  background:var(--band-bg);color:var(--band-fg);border-radius:999px;
  font-size:.875rem;box-shadow:var(--shadow-md);
  pointer-events:none;
}

/* ---------- responsive ---------- */
@media (max-width:640px){
  /* Full-height sheet, with the bar and footer always reachable. */
  .viewer__panel{inset:0}
  .viewer__bar{padding:.6rem .75rem}
  .viewer__bar h2{font-size:.85rem}
  .viewer__btn{min-height:2.75rem}
  .viewer__btn--icon{width:2.75rem}
  .viewer__inner{padding-bottom:3rem}
  .viewer__actions{grid-template-columns:1fr 1fr}
  .viewer__nav{width:100%;margin-left:0}
  .viewer__nav .viewer__btn{flex:1}
  .share__pop{border-radius:var(--radius-lg)}
}

@media (prefers-reduced-motion:reduce){
  .viewer,.viewer__panel{animation:none}
  .work__open{transition:none}
}