/* DigitalSnap selfie upload — modern redesign
   Drop into static/css/ alongside your existing selfie_style.css */

:root {
  --ds-bg: #FAFAF7;
  --ds-surface: #FFFFFF;
  --ds-surface-2: #F4F3EE;
  --ds-ink: #0A1828;
  --ds-ink-2: #2C3E50;
  --ds-mute: #6B7785;
  --ds-mute-2: #A8B2BD;
  --ds-line: #E6E4DD;
  --ds-line-2: #D9D6CC;
  --ds-accent: #0DCAF0;
  --ds-accent-ink: #003848;
  --ds-accent-soft: #E5F8FD;
  --ds-success: #1F9D55;
  --ds-success-soft: #E8F5EC;
  --ds-danger: #D64545;
  --ds-danger-soft: #FCEBEB;
  --ds-radius: 18px;
  --ds-radius-sm: 12px;
  --ds-radius-pill: 999px;
  --ds-shadow-sm: 0 1px 2px rgba(10, 24, 40, 0.04), 0 1px 3px rgba(10, 24, 40, 0.06);
  --ds-shadow-md: 0 4px 12px rgba(10, 24, 40, 0.06), 0 2px 4px rgba(10, 24, 40, 0.04);
  --ds-shadow-lg: 0 24px 48px -16px rgba(10, 24, 40, 0.16), 0 8px 16px -8px rgba(10, 24, 40, 0.08);
  --ds-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ds-root {
  font-family: var(--ds-font);
  color: var(--ds-ink);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

.ds-root *, .ds-root *::before, .ds-root *::after { box-sizing: border-box; }
.ds-root button { font-family: inherit; }

/* ---------- Page chrome (topnav / footer) ---------- */
.ds-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--ds-surface);
  border-bottom: 1px solid var(--ds-line);
}
.ds-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ds-ink);
}
.ds-logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ds-accent) 0%, #6BE2F5 100%);
  display: grid;
  place-items: center;
  color: white;
  font-size: 14px;
}
.ds-logo-mark::after {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3);
}
.ds-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ds-lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-surface-2);
  border: 1px solid var(--ds-line);
  font-size: 13px;
  color: var(--ds-ink-2);
  cursor: pointer;
  font-weight: 500;
}
.ds-lang-pill:hover { background: white; border-color: var(--ds-line-2); }
.ds-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--ds-line);
  background: var(--ds-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ds-ink);
}
.ds-icon-btn:hover { background: var(--ds-surface-2); }

/* ---------- Hero / heading ---------- */
.ds-hero {
  padding: 32px 20px 8px;
  text-align: center;
}
.ds-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--ds-radius-pill);
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.ds-hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ds-accent);
  box-shadow: 0 0 0 4px rgba(13, 202, 240, 0.18);
}
.ds-hero h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ds-ink);
  text-wrap: balance;
}
.ds-hero p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--ds-mute);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---------- Upload card ---------- */
.ds-upload-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  padding: 20px;
  box-shadow: var(--ds-shadow-md);
  margin: 20px;
}
.ds-upload-card.is-desktop {
  padding: 28px;
  margin: 0;
}

/* Dropzone with face guide */
.ds-dropzone {
  position: relative;
  border-radius: var(--ds-radius);
  background: linear-gradient(180deg, #FBFBF8 0%, #F4F4EE 100%);
  border: 1.5px dashed var(--ds-line-2);
  padding: 2px;
  min-height: 280px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
  overflow: hidden;
}
.ds-dropzone.is-desktop { min-height: 360px; padding: 32px; }
.ds-dropzone:hover {
  border-color: var(--ds-accent);
  background: linear-gradient(180deg, #F2FBFD 0%, #E5F6FB 100%);
}
.ds-dropzone.is-dragging {
  border-color: var(--ds-accent);
  background: var(--ds-accent-soft);
  transform: scale(1.005);
}
.ds-dropzone.has-file {
  background: var(--ds-surface);
  border-style: solid;
  border-color: var(--ds-line);
  cursor: default;
}
.ds-dropzone.is-error {
  border-color: var(--ds-danger);
  background: linear-gradient(180deg, #FFF6F6 0%, #FCEBEB 100%);
}

/* Face guide oval */
.ds-face-guide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.ds-face-guide svg {
  width: 180px;
  height: 220px;
  opacity: 0.55;
  transition: opacity .25s ease, transform .4s ease;
}
.ds-dropzone.is-desktop .ds-face-guide svg { width: 220px; height: 264px; }
.ds-dropzone:hover .ds-face-guide svg { opacity: 0.85; }
.ds-dropzone.is-dragging .ds-face-guide svg {
  opacity: 1;
  transform: scale(1.04);
}
.ds-face-oval {
  fill: none;
  stroke: var(--ds-accent);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}
.ds-face-corner {
  fill: none;
  stroke: var(--ds-ink-2);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.4;
}
.ds-dropzone:hover .ds-face-corner { opacity: 0.7; }
.ds-face-tick {
  fill: none;
  stroke: var(--ds-mute);
  stroke-width: 1;
  opacity: 0.4;
}

.ds-dropzone-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 2px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: var(--ds-radius-sm);
  max-width: 280px;
  margin-inline: auto;
}
.ds-dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 2px;
}
.ds-dropzone-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ds-ink);
  margin: 0;
}
.ds-dropzone-hint {
  font-size: 13px;
  color: var(--ds-mute);
  margin: 0;
  line-height: 1.45;
}
.ds-dropzone-or {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ds-mute-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin: 4px 0;
}
.ds-dropzone-or::before, .ds-dropzone-or::after {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--ds-line);
}

/* ---------- Buttons ---------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.ds-btn:active { transform: translateY(1px); }
.ds-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.ds-btn-primary {
  background: var(--ds-ink);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 4px 10px rgba(10,24,40,0.18);
}
.ds-btn-primary:hover { background: #16263a; }

.ds-btn-accent {
  background: var(--ds-accent);
  color: var(--ds-accent-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 4px 10px rgba(13, 202, 240, 0.28);
}
.ds-btn-accent:hover { background: #1ad3f7; }

.ds-btn-ghost {
  background: var(--ds-surface);
  color: var(--ds-ink);
  border: 1px solid var(--ds-line);
}
.ds-btn-ghost:hover { background: var(--ds-surface-2); border-color: var(--ds-line-2); }

.ds-btn-block { width: 100%; }
.ds-btn-lg { padding: 14px 22px; font-size: 15px; }

/* ---------- Selected file preview ---------- */
.ds-file-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  width: 240px;
  max-width: 100%;
  align-self: center;
  box-sizing: border-box;
}
.ds-file-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--ds-surface-2) center/cover no-repeat;
  flex-shrink: 0;
  border: 1px solid var(--ds-line);
}
.ds-file-meta {
  flex: 1; min-width: 0;
  text-align: left;
}
.ds-file-name {
  font-size: 13px; font-weight: 600;
  color: var(--ds-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-file-size {
  font-size: 12px; color: var(--ds-mute);
}
.ds-file-remove {
  width: 28px; height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: none;
  background: var(--ds-surface-2);
  color: var(--ds-mute);
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.ds-file-remove:hover { background: var(--ds-danger-soft); color: var(--ds-danger); }

/* face detection bubble after preview load */
.ds-face-detected {
  margin-top: 12px;
  padding: 1px 1px;
  background: var(--ds-success-soft);
  color: #135C32;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--ds-radius-pill);
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  align-self: center;
}
.ds-face-detected.is-error {
  background: var(--ds-danger-soft);
  color: var(--ds-danger);
}

/* ---------- Action row beneath dropzone ---------- */
.ds-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
/* Buttons share the row equally and are allowed to shrink so they never
   overflow the card border on narrow (mobile) screens. */
.ds-actions > .ds-btn {
  flex: 1 1 0;
  min-width: 0;
}
.ds-actions.is-search { display: block; }

/* ---------- Trust strip ---------- */
.ds-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  justify-content: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--ds-line);
}
.ds-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ds-mute);
  font-weight: 500;
}
.ds-trust-item .ico {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
  display: grid; place-items: center;
  font-size: 12px;
}

/* ---------- How it works (desktop side panel) ---------- */
.ds-howto {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ds-howto-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 14px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
}
.ds-step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ds-ink);
  color: white;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.ds-step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ds-ink);
  margin: 0 0 4px;
}
.ds-step-body {
  font-size: 13px;
  color: var(--ds-mute);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Error banner ---------- */
.ds-error-banner {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ds-danger-soft);
  border: 1px solid #F5C2C2;
  border-radius: var(--ds-radius-sm);
  margin-bottom: 16px;
}
.ds-error-banner .ico {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ds-danger);
  color: white;
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ds-error-text {
  flex: 1;
  font-size: 13px;
  color: #8A2A2A;
  line-height: 1.5;
}
.ds-error-text strong { color: #6B1F1F; display: block; margin-bottom: 2px; }
.ds-error-close {
  background: none;
  border: none;
  color: #8A2A2A;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  align-self: flex-start;
}

/* ---------- Loading state ---------- */
.ds-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}
.ds-loading-orb {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--ds-accent), transparent 60%, var(--ds-accent));
  -webkit-mask: radial-gradient(circle, transparent 22px, black 23px);
          mask: radial-gradient(circle, transparent 22px, black 23px);
  animation: ds-spin 1.2s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-loading-title { font-size: 16px; font-weight: 600; color: var(--ds-ink); margin: 0; }
.ds-loading-sub { font-size: 13px; color: var(--ds-mute); margin: 0; }
.ds-loading-progress {
  width: 100%;
  max-width: 280px;
  height: 6px;
  background: var(--ds-surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.ds-loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--ds-accent), #7CE6FA);
  animation: ds-progress 2.5s ease-in-out infinite;
}
@keyframes ds-progress {
  0% { width: 0%; transform: translateX(0); }
  50% { width: 80%; transform: translateX(0); }
  100% { width: 0%; transform: translateX(100%); }
}

/* ---------- Footer ---------- */
.ds-footer {
  padding: 24px 20px;
  text-align: center;
  border-top: 1px solid var(--ds-line);
  margin-top: 32px;
}
.ds-footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  margin-bottom: 8px;
}
.ds-footer-links a {
  color: var(--ds-ink-2);
  text-decoration: none;
}
.ds-footer-links a:hover { color: var(--ds-accent-ink); }
.ds-footer small { color: var(--ds-mute); font-size: 12px; }

/* ---------- Desktop layout ---------- */
.ds-desktop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 28px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 28px;
}
.ds-desktop-aside h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--ds-ink);
}
.ds-aside-card {
  background: var(--ds-ink);
  color: white;
  border-radius: var(--ds-radius);
  padding: 22px;
  margin-top: 18px;
  position: relative;
  overflow: hidden;
}
.ds-aside-card::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(closest-side, var(--ds-accent), transparent);
  opacity: 0.25;
}
.ds-aside-card h3 {
  font-size: 15px;
  margin: 0 0 8px;
  font-weight: 600;
  position: relative;
}
.ds-aside-card p {
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  color: rgba(255,255,255,0.78);
  position: relative;
}
/* ---------- Animated hook phrase ---------- */
.ds-hook {
  text-align: center;
  margin-bottom: 14px;
  height: 48px; /* fixed: 2 lines × 17px font / 1.4 lh */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ds-hook-phrase {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--ds-ink);
  letter-spacing: -0.02em;
  animation: ds-hook-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ds-hook-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Photo rules checklist ---------- */
.ds-photo-rules {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--ds-surface-2);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}
.ds-photo-rules li {
  font-size: 11.5px;
  color: var(--ds-mute);
  padding-left: 16px;
  position: relative;
  line-height: 1.45;
}
.ds-photo-rules li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ds-accent);
  font-weight: 700;
  font-size: 10px;
  top: 1px;
}

.ds-aside-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--ds-radius-pill);
  background: rgba(13, 202, 240, 0.16);
  color: #7CE6FA;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  position: relative;
}
