/* ============================================================
   Haystack Archive – Landing Page & Guide Styles
   Theme matched to Gradio app (start.py _THEME_CSS)
   ============================================================ */

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

/* ---------- design tokens ---------- */
:root {
  --bg:            #0a0f14;
  --bg-elev:       #101821;
  --panel:         #121a23;
  --panel-soft:    #0e151d;
  --panel-strong:  #182432;
  --line:          #233140;
  --line-strong:   #35506c;
  --text:          #edf3f8;
  --muted:         #95a6b8;
  --muted-soft:    #6f8295;
  --accent:        #7dc4ff;
  --accent-strong: #2e86d8;
  --archive:       #d8b16b;
  --good:          #59c98c;
  --warn:          #f0b35d;
  --bad:           #ef6b61;
  --serif:         'Georgia','Palatino Linotype','Times New Roman',serif;
  --sans:          'Inter','Segoe UI Variable Text','Segoe UI',system-ui,sans-serif;
  --mono:          'Consolas','SFMono-Regular','Cascadia Mono',monospace;
  --radius:        14px;
  --radius-lg:     18px;
  --shadow:        0 18px 45px rgba(0,0,0,.28);
  --max-w:         1140px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(125,196,255,.10), transparent 35%),
    radial-gradient(circle at 85% 8%, rgba(216,177,107,.08), transparent 28%),
    linear-gradient(180deg, #0b1016 0%, #0a0f14 48%, #0d131a 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--archive); }

img { max-width: 100%; height: auto; display: block; }

/* ---------- utility ---------- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-archive { color: var(--archive); }
.text-accent { color: var(--accent); }

/* ---------- section scaffolding ---------- */
.section {
  padding: 120px 0;
  position: relative;
}
.section--hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0 60px;
}
.section--alt {
  background: rgba(16,24,33,.55);
}
.section--full-screenshot {
  padding: 80px 0;
}

/* ---------- scroll animations ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(44px);
  transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
/* stagger children */
.fade-up .stagger-1 { transition-delay: .08s; }
.fade-up .stagger-2 { transition-delay: .16s; }
.fade-up .stagger-3 { transition-delay: .24s; }
.fade-up .stagger-4 { transition-delay: .32s; }
.fade-up .stagger-5 { transition-delay: .40s; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fade-up { opacity: 1; transform: none; transition: none; }
}

/* ---------- kicker (small label above headings) ---------- */
.kicker {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--archive);
  margin-bottom: 16px;
}

/* ---------- headings ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); color: var(--text); margin-bottom: 20px; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); color: var(--text); margin-bottom: 16px; }
h3 { font-size: 1.25rem; color: var(--text); margin-bottom: 10px; }

/* ---------- hero ---------- */
.hero__inner {
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--muted);
  margin-bottom: 40px;
  line-height: 1.55;
}

/* hero logo */
.hero__logo {
  display: block;
  margin: 0 auto 28px;
  width: 168px;
  height: 168px;
  border-radius: 32px;
  box-shadow: 0 12px 40px rgba(216,177,107,.25), 0 0 80px rgba(216,177,107,.08);
  transition: transform .4s cubic-bezier(.22,1,.36,1);
}
.hero__logo:hover {
  transform: scale(1.05);
}
@media (max-width: 768px) {
  .hero__logo { width: 120px; height: 120px; border-radius: 24px; margin-bottom: 20px; }
}

/* CTA button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--sans);
  color: #fff;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border: none;
  border-radius: 60px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .25s, box-shadow .25s, background .3s;
  box-shadow: 0 4px 24px rgba(46,134,216,.35);
}
.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(46,134,216,.5);
  color: #fff;
}
.btn-cta:active { transform: translateY(0); }

.btn-cta--outline {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: none;
}
.btn-cta--outline:hover {
  background: rgba(125,196,255,.1);
  box-shadow: 0 4px 20px rgba(125,196,255,.15);
  color: var(--accent);
}

/* scroll indicator */
.scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted-soft);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  animation: bounce-hint 2.4s ease-in-out infinite;
}
.scroll-hint svg { width: 20px; height: 20px; stroke: var(--muted-soft); }
@keyframes bounce-hint {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(8px); }
}

/* ---------- big numbers (scale section) ---------- */
.big-number {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 8vw, 6.5rem);
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}
.big-number-sub {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--archive);
  margin-bottom: 32px;
}
.collection-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}
.collection-tag {
  padding: 8px 18px;
  font-size: .82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 40px;
  background: rgba(18,26,35,.6);
  transition: border-color .3s, color .3s;
}
.collection-tag:hover {
  border-color: var(--archive);
  color: var(--text);
}

/* ---------- split layout (text + visual) ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}
.split--reverse { direction: rtl; }
.split--reverse > * { direction: ltr; }

.split__text p {
  color: var(--muted);
  margin-bottom: 16px;
  font-size: .95rem;
}
.split__text ul {
  list-style: none;
  padding: 0;
}
.split__text ul li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .92rem;
}
.split__text ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--archive);
}

/* screenshot placeholder / frame */
.screenshot-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 16/10;
}
.screenshot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
}
/* hero screenshot: let wide banner images display naturally */
.screenshot-hero.screenshot-frame {
  aspect-ratio: auto;
}
.screenshot-hero.screenshot-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

/* placeholder state (no image yet) */
.screenshot-frame--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-soft);
  font-size: .85rem;
  letter-spacing: .05em;
}
.screenshot-frame--placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(125,196,255,.04) 0%, transparent 50%),
    linear-gradient(225deg, rgba(216,177,107,.04) 0%, transparent 50%);
}

/* large hero screenshot (full width) */
.screenshot-hero {
  max-width: 960px;
  margin: 40px auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

/* ---------- feature cards (3-col) ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.feature-card {
  background: rgba(18,26,35,.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  transition: border-color .3s, transform .3s;
}
.feature-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
}
.feature-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(125,196,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent);
}
.feature-card__icon svg { width: 22px; height: 22px; }
.feature-card p {
  color: var(--muted);
  font-size: .88rem;
}

/* ---------- discovery / constellation visual ---------- */
.constellation {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: radial-gradient(ellipse at center, rgba(125,196,255,.06), transparent 70%);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.constellation__dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .5;
  animation: pulse-dot 3s ease-in-out infinite;
}
.constellation__dot:nth-child(2n) { background: var(--archive); animation-delay: 1s; }
.constellation__dot:nth-child(3n) { background: var(--good); animation-delay: 2s; }
.constellation__line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  transform-origin: left center;
  opacity: .3;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: .5; }
  50%      { transform: scale(1.8); opacity: .9; }
}

/* ---------- footer ---------- */
.footer {
  padding: 80px 0 48px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer__links {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}
.footer__links a {
  color: var(--muted);
  font-size: .85rem;
  transition: color .2s;
}
.footer__links a:hover { color: var(--accent); }
.footer__note {
  margin-top: 40px;
  color: var(--muted-soft);
  font-size: .78rem;
}

/* ---------- GUIDE PAGE ---------- */

/* guide layout */
.guide-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  padding-top: 100px;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* sticky sidebar nav */
.guide-nav {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.guide-nav__title {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--archive);
  margin-bottom: 16px;
}
.guide-nav a {
  display: block;
  padding: 7px 14px;
  font-size: .85rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color .2s, border-color .2s;
  margin-bottom: 2px;
}
.guide-nav a:hover,
.guide-nav a.active {
  color: var(--text);
  border-left-color: var(--accent);
}

/* guide content */
.guide-content h2 {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.guide-content h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.guide-content h3 { font-family: var(--sans); font-weight: 600; margin-top: 32px; }
.guide-content p { color: var(--muted); margin-bottom: 14px; font-size: .92rem; }
.guide-content ol, .guide-content ul { color: var(--muted); padding-left: 20px; margin-bottom: 14px; font-size: .92rem; }
.guide-content li { margin-bottom: 6px; }
.guide-content strong { color: var(--text); }
.guide-content code {
  font-family: var(--mono);
  background: var(--panel-strong);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .85rem;
  color: var(--accent);
}

/* mode table */
.mode-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: .88rem;
}
.mode-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--archive);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  border-bottom: 1px solid var(--line);
}
.mode-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(35,49,64,.5);
  color: var(--muted);
}
.mode-table td:first-child { color: var(--text); font-weight: 500; white-space: nowrap; }

/* tip box */
.tip {
  background: rgba(125,196,255,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: .88rem;
  color: var(--muted);
}
.tip strong { color: var(--accent); }

/* warning box */
.note {
  background: rgba(216,177,107,.06);
  border-left: 3px solid var(--archive);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: .88rem;
  color: var(--muted);
}
.note strong { color: var(--archive); }

/* shared top bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10,15,20,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(35,49,64,.4);
  transition: background .3s;
}
.topbar__brand {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.topbar__brand span { color: var(--archive); }
.topbar__links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.topbar__links a {
  font-size: .82rem;
  color: var(--muted);
  transition: color .2s;
}
.topbar__links a:hover { color: var(--text); }
.topbar__cta {
  padding: 8px 22px;
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-strong);
  border-radius: 40px;
  transition: background .2s;
}
.topbar__cta:hover { background: var(--accent); color: #fff; }

/* ---------- mobile hamburger (guide) ---------- */
.guide-menu-toggle {
  display: none;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: .85rem;
  cursor: pointer;
  margin-bottom: 20px;
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; gap: 40px; }
  .split--reverse { direction: ltr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .section { padding: 80px 0; }
  .container { padding: 0 20px; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero__inner { padding: 0 8px; }
  .btn-cta { padding: 14px 32px; font-size: .95rem; }
  .scroll-hint { display: none; }

  /* guide responsive */
  .guide-layout { grid-template-columns: 1fr; gap: 0; padding-top: 80px; }
  .guide-nav { position: static; display: none; margin-bottom: 32px; }
  .guide-nav.open { display: block; }
  .guide-menu-toggle { display: block; }
  .topbar__links a:not(.topbar__cta) { display: none; }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .big-number { font-size: 3rem; }
}
