/* "I'm attending" graphic maker. Builds on /styles.css tokens. */

.share {
  position: relative;
  overflow: hidden;
}
.share::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(196, 26, 118, 0.14) 0%, rgba(196, 26, 118, 0) 70%);
}
.share-inner {
  position: relative;
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad) clamp(4rem, 8vw, 6rem);
}
.share-back {
  display: inline-block;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.share-back:hover { color: var(--ink); }
.share-title {
  margin: 1rem 0 1rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.share-sub {
  max-width: 40rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- controls ---------- */

/* .btn sets display, which would otherwise override the hidden attribute */
.share [hidden] { display: none !important; }

.share-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.25rem 0 1.25rem;
}
.share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
button.btn { font-family: inherit; cursor: pointer; }
button.btn-ghost { background: transparent; color: var(--ink); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.btn-icon .icon { width: 1.05em; height: 1.05em; flex-shrink: 0; }
button.btn:disabled { opacity: 0.4; cursor: default; }
button.btn-primary:disabled:hover { background: var(--magenta-bright); }
.btn-ghost:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--magenta-bright);
  outline-offset: 3px;
}

.share-file { position: relative; cursor: pointer; }
.share-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.share-file:focus-within {
  outline: 2px solid var(--magenta-bright);
  outline-offset: 3px;
}

.seg {
  display: inline-flex;
  padding: 0.25rem;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 0.25rem);
  background: var(--surface);
}
.seg button {
  font: 500 0.875rem/1 var(--font-sans);
  letter-spacing: -0.01em;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.seg button span {
  margin-left: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--ground);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- preview ---------- */

.stage {
  position: relative;
  border-radius: 0.75rem;
}
#cv {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(196, 26, 118, 0.08);
  touch-action: pinch-zoom;
}
#cv.square { max-width: 38rem; }
#cv.has-photo { cursor: grab; touch-action: none; }
#cv.has-photo.dragging { cursor: grabbing; }
#cv.empty { cursor: pointer; }
#cv:focus-visible {
  outline: 2px solid var(--magenta-bright);
  outline-offset: 4px;
}
.drop-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 0.75rem;
  border: 2px dashed var(--magenta-bright);
  background: rgba(7, 7, 9, 0.7);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.stage.dropping .drop-hint { opacity: 1; }

.adjust {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.25rem;
}
.adjust[hidden] { display: none; }
.zoom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 1 18rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.zoom input { flex: 1; accent-color: var(--magenta-bright); }
.hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.share-actions { margin-top: 1.75rem; }
.note {
  min-height: 1.25rem;
  margin: 0.9rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- caption ---------- */

.caption {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.caption-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.caption .note { margin-top: 0; }
.caption .note:empty { display: none; }
.caption textarea {
  width: 100%;
  min-height: 7.5rem;
  resize: vertical;
  padding: 0.9rem 1rem;
  font: 400 0.9375rem/1.55 var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.caption textarea:focus {
  outline: none;
  border-color: var(--magenta-bright);
}

@media (max-width: 820px) {
  .share-controls { flex-direction: column; align-items: stretch; }
  .seg { display: flex; }
  .seg button { flex: 1; line-height: 1.3; }
  .seg button span { display: block; margin: 0.25rem 0 0; }
  .share-actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
  .caption textarea { min-height: 10rem; }
}

@media (prefers-reduced-motion: reduce) {
  .seg button, .drop-hint, .share-back { transition: none; }
}
