:root {
  --primary: #0a66c2;
  --accent: #ffb800;
  --ink: #0b1220;
  --linkedin: #0a66c2;
  --text: #f5f7fb;
  --muted: rgba(245, 247, 251, 0.7);
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.14);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 70%),
    var(--ink);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- screens ---------- */

.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

.screen.active {
  display: flex;
}

/* ---------- type ---------- */

h1 {
  margin: 0 0 14px;
  font-size: clamp(36px, 11vw, 52px);
  line-height: 1.03;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 10px;
  font-size: 30px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.fineprint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- buttons ---------- */

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex: none;
}

.btn.primary {
  background: var(--primary);
}

.btn.linkedin {
  background: var(--linkedin);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn.text {
  background: transparent;
  min-height: 44px;
  color: var(--muted);
  font-weight: 600;
}

.btn.small {
  min-height: 40px;
  font-size: 15px;
}

/* ---------- welcome ---------- */

.welcome-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0 32px;
}

.brand-logo {
  max-width: 180px;
  max-height: 56px;
  object-fit: contain;
  align-self: flex-start;
  margin-bottom: 28px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
}

.inapp-warning {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 14px;
  line-height: 1.45;
}

.inapp-warning p {
  margin: 0;
}

/* ---------- camera ---------- */

#screen-camera {
  max-width: none;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: env(safe-area-inset-top) 0 max(16px, env(safe-area-inset-bottom));
  background: #000;
}

.viewport {
  position: relative;
  width: min(100vw, calc((100dvh - 150px) * 0.8));
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 20px;
  background: #111;
}

.viewport video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewport video.mirror {
  transform: scaleX(-1);
}

.viewport-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 56px 20px 18px;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--ink) 92%, transparent));
  pointer-events: none;
}

.viewport-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.viewport-event {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.viewport.flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  animation: flash 0.35s ease-out forwards;
}

@keyframes flash {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 0;
  }
}

.camera-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 360px;
  padding: 0 28px;
}

.shutter {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid #000;
  background: #fff;
  outline: 4px solid #fff;
  cursor: pointer;
}

.shutter:active {
  transform: scale(0.94);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ---------- review ---------- */

.review-body {
  flex: 1;
}

.preview {
  display: block;
  /* Keep the photo short enough that the caption box shows below it on a phone. */
  width: min(100%, calc(56dvh * 0.8));
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px;
  background: #111;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.field-label {
  display: block;
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming in on focus */
  line-height: 1.45;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.hint {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.hint strong {
  color: var(--text);
}

.preview {
  /* Allow iOS "press and hold → Save to Photos" on the framed photo. */
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
}

.alt-path {
  margin: 14px 0 0;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.5;
}

.alt-path summary {
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
}

.alt-path ol {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--muted);
}

.alt-path li + li {
  margin-top: 6px;
}

.alt-path strong {
  color: var(--text);
}

.alt-path .btn {
  margin-bottom: 14px;
}

.actions.sticky {
  position: sticky;
  bottom: 0;
  margin: 0 -20px calc(-1 * max(20px, env(safe-area-inset-bottom)));
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--ink) 28%);
}

/* ---------- done ---------- */

.done-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px 0;
}

.check {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: 38px;
  font-weight: 800;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: #fff;
  color: #0b1220;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- share button while the iPhone upload runs ---------- */

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn.busy::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- shared photo page (/p/:id) ---------- */

.photo-page {
  justify-content: center;
  gap: 0;
}

.photo-page .card-img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 28px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.photo-page h1 {
  font-size: clamp(30px, 8vw, 40px);
}

.photo-page .actions {
  margin-top: 28px;
}
