/* ==========================================================================
   RiceMatrix — Staplefeed Inc.
   ========================================================================== */

:root {
  --bg: #0a0e13;
  --bg-alt: #0e141b;
  --surface: #121924;
  --surface-2: #17202c;
  --border: #24303f;
  --text: #eef2f6;
  --text-dim: #9aa8b8;
  --text-faint: #6b7889;
  --gold: #e9c25f;
  --gold-soft: #d9ac3d;
  --green: #163a2c;
  --up: #3ecf8e;
  --down: #f0616d;
  --accent-blue: #4f8cff;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-lg: 0 20px 60px -20px rgba(0,0,0,0.6);
  --header-h: 72px;
  --max-w: 1200px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; }

.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 24px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--gold);
  color: #14210f;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 1000;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 12px;
}

/* Focus visibility for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%); color: #17210f; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text); }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(10, 14, 19, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 8px 24px -16px rgba(0,0,0,0.5);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark { display: inline-flex; }
.brand-name {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand-name strong { color: var(--gold); font-weight: 700; }
.brand-name sup { font-size: 0.55em; color: var(--text-faint); }
.brand-name.small { font-size: 1rem; }

.primary-nav { flex: 1; display: flex; justify-content: center; }
.nav-list { display: flex; align-items: center; gap: 32px; }
.nav-link {
  font-size: 0.94rem;
  color: var(--text-dim);
  font-weight: 500;
  position: relative;
  padding: 6px 2px;
  transition: color 0.2s var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--gold);
  transition: right 0.25s var(--ease);
}
.nav-link:hover::after { right: 0; }

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-toggle-box { position: relative; width: 20px; height: 14px; display: block; }
.nav-toggle-bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease), top 0.25s var(--ease);
}
.nav-toggle-bar:nth-child(1) { top: 0; }
.nav-toggle-bar:nth-child(2) { top: 6px; }
.nav-toggle-bar:nth-child(3) { top: 12px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { top: 6px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* Mobile off-canvas nav */
.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 9, 0.6);
  backdrop-filter: blur(2px);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.nav-scrim.is-visible { opacity: 1; }

.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  box-shadow: var(--shadow-lg);
}
.mobile-nav.is-open { transform: translateX(0); }
.mobile-nav[hidden] { display: none; }

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.nav-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
}
.nav-close:hover { border-color: var(--gold); color: var(--gold); }

.mobile-nav-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.mobile-nav-link {
  display: block;
  padding: 13px 10px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius-sm);
}
.mobile-nav-link:hover, .mobile-nav-link:focus-visible { background: var(--surface-2); color: var(--gold); }

.mobile-nav-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.mobile-nav-footer { margin-top: 16px; font-size: 0.8rem; color: var(--text-faint); text-align: center; }

/* ============ Hero ============ */
.hero {
  position: relative;
  padding: 88px 0 64px;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(closest-side, rgba(233, 194, 95, 0.16), transparent 70%);
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  position: relative;
}
.eyebrow {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.eyebrow.center { text-align: center; }
h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 20px;
}
.text-gradient {
  background: linear-gradient(135deg, var(--gold) 0%, #f4de9a 50%, var(--gold-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--text-dim);
  font-size: 1.08rem;
  max-width: 54ch;
  margin-bottom: 30px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-cta.center { justify-content: center; }
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 28px;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.hero-trust li { position: relative; padding-left: 16px; }
.hero-trust li::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--up);
  transform: translateY(-50%);
}

/* Index card */
.hero-panel { position: relative; }
.index-card {
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
}
.index-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.index-value {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.index-value span { font-size: 1rem; color: var(--text-faint); font-weight: 500; }
.index-desc { color: var(--text-faint); font-size: 0.82rem; margin-bottom: 18px; }
.index-chart svg { width: 100%; height: 90px; display: block; }
.index-legs {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.index-legs > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.leg-label { font-size: 0.78rem; color: var(--text-faint); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.sm { padding: 3px 9px; font-size: 0.72rem; }
.badge-up { background: rgba(62, 207, 142, 0.14); color: var(--up); }
.badge-down { background: rgba(240, 97, 109, 0.14); color: var(--down); }

/* ============ Ticker ============ */
.ticker-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
  padding: 12px 0;
}
.ticker-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: ticker-scroll 34s linear infinite;
}
.ticker-strip:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ticker-item {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.ticker-item b { color: var(--text); font-weight: 600; }
.ticker-item em { font-style: normal; font-weight: 700; }
.ticker-item em.up { color: var(--up); }
.ticker-item em.down { color: var(--down); }

/* ============ Stats ============ */
.stats { padding: 52px 0; border-bottom: 1px solid var(--border); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--gold); letter-spacing: -0.02em; }
.stat-label { color: var(--text-faint); font-size: 0.85rem; }

/* ============ Sections ============ */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  max-width: 40ch;
}
.section-title.center { margin-inline: auto; text-align: center; }
.section-sub {
  color: var(--text-dim);
  max-width: 60ch;
  margin-bottom: 48px;
  font-size: 1.02rem;
}
.section-sub.center { margin-inline: auto; text-align: center; }
.section-sub.left { text-align: left; margin-bottom: 28px; }

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.feature-card:hover { transform: translateY(-3px); border-color: var(--gold-soft); }
.feature-icon { font-size: 1.7rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-dim); font-size: 0.92rem; }

/* Market table */
.market-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}
.market-table { width: 100%; border-collapse: collapse; }
.market-table thead th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.market-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.market-table tbody tr:last-child td { border-bottom: none; }
.market-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table-note { margin-top: 20px; text-align: center; color: var(--text-faint); font-size: 0.9rem; }
.table-note a { color: var(--gold); font-weight: 600; }

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  counter-reset: step;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
}
.step-num {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 14px;
}
.step h3 { font-size: 1.05rem; margin-bottom: 8px; }
.step p { color: var(--text-dim); font-size: 0.9rem; }

/* Trust */
.trust-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: start;
}
.trust-list { display: flex; flex-direction: column; gap: 12px; }
.trust-list li {
  position: relative;
  padding-left: 26px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.trust-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--up);
  font-weight: 700;
}
.trust-card {
  background: linear-gradient(160deg, var(--green) 0%, #0f2419 100%);
  border: 1px solid #24493a;
  border-radius: var(--radius-lg);
  padding: 32px;
}
.trust-card h3 { color: var(--gold); font-size: 1.4rem; margin-bottom: 8px; }
.trust-card p { color: #cfe3d7; font-size: 0.95rem; margin-bottom: 4px; }
.trust-card-desc { margin-top: 14px !important; color: #a9c4b6 !important; }

/* CTA banner */
.cta-banner {
  padding: 80px 0;
  text-align: center;
  background: radial-gradient(120% 140% at 50% 0%, rgba(233,194,95,0.1), transparent 60%), var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cta-inner h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 12px; }
.cta-inner p { color: var(--text-dim); margin-bottom: 30px; }

/* ============ Footer ============ */
.site-footer { padding: 64px 0 0; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}
.footer-brand p { color: var(--text-faint); font-size: 0.9rem; margin-top: 12px; max-width: 32ch; }
.footer-col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 16px; }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--text-dim); font-size: 0.92rem; }
.footer-col a:hover { color: var(--gold); }
.footer-col address { font-style: normal; color: var(--text-dim); font-size: 0.92rem; line-height: 1.7; }
.footer-col address strong { color: var(--text); font-weight: 600; }
.footer-col address a { color: var(--gold); }
.footer-contact-label { display: inline-block; min-width: 52px; color: var(--text-faint); font-size: 0.82rem; }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 0 32px;
  color: var(--text-faint);
  font-size: 0.82rem;
  flex-wrap: wrap;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-panel { max-width: 480px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .trust-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .primary-nav, .header-actions .btn { display: none; }
  .nav-toggle { display: inline-flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .container { padding-inline: 18px; }
  .section { padding: 64px 0; }
  .feature-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }

  /* Responsive market table -> stacked cards */
  .market-table thead { display: none; }
  .market-table, .market-table tbody, .market-table tr, .market-table td { display: block; width: 100%; }
  .market-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .market-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    border: none;
    font-size: 0.88rem;
  }
  .market-table td::before {
    content: attr(data-label);
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 600;
  }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 2rem; }
}
