/* ============================================================
   UViiVe Research Digest — Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0f1f3d;
  --navy-light: #162847;
  --navy-mid:   #1e3a5f;
  --teal:       #0ea5e9;
  --teal-dark:  #0284c7;
  --teal-light: #bae6fd;
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-700:   #334155;
  --gray-900:   #0f172a;
  --red:        #ef4444;
  --red-dark:   #dc2626;
  --green:      #10b981;
  --green-light:#d1fae5;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl:  0 20px 25px rgba(0,0,0,.10), 0 8px 10px rgba(0,0,0,.04);
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout Helpers ───────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container--wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Header / Nav ─────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  text-decoration: none;
}

.logo__name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.5px;
}

.logo__name span {
  color: var(--teal);
}

.logo__badge {
  font-size: .65rem;
  font-weight: 600;
  color: var(--teal-light);
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(14,165,233,.18);
  padding: .15rem .45rem;
  border-radius: 100px;
  border: 1px solid rgba(14,165,233,.3);
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 4rem 0 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(14,165,233,.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 1rem;
  background: rgba(14,165,233,.12);
  padding: .35rem .85rem;
  border-radius: 100px;
  border: 1px solid rgba(14,165,233,.25);
}

.hero__headline {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
}

.hero__headline span {
  color: var(--teal);
}

.hero__sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,.78);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ── Feature pills ────────────────────────────────────────── */
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  padding: .35rem .85rem;
  border-radius: 100px;
}

.pill svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card__header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 1.6rem 2rem;
  color: var(--white);
}

.card__header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.card__header p {
  font-size: .875rem;
  color: rgba(255,255,255,.7);
  margin-top: .3rem;
}

.card__body {
  padding: 2rem;
}

/* ── Form elements ────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .45rem;
  letter-spacing: -.01em;
}

.form-label .required {
  color: var(--red);
  margin-left: .2rem;
}

.form-label .hint {
  font-weight: 400;
  color: var(--gray-400);
  font-size: .78rem;
  margin-left: .4rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: .7rem 1rem;
  font-size: .95rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.form-input::placeholder { color: var(--gray-400); }

.form-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.form-error {
  font-size: .8rem;
  color: var(--red);
  margin-top: .35rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Tag input ────────────────────────────────────────────── */
.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  cursor: text;
  min-height: 48px;
  align-items: center;
  transition: border-color .15s, box-shadow .15s;
}

.tag-input-container:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}

.tag-input-container.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(14,165,233,.1);
  color: var(--teal-dark);
  border: 1px solid rgba(14,165,233,.25);
  border-radius: 100px;
  padding: .2rem .55rem .2rem .65rem;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  animation: chipIn .15s ease;
}

@keyframes chipIn {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.tag-chip__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--teal-dark);
  display: flex;
  align-items: center;
  padding: 1px;
  border-radius: 50%;
  opacity: .7;
  transition: opacity .12s, background .12s;
}

.tag-chip__remove:hover {
  opacity: 1;
  background: rgba(14,165,233,.2);
}

.tag-chip__remove svg { width: 12px; height: 12px; }

.tag-text-input {
  border: none;
  outline: none;
  font-family: inherit;
  font-size: .9rem;
  color: var(--gray-900);
  min-width: 120px;
  flex: 1;
  background: transparent;
  padding: .1rem 0;
}

.tag-text-input::placeholder { color: var(--gray-400); }

.tag-hint {
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: .35rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  outline: none;
  letter-spacing: -.01em;
}

.btn:focus-visible { box-shadow: 0 0 0 3px rgba(14,165,233,.4); }

.btn--primary {
  background: var(--teal);
  color: var(--white);
  width: 100%;
}

.btn--primary:hover:not(:disabled) {
  background: var(--teal-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--primary:active:not(:disabled) { transform: translateY(0); }

.btn--secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--gray-200);
}

.btn--danger {
  background: var(--red);
  color: var(--white);
}

.btn--danger:hover:not(:disabled) {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.btn--outline-danger {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
}

.btn--outline-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.06);
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.spinner--dark {
  border-color: rgba(15,31,61,.2);
  border-top-color: var(--navy);
}

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

/* ── Alert / Banner ───────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  font-size: .9rem;
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  animation: alertIn .2s ease;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: .05rem; }

.alert--success {
  background: var(--green-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert--error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert--info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.alert--warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert__body { flex: 1; }
.alert__title { font-weight: 600; margin-bottom: .2rem; }
.alert__text  { line-height: 1.5; }

/* ── Token display ────────────────────────────────────────── */
.token-box {
  background: var(--gray-100);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  color: var(--gray-700);
  word-break: break-all;
  letter-spacing: .05em;
  margin-top: .5rem;
}

/* ── Section ──────────────────────────────────────────────── */
.main-section {
  padding: 3rem 0;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 1.75rem 0;
  font-size: .825rem;
  margin-top: auto;
}

.site-footer a {
  color: var(--teal);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 420px;
  width: 100%;
  animation: modalIn .18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);    }
}

.modal__header {
  padding: 1.4rem 1.6rem 0;
}

.modal__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fee2e2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .9rem;
}

.modal__icon svg { width: 22px; height: 22px; color: var(--red); }

.modal__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: .5rem;
}

.modal__body {
  padding: .75rem 1.6rem 1.4rem;
  font-size: .9rem;
  color: var(--gray-500);
  line-height: 1.6;
}

.modal__footer {
  padding: .8rem 1.6rem 1.4rem;
  display: flex;
  gap: .75rem;
  flex-direction: row-reverse;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 1.5rem 0;
}

/* ── Page-specific: Preferences ──────────────────────────── */
.pref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.pref-section-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

.readonly-field {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  font-size: .9rem;
  color: var(--gray-500);
}

/* ── Page-specific: Unsubscribe ───────────────────────────── */
.unsub-center {
  text-align: center;
  padding: 4rem 0;
}

.unsub-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.unsub-icon svg { width: 36px; height: 36px; color: var(--green); }

.unsub-icon--loading { background: var(--gray-100); }
.unsub-icon--loading svg { color: var(--gray-400); }

.unsub-icon--error { background: #fee2e2; }
.unsub-icon--error svg { color: var(--red); }

/* ── Loading skeleton ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .pref-grid { grid-template-columns: 1fr; }
  .card__body { padding: 1.4rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .modal__footer { flex-direction: column; }
}
