/*
 * X Border Hub — design tokens.
 *
 * v2 refresh (CORE / openmoney aesthetic):
 *  - warm-white background instead of cream/paper
 *  - 1px hairline borders in ink/8–15 (replaces 1.5px solid ink)
 *  - soft layered shadows (replaces 4px offset "pop" stickers)
 *  - no noise / grain overlay
 *  - rounded, calmer buttons
 *  - same class names so component markup keeps working
 */

:root {
  color-scheme: light;
  --xb-bg:           #FAFAF7;     /* warm white   */
  --xb-surface:      #FFFFFF;     /* card surface */
  --xb-paper:        #F4F5F7;     /* secondary tint */
  --xb-ink:          #0A1F3D;
  --xb-ink-soft:     #475569;
  --xb-ink-faint:    #94A3B8;
  --xb-blue:         #0055A4;
  --xb-blue-deep:    #003C7A;
  --xb-blue-soft:    #E5EEF8;
  --xb-border:       rgba(10,31,61,0.10);
  --xb-border-soft:  rgba(10,31,61,0.06);
  --xb-border-bold:  rgba(10,31,61,0.18);
  --xb-radius-card:  16px;
  --xb-radius-pill:  999px;
}

html, body {
  background: var(--xb-bg) !important;
  color: var(--xb-ink) !important;
}
body {
  font-family: 'Manrope', 'Zen Kaku Gothic New', sans-serif;
  -webkit-font-smoothing: antialiased;
}
.display { font-family: 'Bricolage Grotesque', 'Zen Kaku Gothic New', sans-serif; letter-spacing: -0.02em; }
.serif-it { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; letter-spacing: -0.01em; }

/* ============== Color tokens ============== */

.text-cream { color: #FAFAF7; } .bg-cream { background-color: #FAFAF7; }
.text-paper { color: #F4F5F7; } .bg-paper { background-color: #F4F5F7; }
.text-ink   { color: #0A1F3D; } .bg-ink   { background-color: #0A1F3D; }
.text-ink-soft  { color: #475569; }
.text-ink-faint { color: #94A3B8; }
.text-blue        { color: #0055A4; } .bg-blue        { background-color: #0055A4; }
.text-blue-deep   { color: #003C7A; } .bg-blue-deep   { background-color: #003C7A; }
.text-blue-bright { color: #2E7BE8; } .bg-blue-bright { background-color: #2E7BE8; }
.text-blue-soft   { color: #E5EEF8; } .bg-blue-soft   { background-color: #E5EEF8; }
.text-jade        { color: #4ECDC4; } .bg-jade        { background-color: #4ECDC4; }
.text-jade-deep   { color: #1FA89E; } .bg-jade-deep   { background-color: #1FA89E; }
.text-mustard     { color: #FFC93C; } .bg-mustard     { background-color: #FFC93C; }
.text-plum        { color: #6B4F8E; } .bg-plum        { background-color: #6B4F8E; }

/* Border-ink is now a hairline ink tint, not a solid stamp. */
.border-ink { border-color: var(--xb-border); }

/* ============== Shadows ============== */
/* The "pop" name is kept so existing TSX keeps compiling, but each one
 * resolves to a calm, layered shadow. */
.shadow-pop      { box-shadow: 0 1px 2px rgba(10,31,61,0.06), 0 1px 3px rgba(10,31,61,0.04); }
.shadow-pop-sm   { box-shadow: 0 1px 2px rgba(10,31,61,0.05); }
.shadow-pop-blue { box-shadow: 0 6px 18px rgba(0,85,164,0.18); }
.shadow-pop-lg   { box-shadow: 0 4px 14px rgba(10,31,61,0.08), 0 1px 3px rgba(10,31,61,0.04); }

/* ============== Grain texture: disabled ============== */
.noise::before { content: none; }

/* ============== Animations ============== */
@keyframes dash { to { stroke-dashoffset: -200; } }
.arc-flow { stroke-dasharray: 6 10; animation: dash 6s linear infinite; }

@keyframes pulse-soft {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.85; }
}
.pulse-soft { animation: pulse-soft 2.4s ease-in-out infinite; transform-origin: center; }

@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-track { animation: tickerScroll 40s linear infinite; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }

/* ============== Cards ============== */

/* "Boarding pass" detail card — softened, kept distinct via tint */
.pass {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 14px;
  position: relative;
  box-shadow: 0 1px 2px rgba(10,31,61,0.04);
}
.pass::before, .pass::after { content: none; } /* punch-outs removed in v2 */

/* Highlight underline — kept subtle; only used on big serif accents */
.u-blue {
  background-image: linear-gradient(180deg, transparent 60%, rgba(0,85,164,0.18) 60%, rgba(0,85,164,0.18) 92%, transparent 92%);
  padding: 0 0.05em;
}
.u-mustard {
  background-image: linear-gradient(180deg, transparent 60%, rgba(255,201,60,0.42) 60%, rgba(255,201,60,0.42) 92%, transparent 92%);
  padding: 0 0.05em;
}

/* Interactive buttons (tabs etc.) */
.region-btn, .trend-tab, .sort-tab { transition: all 0.15s; }
.region-btn.active { background: var(--xb-ink) !important; color: #fff !important; border-color: var(--xb-ink); }
.trend-tab.active, .sort-tab.active { background: var(--xb-ink); color: #fff; }

.stamp { transform: none; } /* no rotation in v2 */
.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }

#migration-map { transition: opacity 0.25s; }
#migration-map.swapping { opacity: 0.25; }

/* Search result card */
.result-card {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: var(--xb-radius-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.result-card:hover {
  border-color: var(--xb-border-bold);
  box-shadow: 0 4px 14px rgba(10,31,61,0.06);
}

/* ============== Modal ============== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,31,61,0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--xb-surface);
  border-top: 1px solid var(--xb-border);
  border-radius: 24px 24px 0 0;
  padding: 8px 0 24px;
  max-width: 28rem; margin: 0 auto;
  transform: translateY(100%);
  opacity: 0; visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.2,0.8,0.2,1), opacity 0.25s, visibility 0.25s;
  max-height: 75vh; overflow-y: auto;
}
.modal-sheet.open { transform: translateY(0); opacity: 1; visibility: visible; }
@media (min-width: 768px) {
  .modal-sheet {
    max-width: 36rem;
    left: 50%; right: auto; top: 50%; bottom: auto;
    transform: translate(-50%, -50%) scale(0.96);
    border-radius: 18px;
    border: 1px solid var(--xb-border);
    box-shadow: 0 24px 60px rgba(10,31,61,0.18), 0 2px 4px rgba(10,31,61,0.06);
    max-height: 85vh;
    padding: 16px 0 28px;
  }
  .modal-sheet.open { transform: translate(-50%, -50%) scale(1); }
}
@media (min-width: 1024px) { .modal-sheet { max-width: 48rem; } }
@media (min-width: 1280px) { .modal-sheet { max-width: 56rem; } }
@media (min-width: 1536px) { .modal-sheet { max-width: 64rem; } }

/* ============== Option list (legacy) ============== */
.opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: 12px;
  transition: background 0.15s; cursor: pointer;
}
.opt:hover { background: var(--xb-paper); }
.opt.selected { background: var(--xb-ink); color: #fff; }
.opt.selected .opt-count { color: #FFC93C; }

/* ============== Search input ============== */
.search-input {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 12px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  color: var(--xb-ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.search-input:hover, .search-input:focus {
  border-color: var(--xb-ink);
  box-shadow: 0 0 0 3px rgba(10,31,61,0.06);
  outline: none;
}
.search-input.filled { background: var(--xb-ink); color: #fff; }
.search-input.filled .placeholder { display: none; }

/* ============== Form field ============== */
.field {
  display: block; width: 100%;
  padding: 11px 14px;
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 12px;
  font-family: 'Manrope', 'Zen Kaku Gothic New', sans-serif;
  font-weight: 500; font-size: 14px;
  color: var(--xb-ink); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field:focus {
  border-color: var(--xb-blue);
  box-shadow: 0 0 0 3px rgba(0,85,164,0.15);
}
.field::placeholder { color: var(--xb-ink-faint); font-weight: 400; }
textarea.field { resize: vertical; min-height: 96px; }

.label {
  display: block;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--xb-ink-soft);
  margin-bottom: 6px;
}

/* Tag */
.chip { transition: transform 0.15s, background 0.15s; }
.chip:active { transform: translateY(1px); }

/* ============== Logo mark ============== */
.logo-mark {
  width: 32px; height: 32px;
  background: var(--xb-blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800; font-size: 16px;
  box-shadow: 0 1px 2px rgba(10,31,61,0.10);
  position: relative;
  flex-shrink: 0;
}
.logo-mark::after { content: none; } /* mustard dot removed in v2 */

.logo-mark-lg {
  width: 52px; height: 52px;
  border-radius: 12px;
  font-size: 24px;
  box-shadow: 0 2px 6px rgba(10,31,61,0.12);
}

/* Section divider */
.divider-dot {
  display: flex; align-items: center; gap: 8px;
  color: var(--xb-ink-faint);
}
.divider-dot::before, .divider-dot::after {
  content: ''; flex: 1; height: 1px; background: var(--xb-border);
}

/* Quote bubble */
.quote-bubble {
  background: var(--xb-paper);
  border: 1px solid var(--xb-border);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 16px;
  position: relative;
}

/* Step number */
.step-num {
  width: 32px; height: 32px;
  background: var(--xb-ink); color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}

/* ============== Buttons ============== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  background: var(--xb-ink); color: #fff;
  border: none;
  border-radius: var(--xb-radius-pill);
  font-weight: 700; font-size: 14px;
  box-shadow: 0 1px 2px rgba(10,31,61,0.18), 0 4px 12px rgba(10,31,61,0.10);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  cursor: pointer;
}
.btn-primary:hover  { background: #142E55; box-shadow: 0 2px 4px rgba(10,31,61,0.22), 0 8px 16px rgba(10,31,61,0.12); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: var(--xb-ink-faint); box-shadow: none; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  background: var(--xb-surface); color: var(--xb-ink);
  border: 1px solid var(--xb-border);
  border-radius: var(--xb-radius-pill);
  font-weight: 700; font-size: 14px;
  box-shadow: 0 1px 2px rgba(10,31,61,0.04);
  transition: border-color 0.12s, background 0.12s;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--xb-ink); background: var(--xb-paper); }

.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 16px;
  background: var(--xb-surface); color: var(--xb-ink);
  border: 1px solid var(--xb-border);
  border-radius: 12px;
  font-weight: 700; font-size: 13px;
  transition: border-color 0.12s, background 0.12s;
  cursor: pointer;
}
.btn-oauth:hover { border-color: var(--xb-ink); background: var(--xb-paper); }

/* FAQ */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details .faq-arrow { transition: transform 0.25s; }
details[open] .faq-arrow { transform: rotate(45deg); }

/* ============== RESPONSIVE CONTAINERS ============== */
.container-app {
  max-width: 28rem;
  margin-left: auto; margin-right: auto;
  padding-left: 20px; padding-right: 20px;
}
.container-narrow {
  max-width: 28rem;
  margin-left: auto; margin-right: auto;
}
.container-wide {
  max-width: 64rem;
  margin-left: auto; margin-right: auto;
}

.app-grid { display: block; max-width: 48rem; margin-left: auto; margin-right: auto; }
.sidebar-nav { display: none; }

@media (min-width: 768px) {
  .container-app    { max-width: 44rem; padding-left: 24px; padding-right: 24px; }
  .container-narrow { max-width: 40rem; }
}

@media (min-width: 1024px) {
  .container-app    { max-width: 80rem; padding-left: 32px; padding-right: 32px; }
  .container-narrow { max-width: 48rem; }
  .container-wide   { max-width: 80rem; padding-left: 32px; padding-right: 32px; }

  .app-grid {
    max-width: 76rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 32px;
    align-items: start;
  }
  .app-grid-main  { min-width: 0; }
  .app-grid-side  { position: sticky; top: 80px; align-self: start; }

  .bottom-nav-mobile { display: none !important; }
  .sidebar-nav { display: block; }
  body { padding-bottom: 0 !important; }
}

@media (min-width: 1280px) {
  .container-app    { max-width: 88rem; }
  .container-wide   { max-width: 88rem; }
  .app-grid {
    max-width: 84rem;
    grid-template-columns: minmax(0, 1fr) 20rem;
    gap: 40px;
  }
}

/* Map should never exceed reasonable size */
#migration-map, .map-svg-wrap svg { max-width: 100%; height: auto; }

/* Hero on desktop */
@media (min-width: 1024px) {
  .hero-desktop {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
  }
}

/* ============== Auth card ============== */
.auth-card {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 14px rgba(10,31,61,0.06);
}
@media (min-width: 768px) {
  .auth-card { padding: 36px; }
}

/* Salary mosaic */
.mosaic {
  display: inline-block;
  background: linear-gradient(110deg, #E2E5EA 0%, #F0F2F5 50%, #E2E5EA 100%);
  color: transparent !important;
  border-radius: 4px;
  user-select: none;
  letter-spacing: 0.05em;
  padding: 0 6px;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
}
.status-pending   { background: rgba(255,201,60,0.16);  color: #8A6500; border-color: rgba(255,201,60,0.45); }
.status-approved  { background: rgba(78,205,196,0.16);  color: #0F7068; border-color: rgba(78,205,196,0.45); }
.status-completed { background: rgba(0,85,164,0.10);    color: #003C7A; border-color: rgba(0,85,164,0.30); }
.status-rejected  { background: rgba(10,31,61,0.06);    color: #475569; border-color: var(--xb-border); }

/* Vote buttons (good/bad) */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--xb-ink);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.vote-btn:hover { border-color: var(--xb-ink); }
.vote-btn.voted-up   { background: #E7F8F2; color: #0F7068; border-color: rgba(31,168,158,0.45); }
.vote-btn.voted-down { background: #F2EAF6; color: #4B3475; border-color: rgba(107,79,142,0.40); }

/* Thread card */
.thread-card {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(10,31,61,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  display: block;
}
.thread-card:hover {
  border-color: var(--xb-border-bold);
  box-shadow: 0 4px 14px rgba(10,31,61,0.06);
}

/* Chat bubble */
.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-me {
  background: var(--xb-ink);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.chat-other {
  background: var(--xb-paper);
  color: var(--xb-ink);
  border: 1px solid var(--xb-border);
  border-radius: 16px 16px 16px 4px;
}

/* Hide on mobile, show on desktop */
.lg-only { display: none; }
@media (min-width: 1024px) { .lg-only { display: block; } }

/* Hide on desktop, show on mobile */
.mobile-only { display: block; }
@media (min-width: 1024px) { .mobile-only { display: none; } }

/* Desktop sidebar */
.side-nav-card {
  background: var(--xb-surface);
  border: 1px solid var(--xb-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(10,31,61,0.04);
}
.side-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--xb-ink-soft);
  transition: background 0.12s, color 0.12s;
}
.side-nav-link:hover { background: var(--xb-paper); color: var(--xb-ink); }
.side-nav-link.active { background: var(--xb-ink); color: #fff; }
