/* Contact sheet — self-contained overlay, injected by js/contact-sheet.js.
   Every selector is prefixed .cs- so nothing touches the site's own styles. */

.cs-root {
  --cs-black: #0B0B0A;
  --cs-sheet: #1a1917;
  --cs-border: #34322d;
  --cs-orange: #E07A2F;
  --cs-cream: #EDE6D6;
  --cs-muted: #b5ad9c;
  --cs-ease: cubic-bezier(.32, .72, 0, 1);
  font-family: 'IBM Plex Mono', ui-monospace, 'Space Mono', monospace;
}

/* ---- Scrim ---- */
.cs-scrim {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  visibility: hidden;
  touch-action: none;
  transition: opacity .35s linear, visibility 0s linear .35s;
}
.cs-root.cs-open .cs-scrim {
  visibility: visible;
  transition: opacity .35s linear, visibility 0s;
}

/* ---- Sheet ---- */
.cs-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  width: min(100%, 480px);
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 12px 24px calc(36px + env(safe-area-inset-bottom, 0px));
  background: var(--cs-sheet);
  border-top: 1px solid var(--cs-border);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
  visibility: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  will-change: transform;
  transition: transform .5s var(--cs-ease), visibility 0s linear .5s;
}
/* Backing below the sheet so pulling it up (rubber-band) never shows a gap
   between its bottom edge and the viewport. */
.cs-sheet::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 320px;
  background: var(--cs-sheet);
}
.cs-root.cs-open .cs-sheet {
  visibility: visible;
  transition: transform .5s var(--cs-ease), visibility 0s;
}

.cs-handle {
  align-self: center;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: #4a4842;
}

/* ---- Contact buttons ---- */
.cs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cs-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  box-sizing: border-box;
  padding: 0 16px;
  border-radius: 20px;
  background: var(--cs-black);
  border: 1px solid var(--cs-border);
  color: var(--cs-cream);
  font: 400 14px/1 'IBM Plex Mono', ui-monospace, 'Space Mono', monospace;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-drag: none;
  transition: border-color .2s linear;
}
.cs-btn svg {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--cs-orange);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .cs-btn:hover { border-color: var(--cs-orange); }
}
.cs-btn:focus-visible,
.cs-save:focus-visible {
  outline: 2px solid var(--cs-orange);
  outline-offset: 2px;
}

/* ---- Save contact ---- */
.cs-save {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--cs-orange);
  color: var(--cs-black);
  font: 500 15px/1 'IBM Plex Mono', ui-monospace, 'Space Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease-out;
}
.cs-save:active { transform: scale(.98); }
.cs-save[data-state="saving"] { cursor: default; }

/* The sweep is a full-width layer scaled from the left edge, so the
   "width 0 to 100%" look animates transform only. */
.cs-save-fill {
  position: absolute;
  inset: 0;
  background: var(--cs-cream);
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
  transition: opacity .3s linear, transform 0s linear .3s;
  pointer-events: none;
}
.cs-save[data-state="saving"] .cs-save-fill,
.cs-save[data-state="saved"] .cs-save-fill {
  transform: scaleX(1);
  opacity: 1;
  transition: transform 1.1s cubic-bezier(.4, 0, .2, 1), opacity 0s;
}
.cs-save-icon,
.cs-save-label { position: relative; }

/* Download icon: the arrow drops into the tray on a loop while saving,
   then a check pops in once the file has been handed to the phone. */
.cs-save-icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
}
.cs-save-icon svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cs-ico-check { opacity: 0; transform: scale(.4); }
.cs-save[data-state="saved"] .cs-ico-down { opacity: 0; }
.cs-save[data-state="saved"] .cs-ico-check {
  opacity: 1;
  transform: scale(1);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .15s linear;
}
.cs-save[data-state="saving"] .cs-ico-arrow {
  animation: cs-drop .55s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes cs-drop {
  0%   { transform: translateY(-7px); opacity: 0; }
  30%  { opacity: 1; }
  75%  { transform: translateY(3px); opacity: 1; }
  100% { transform: translateY(4px); opacity: 0; }
}

.cs-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .cs-save-fill { transition: none !important; }
  .cs-ico-arrow { animation: none !important; }
  .cs-ico-check { transition: none !important; }
}
