/* ==========================================================================
   Copy email — trigger icon states + confirmation toast (copy-email.js).
   Shared by index.html and contact.html; pages set --toast-bg / --toast-fg.
   ========================================================================== */

:root {
  /* Damped spring (stiffness 320, damping 24, mass 1): ~6% overshoot. */
  --spring-ui: linear(0, 0.077, 0.248, 0.45, 0.639, 0.795, 0.912, 0.989, 1.034,
    1.054, 1.058, 1.052, 1.042, 1.03, 1.019, 1.01, 1.004, 1, 0.998, 0.997,
    0.997, 0.997, 0.998, 0.998, 1);
  --spring-ui-duration: 580ms;
}

/* --- trigger ---------------------------------------------------------------- */

/* Zero-specificity button reset; each page's own trigger styles win. */
:where(button.copy-email) {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.copy-email-icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  overflow: visible;
}

.copy-email-icon g {
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 160ms var(--ease-out),
    scale var(--spring-ui-duration) var(--spring-ui);
}

.copy-email-icon .ci-check {
  opacity: 0;
  scale: 0.6;
}

.copy-email-icon .ci-check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 320ms var(--ease-out) 60ms;
}

/* Copied: copy glyph shrinks out, check springs in and draws. */
.copy-email.is-copied .ci-copy {
  opacity: 0;
  scale: 0.6;
}

.copy-email.is-copied .ci-check {
  opacity: 1;
  scale: 1;
}

.copy-email.is-copied .ci-check path {
  stroke-dashoffset: 0;
}

/* --- toast ------------------------------------------------------------------ */

.copy-toast {
  position: fixed;
  inset-inline: 0;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
  padding: 11px 20px 11px 14px;
  border-radius: 999px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.12);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  /* Hidden: parked just below and slightly small; exit is quicker than entry. */
  opacity: 0;
  translate: 0 18px;
  scale: 0.94;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease-in,
    translate 220ms cubic-bezier(0.4, 0, 1, 1),
    scale 220ms cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 220ms;
}

.copy-toast.is-visible {
  opacity: 1;
  translate: 0 0;
  scale: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 160ms var(--ease-out),
    translate var(--spring-ui-duration) var(--spring-ui),
    scale var(--spring-ui-duration) var(--spring-ui), visibility 0s;
}

.copy-toast-check {
  flex: none;
  width: 16px;
  height: 16px;
}

.copy-toast-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

.copy-toast-address {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  /* Page stylesheets already collapse durations; drop the spatial offset too. */
  .copy-toast {
    translate: none;
    scale: none;
  }
}
