/* ─── Rainbow Knitting unified design system ───────────────────────────────
   Palette rooted in traditional textile dye colors (indigo, madder) and
   yarn-craft vocabulary — see docs/ARCHITECTURE.md for the full rationale.
   Signature element: the "rainbow thread" gradient rule + "yarn-tag" chips.
──────────────────────────────────────────────────────────────────────── */

:root {
  --canvas:      #F7F4EE;
  --canvas-cool: #F9F8F5; /* platform app screens */
  --ink:         #1B1B18;
  --indigo:      #28305B;
  --indigo-dark: #1B213F;
  --indigo-light:#E4E6F0;
  --madder:      #B5502F;
  --madder-light:#F5E3DB;
  --brass:       #9C7A2E;
  --brass-light: #F0E8D2;
  --stone:       #8A8378;
  --stone-light: #E7E3DA;
  --teal:        #3E7C74;

  --thread: linear-gradient(90deg, var(--indigo) 0%, var(--teal) 38%, var(--brass) 68%, var(--madder) 100%);

  --font-display: 'Fraunces', 'Noto Serif SC', 'Noto Serif TC', 'Noto Serif JP', 'Noto Serif KR', Georgia, serif;
  --font-body: 'Inter', 'Noto Sans SC', 'Noto Sans TC', 'Noto Sans JP', 'Noto Sans KR', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 3px rgba(27,27,24,.06), 0 8px 24px rgba(27,27,24,.05);
}

body {
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
}

body.site-platform {
  background-color: var(--canvas-cool);
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
}

:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3 { font-family: 'Noto Serif SC', var(--font-display); }
:lang(zh-Hant) h1, :lang(zh-Hant) h2, :lang(zh-Hant) h3 { font-family: 'Noto Serif TC', var(--font-display); }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { font-family: 'Noto Serif JP', var(--font-display); }
:lang(ko) h1, :lang(ko) h2, :lang(ko) h3 { font-family: 'Noto Serif KR', var(--font-display); }

code, .mono, .data-value {
  font-family: var(--font-mono);
}

/* ─── The rainbow thread — the one signature motif, used sparingly ────── */
.thread-rule {
  height: 5px;
  border: none;
  border-radius: 99px;
  background: var(--thread);
  width: 72px;
  margin: 0.75rem 0 1.5rem;
}

.thread-underline {
  position: relative;
  display: inline-block;
}
.thread-underline::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -0.35em;
  height: 4px;
  border-radius: 99px;
  background: var(--thread);
}

/* ─── Yarn-tag status chips — the thread motif made functional ────────── */
.yarn-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem 0.25rem 0.6rem;
  border-radius: 4px 12px 12px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  position: relative;
}
.yarn-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.yarn-tag.kyb-pending  { background: var(--brass-light); color: var(--brass); }
.yarn-tag.kyb-verified { background: #E1EFEA; color: #2E6B57; }
.yarn-tag.kyb-rejected { background: var(--madder-light); color: var(--madder); }
.yarn-tag.rfx-draft    { background: var(--stone-light); color: var(--stone); }
.yarn-tag.rfx-sent     { background: var(--indigo-light); color: var(--indigo); }
.yarn-tag.rfx-closed   { background: var(--stone-light); color: #4B463D; }
.yarn-tag.rfx-responded{ background: #E1EFEA; color: #2E6B57; }
.yarn-tag.rfx-declined { background: var(--madder-light); color: var(--madder); }
.yarn-tag.tier-free    { background: var(--stone-light); color: var(--stone); }
.yarn-tag.tier-network { background: var(--indigo-light); color: var(--indigo); }
.yarn-tag.tier-premium { background: var(--brass-light); color: var(--brass); }

/* ─── Navbar ────────────────────────────────────────────────────────────*/
.rb-navbar {
  background: var(--indigo);
}
.rb-navbar .navbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff !important;
}
.rb-navbar .nav-link {
  color: rgba(255,255,255,.82) !important;
  font-weight: 500;
  font-size: .9rem;
}
.rb-navbar .nav-link:hover,
.rb-navbar .nav-link.active {
  color: #fff !important;
}
.rb-navbar .nav-link.active {
  position: relative;
}
.rb-navbar .nav-link.active::after {
  content: '';
  position: absolute;
  left: .75rem; right: .75rem; bottom: -2px;
  height: 3px;
  border-radius: 99px;
  background: var(--thread);
}

/* ─── Buttons ───────────────────────────────────────────────────────────*/
.btn-rb-primary {
  background: var(--indigo);
  border: 1px solid var(--indigo);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.btn-rb-primary:hover { background: var(--indigo-dark); color: #fff; }

.btn-rb-outline {
  border: 1.5px solid var(--indigo);
  color: var(--indigo);
  background: transparent;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.btn-rb-outline:hover { background: var(--indigo-light); color: var(--indigo-dark); }

.btn-rb-danger {
  background: var(--madder);
  border: 1px solid var(--madder);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* ─── Cards ─────────────────────────────────────────────────────────────*/
.rb-card {
  border: 1px solid var(--stone-light);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.swatch-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--indigo);
}
.swatch-chip::before {
  content: '';
  width: 12px; height: 12px;
  border-radius: 3px;
  background: var(--thread);
  display: inline-block;
}

/* ─── Stat tiles ────────────────────────────────────────────────────────*/
.stat-tile {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--stone-light);
}
.stat-tile .stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--indigo); line-height: 1; }
.stat-tile .stat-label { font-size: .8rem; color: var(--stone); margin-top: .35rem; }

/* ─── Hero (marketing + bio) ────────────────────────────────────────────*/
.rb-hero {
  background: var(--canvas);
  padding: 5rem 0 4rem;
}
.rb-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.1;
}
.rb-hero .lead { color: var(--stone); font-size: 1.2rem; }

.rb-hero-bio {
  background: var(--indigo);
  color: #F7F4EE;
  padding: 5rem 0;
}
.rb-hero-bio .lead { color: #C7CBDE; }

/* ─── Footer ────────────────────────────────────────────────────────────*/
.rb-footer {
  background: var(--indigo-dark);
  color: rgba(247,244,238,.65);
  font-size: .85rem;
  padding: 2.5rem 0;
}
.rb-footer a { color: rgba(247,244,238,.8); text-decoration: none; }
.rb-footer a:hover { color: #fff; }

/* ─── Forms ─────────────────────────────────────────────────────────────*/
.form-control:focus, .form-select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 .2rem var(--indigo-light);
}

/* ─── Progress bar ──────────────────────────────────────────────────────*/
.progress-bar.rb-thread { background: var(--thread); }

/* ─── Table scroll wrapper ──────────────────────────────────────────────*/
.table-scroll { overflow-x: auto; }
