@font-face {
  font-family: 'Advercase';
  src: url('/fonts/AdvercaseFont-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f5f5;
  --ink: #332e2b;
  --ink-soft: #6b6663;
  --line: #e2dfdc;
  --surface: #ffffff;
  --accent: #332e2b;
  --on-accent: #f5f5f5;
  --danger: #b02a2a;
  --radius: 14px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

input, button, select, textarea { font-family: inherit; color: inherit; }

.wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px 22px 140px; /* extra bottom padding for the sticky footer */
  min-height: 100vh;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--ink-soft); margin: 4px 0 22px; text-align: center; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

/* header */
.header { margin: 8px 0 28px; text-align: center; }
.header-title {
  font-family: 'Advercase', Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

@media (min-width: 640px) {
  .wrap { padding: 32px 22px 60px; }
  .header { margin: 16px 0 36px; }
}

.screen { animation: fade 0.18s ease-out; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.step-title {
  font-family: 'Advercase', Georgia, serif;
  font-weight: 400;
  font-size: clamp(22px, 5vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  text-align: center;
}

/* form fields (contact step) */
.field { margin-bottom: 20px; }
.label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

input[type='email'],
input[type='tel'],
input[type='text'],
input[type='search'] {
  width: 100%;
  background: var(--surface);
  border: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.07);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 17px; /* must stay >= 16px so iOS doesn't auto-zoom on focus */
  outline: none;
  transition: box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: var(--ink-soft); opacity: 0.55; }
input:focus { box-shadow: 0 0 0 3px rgba(51, 46, 43, 0.14), 0 1px 2px rgba(0,0,0,0.06); }

/* ── intl-tel-input overrides ─────────────────────────────────────────────
   The lib wraps #phone in a .iti container with a flag dropdown.
   We match its chrome to our existing input style and clean up the
   mobile full-screen sheet. */

.iti { display: block; width: 100%; }
.iti__tel-input { width: 100%; }

/* Flag button — match our input border radius on the left side */
.iti__flag-container { border-right: 1px solid rgba(0,0,0,0.08); }
.iti__selected-country { border-radius: var(--radius) 0 0 var(--radius); padding: 0 10px 0 14px; }

/* Inline dropdown (desktop / when fullscreen disabled) */
.iti--inline-dropdown .iti__dropdown-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06);
  overflow: hidden;
}

/* Mobile full-screen sheet — override default appearance */
.iti--fullscreen-popup .iti__dropdown-content {
  border-radius: 20px 20px 0 0;
  max-height: 72dvh;
  border: none;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Search field inside the sheet */
.iti__search-input-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid var(--line);
  background: var(--surface);
  padding: 0 14px;
  gap: 8px;
}
.iti__search-icon { display: flex; align-items: center; flex-shrink: 0; }
.iti__search-icon-svg { width: 16px; height: 16px; color: var(--ink-soft); }
.iti__search-input {
  border: none !important;
  border-radius: 0 !important;
  padding: 14px 0 !important;
  font-size: 16px !important;
  box-shadow: none !important;
  background: transparent !important;
  flex: 1;
  min-width: 0;
}
.iti__search-input:focus { box-shadow: none !important; }

/* Country list */
.iti__country-list {
  overflow-y: auto;
  flex: 1;
  margin: 0;
  padding: 6px 0;
}
.iti__country {
  padding: 11px 16px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.iti__country.iti__highlight { background: var(--bg); }
.iti__dial-code { color: var(--ink-soft); font-size: 14px; }

/* Backdrop behind the sheet */
.iti__tel-input ~ .iti__dropdown-backdrop {
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}
/* Kill iOS search input decorations that cause the "Julia ×" autofill pill */
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration { display: none; }

/* picks row — card grid for selected songs */
.picks-row {
  margin: 0 0 18px;
}
.picks-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.picks-label strong {
  color: var(--ink);
  font-weight: 700;
}
.picks-count {
  font-variant-numeric: tabular-nums;
}

/* picks-grid — unified card component used on all 3 screens.
   Up to 3 columns of album-art + song-title cards. Same markup everywhere;
   only the .picks-grid--jiggle modifier changes behavior on the select screen. */
.picks-grid {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.picks-grid.hidden { display: none !important; }

.pick-card {
  position: relative;
  background: var(--surface);
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.06);
  border-radius: var(--radius);
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Fixed 1/3-width so 1 card centers, 2 center as a pair, 3 fill the row */
  flex: 0 0 calc(33.333% - 7px);
  min-width: 0;
  transform-origin: center;
}
.pick-art {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line);
  display: block;
}
.pick-art--empty { display: block; }
.pick-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* iOS home-screen style jiggle — only active on the select step. */
.picks-grid--jiggle .pick-card {
  animation: pickJiggle 0.32s ease-in-out infinite;
  animation-delay: calc(var(--jiggle-delay, 0s));
}
.picks-grid--jiggle .pick-card:nth-child(2) { --jiggle-delay: -0.08s; animation-duration: 0.34s; }
.picks-grid--jiggle .pick-card:nth-child(3) { --jiggle-delay: -0.16s; animation-duration: 0.30s; }
@keyframes pickJiggle {
  0%   { transform: rotate(-0.9deg) translateY(0); }
  50%  { transform: rotate(0.9deg)  translateY(-0.5px); }
  100% { transform: rotate(-0.9deg) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .picks-grid--jiggle .pick-card { animation: none; }
}

.pick-card.flash { animation: pickFlash 0.5s ease; }
@keyframes pickFlash {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Delete button — only rendered in jiggle mode. Top-right corner, overlapping
   the card edge so it reads as an overlay control like iOS app delete. */
.pick-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--on-accent);
  border: 1.5px solid var(--bg);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.pick-remove:hover { background: #000; }

.picks-empty {
  color: var(--ink-soft);
  font-size: 14px;
  padding: 14px 16px;
  border: 1.5px dashed #c8c4c0;
  border-radius: var(--radius);
  text-align: center;
  background: transparent;
  margin: 0 0 22px;
}
.picks-empty.hidden { display: none !important; }

/* search */
.search { position: relative; margin-bottom: 24px; scroll-margin-top: 16px; }
.search-field { position: relative; }
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
  width: 20px;
  height: 20px;
}
.search-field input { padding-left: 44px; }

/* inline results list (no longer floating dropdown) */
.results {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  background: var(--surface);
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.06);
  border-radius: var(--radius);
  max-height: 440px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.results:empty { display: none; }
.results li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.results li:last-child { border-bottom: none; }
.results li:hover, .results li:active { background: #faf8f6; }
.results .results-empty,
.results li.results-empty {
  color: var(--ink-soft);
  font-size: 14px;
  cursor: default;
  padding: 16px;
  justify-content: center;
}
.results li.results-empty:hover { background: transparent; }
.results .art {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--line);
  flex-shrink: 0;
  object-fit: cover;
}
.results .meta { min-width: 0; flex: 1; }
.results .title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results .artist {
  color: var(--ink-soft);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.results .add-hint {
  color: var(--ink-soft);
  font-size: 22px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}
.results li:hover .add-hint { color: var(--ink); }

/* primary button */
.primary {
  width: 100%;
  padding: 18px 22px;
  font-size: 17px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.05s ease, opacity 0.1s ease;
  background: var(--accent);
  color: var(--on-accent);
}
.primary:disabled {
  background: #cfcbc8;
  color: #fff;
  cursor: not-allowed;
}
.primary:not(:disabled):active { transform: translateY(1px); }
.primary.loading { position: relative; color: transparent; }
.primary.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(245, 245, 245, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* secondary — plain text link, no background or border */
.secondary {
  background: none;
  border: none;
  padding: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.1s ease;
  text-decoration: none;
}
.secondary:hover { color: var(--ink); }

.arrow { display: inline-block; transition: transform 0.15s ease; }
.primary:not(:disabled):hover .arrow { transform: translateX(3px); }

/* sticky footer containing the CTA button(s) */
.sticky-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(
    to bottom,
    rgba(245, 245, 245, 0) 0%,
    rgba(245, 245, 245, 0.92) 35%,
    rgba(245, 245, 245, 1) 100%
  );
  z-index: 20;
  display: flex;
  justify-content: center;
}
.sticky-footer > .primary {
  max-width: 540px;
  width: 100%;
}
.sticky-footer.row {
  gap: 0;
  align-items: center;
}
/* Back sits left-aligned, Submit fills the rest */
.sticky-footer.row > .secondary { flex: 0 0 auto; padding: 18px 4px 18px 0; }
.sticky-footer.row > .primary { flex: 1 1 auto; max-width: none; margin-left: 20px; }
@media (min-width: 640px) {
  /* On desktop, the sticky footer constrains itself to the content column
     so it doesn't span the full viewport edge-to-edge. */
  .sticky-footer {
    max-width: 584px; /* 540 + 22 + 22 padding */
    margin: 0 auto;
  }
}

.done-cta {
  text-align: center;
  color: var(--ink-soft);
  margin: 24px 0 0;
  font-size: 15px;
}
.done-cta a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Admin styles live in admin.html via Tailwind — intentionally no rules here. */
