/* Story home page: "AI × Shri Krishna" scroll narrative. Used only by _layouts/story.html. */

body.story {
  --st-night: #060914;
  --st-night-2: #0d1433;
  --st-ink: #eceff9;
  --st-muted: #a6afce;
  --st-gold: #f5c15c;
  --st-saffron: #ff9a4d;
  --st-peacock: #19c3b4;
  --st-blue: #4d7cf7;
  --st-lotus: #f472b6;
  --st-line: rgb(255 255 255 / 9%);
  --st-glass: rgb(10 14 36 / 58%);
  --st-serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --st-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --st-deva: 'Tiro Devanagari Sanskrit', 'Noto Serif Devanagari', serif;

  margin: 0;
  background: var(--st-night);
  color: var(--st-ink);
  font-family: var(--st-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-x: hidden;
}

body.story ::selection { background: rgb(245 193 92 / 35%); color: #fff; }

body.story a { color: var(--st-gold); text-decoration: none; }
body.story a:hover { color: #ffd98c; }
body.story :focus-visible {
  outline: 2px solid var(--st-gold);
  outline-offset: 3px;
  border-radius: 6px;
}
body.story [lang='hi'],
body.story [lang='sa'] { font-family: var(--st-deva); font-style: normal; }

.st-skip {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--st-gold);
  color: #1a1206 !important;
  border-radius: 8px;
  font-weight: 600;
}
.st-skip:focus { top: 12px; }

/* ---------- Background layers ---------- */
#st-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.st-stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 12%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 64%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 78%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 88%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 34%, #fff5 50%, transparent 51%),
    radial-gradient(ellipse 70% 55% at 85% 10%, rgb(77 124 247 / 18%), transparent 70%),
    radial-gradient(ellipse 60% 50% at 5% 95%, rgb(25 195 180 / 12%), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgb(245 193 92 / 5%), transparent 70%),
    linear-gradient(180deg, var(--st-night) 0%, var(--st-night-2) 55%, var(--st-night) 100%);
  background-size: 420px 420px, 380px 380px, 520px 520px, 460px 460px, 340px 340px, 600px 600px, auto, auto, auto, auto;
}

/* ---------- Top progress + nav ---------- */
.st-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
}
.st-progress span {
  display: block;
  height: 100%;
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--st-gold), var(--st-peacock), var(--st-lotus));
}

.st-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(16px, 4vw, 48px);
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}
.st-nav.scrolled {
  background: rgb(6 9 20 / 72%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--st-line);
}
.st-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--st-ink) !important;
  font-family: var(--st-serif);
  font-size: 1.3rem;
  font-weight: 700;
  min-height: 44px;
}
.st-brand img { border-radius: 50%; box-shadow: 0 0 0 2px rgb(245 193 92 / 55%); }
.st-nav nav { display: flex; align-items: center; gap: 0.25rem; }
.st-nav nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: 999px;
  color: var(--st-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}
.st-nav nav a:hover { color: var(--st-ink); background: rgb(255 255 255 / 6%); }
.st-nav nav a[aria-current='page'] { color: var(--st-gold); }
.st-nav nav a.st-nav-cta { color: #1a1206; background: var(--st-gold); font-weight: 600; }
.st-nav nav a.st-nav-cta:hover { background: #ffd98c; }

/* ---------- Chapter rail ---------- */
.st-chapters {
  position: fixed;
  right: clamp(12px, 2vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.st-chapters a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  min-height: 32px;
  color: var(--st-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.st-chapters a span {
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.st-chapters a::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--st-muted);
  transition: all 0.3s ease;
}
.st-chapters a:hover span,
.st-chapters a.active span { opacity: 1; transform: none; }
.st-chapters a.active { color: var(--st-gold); }
.st-chapters a.active::after {
  background: var(--st-gold);
  border-color: var(--st-gold);
  box-shadow: 0 0 12px var(--st-gold);
  height: 22px;
  border-radius: 4px;
}

/* ---------- Chapters ---------- */
#story { position: relative; z-index: 1; }
.st-chapter {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 7rem clamp(16px, 6vw, 96px) 5rem;
  box-sizing: border-box;
}
.st-chapter[data-side='right'] { justify-content: flex-end; }
.st-chapter[data-side='right'] .st-panel { margin-right: clamp(0px, 3vw, 48px); }
.st-panel { max-width: 560px; width: 100%; }
.st-panel-wide { max-width: 680px; }

.st-eyebrow,
.st-num {
  margin: 0 0 1rem;
  color: var(--st-gold);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.st-num span { letter-spacing: 0.02em; font-size: 1.15rem; text-transform: none; margin-left: 0.25rem; }

.st-title {
  margin: 0 0 1.25rem;
  font-family: var(--st-serif);
  font-weight: 700;
  font-size: clamp(2.3rem, 5vw, 3.9rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--st-ink);
  text-wrap: balance;
}
.st-hero .st-title {
  font-size: clamp(3.2rem, 9vw, 7rem);
  background: linear-gradient(115deg, #fff4d6 0%, var(--st-gold) 45%, var(--st-peacock) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.st-role {
  margin: 0 0 1.25rem;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 600;
  color: var(--st-peacock);
  min-height: 1.8em;
}
.st-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--st-gold);
  animation: st-blink 0.9s step-end infinite;
}
@keyframes st-blink { 50% { opacity: 0; } }

.st-lede { font-size: 1.15rem; color: var(--st-ink); opacity: 0.92; }
.st-panel > p:not(.st-num, .st-eyebrow, .st-lede, .st-role) { color: var(--st-muted); }

/* Buttons */
.st-btns { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.75rem; }
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0 1.25rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 16%);
  background: rgb(255 255 255 / 4%);
  color: var(--st-ink) !important;
  font-weight: 500;
  font-size: 0.95rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.st-btn:hover { transform: translateY(-2px); border-color: var(--st-gold); background: rgb(245 193 92 / 8%); }
.st-btn-primary {
  background: linear-gradient(120deg, var(--st-gold), var(--st-saffron));
  border-color: transparent;
  color: #1a1206 !important;
  font-weight: 600;
  box-shadow: 0 8px 30px -10px rgb(255 154 77 / 70%);
}
.st-btn-primary:hover { background: linear-gradient(120deg, #ffd98c, var(--st-saffron)); box-shadow: 0 12px 36px -10px rgb(255 154 77 / 90%); }
.st-btn-icon { width: 46px; padding: 0; }

.st-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  color: var(--st-muted) !important;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.st-scroll-cue i { animation: st-bob 1.8s ease-in-out infinite; }
@keyframes st-bob { 50% { transform: translateY(6px); } }

/* Prologue symbol captions (one visible at a time; story.js advances them) */
.st-symbols {
  position: absolute;
  right: clamp(16px, 9vw, 160px);
  bottom: 10vh;
  width: min(340px, 36vw);
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
  pointer-events: none;
}
.st-symbols li { display: none; }
.st-symbols li:first-child,
.st-symbols li.active { display: block; animation: st-cap 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.st-js .st-symbols li:first-child:not(.active) { display: none; }
.st-symbols b {
  display: block;
  font-family: var(--st-deva);
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--st-gold);
  text-shadow: 0 0 18px rgb(245 193 92 / 45%);
}
.st-symbols span { display: block; margin-top: 0.2rem; color: var(--st-muted); font-size: 0.9rem; line-height: 1.5; }
@keyframes st-cap { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }

/* Stats */
.st-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--st-line);
}
.st-stats div { display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-start; }
.st-stat, .st-stat-plus {
  font-family: var(--st-serif);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--st-gold);
}
.st-stats small { flex-basis: 100%; margin-top: 0.4rem; color: var(--st-muted); font-size: 0.8rem; line-height: 1.35; }

/* Skills */
.st-skills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.st-skills li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgb(25 195 180 / 28%);
  background: rgb(25 195 180 / 7%);
  font-size: 0.88rem;
  color: var(--st-ink);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.st-skills li i { color: var(--st-peacock); }
.st-skills li:hover { border-color: var(--st-peacock); background: rgb(25 195 180 / 14%); transform: translateY(-2px); }

/* Plain lists, contact rows, meta line (About page) */
.st-list { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--st-muted); }
.st-list li { margin: 0.3rem 0; }
.st-list li::marker { color: var(--st-gold); }
.st-timeline .st-list { margin-top: 0.5rem; font-size: 0.95rem; }
.st-meta-line { margin-top: 1.25rem; color: var(--st-muted) !important; font-size: 0.92rem; }
.st-meta-line i { color: var(--st-gold); margin-right: 0.35rem; }
.st-contact { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.st-contact li { display: flex; align-items: center; gap: 0.75rem; font-size: 1.05rem; }
.st-contact i { width: 1.2rem; color: var(--st-gold); text-align: center; }
.st-contact a { display: inline-flex; align-items: center; min-height: 44px; color: var(--st-ink) !important; }
.st-contact a:hover { color: var(--st-gold) !important; }

/* Timeline */
.st-timeline { list-style: none; margin: 2rem 0 0; padding: 0 0 0 1.6rem; border-left: 1px solid rgb(245 193 92 / 35%); }
.st-timeline > li { position: relative; padding-bottom: 1.6rem; }
.st-timeline > li:last-child { padding-bottom: 0; }
.st-timeline > li::before {
  content: '';
  position: absolute;
  left: calc(-1.6rem - 6px);
  top: 0.45rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--st-gold);
  box-shadow: 0 0 0 4px rgb(245 193 92 / 18%), 0 0 16px var(--st-gold);
}
.st-timeline h3 { margin: 0; font-family: var(--st-sans); font-size: 1.08rem; font-weight: 600; color: var(--st-ink); }
.st-timeline p { margin: 0.35rem 0 0; color: var(--st-muted); font-size: 0.97rem; }
.st-meta { color: var(--st-gold) !important; opacity: 0.85; font-size: 0.82rem !important; }

/* Project cards */
.st-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; margin-top: 2rem; }
.st-card {
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--st-line);
  background: var(--st-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.st-card:hover { transform: translateY(-4px); border-color: rgb(77 124 247 / 55%); box-shadow: 0 18px 40px -20px rgb(77 124 247 / 70%); }
.st-card i { color: var(--st-blue); font-size: 1.25rem; }
.st-card h3 { margin: 0.7rem 0 0.35rem; font-family: var(--st-sans); font-size: 1.02rem; font-weight: 600; color: var(--st-ink); }
.st-card p { margin: 0; color: var(--st-muted); font-size: 0.9rem; line-height: 1.55; }

/* Shloka */
.st-shloka { margin: 0 0 1.75rem; padding: 0; border: 0; }
.st-shloka p {
  margin: 0;
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  line-height: 1.35;
  color: var(--st-gold);
  text-shadow: 0 0 30px rgb(245 193 92 / 45%);
}
.st-shloka .st-cite { margin-top: 0.8rem; color: var(--st-muted); font-style: italic; font-family: var(--st-serif); font-size: 1.2rem; }

/* Posts */
.st-posts { display: grid; gap: 0.75rem; margin-top: 1.75rem; }
.st-post {
  display: block;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--st-line);
  background: var(--st-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.st-post:hover { border-color: rgb(245 193 92 / 55%); transform: translateX(4px); }
.st-post h3 { margin: 0 0 0.3rem; font-family: var(--st-sans); font-size: 1rem; font-weight: 600; color: var(--st-ink); }
.st-post p { margin: 0 0 0.4rem; color: var(--st-muted); font-size: 0.9rem; line-height: 1.5; }
.st-link { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; margin-top: 0.75rem; font-weight: 600; }

.st-finale .st-title {
  background: linear-gradient(115deg, #ffe4f1, var(--st-lotus) 55%, var(--st-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Footer */
.st-footer {
  height: auto;
  transform: none;
  position: relative;
  z-index: 1;
  padding: 2.5rem 16px 3rem;
  border-top: 1px solid var(--st-line);
  text-align: center;
  color: var(--st-muted);
  font-size: 0.88rem;
  background: rgb(6 9 20 / 80%);
}
.st-footer p { margin: 0.3rem 0; }

/* ---------- Reveal choreography (only when JS is running) ---------- */
.st-js .reveal > * {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
    filter 0.9s ease;
  transition-delay: calc(var(--i, 0) * 110ms);
}
.st-js .reveal.in > * { opacity: 1; transform: none; filter: none; }

/* ---------- Responsive ---------- */
@media (max-width: 899px) {
  .st-chapters { display: none; }
  .st-chapter, .st-chapter[data-side='right'] { justify-content: center; padding-top: 6rem; }
  .st-chapter[data-side='right'] .st-panel { margin-right: 0; }
  .st-panel {
    padding: 1.5rem;
    border-radius: 20px;
    background: rgb(6 9 20 / 62%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--st-line);
  }
  .st-hero .st-panel { background: transparent; border: 0; backdrop-filter: none; padding: 0; }
  .st-hero { align-items: flex-end; padding-top: 57svh; padding-bottom: 6.5rem; }
  .st-symbols { left: 16px; right: 16px; width: auto; top: 45.5svh; bottom: auto; }
  .st-symbols b { font-size: 1.3rem; }
  .st-symbols span { font-size: 0.82rem; }
  .st-hero .st-title { font-size: clamp(2.6rem, 12vw, 3.4rem); }
}
@media (max-width: 600px) {
  .st-brand span { display: none; }
  .st-nav nav a { padding: 0 0.6rem; font-size: 0.9rem; }
  .st-stats { grid-template-columns: repeat(2, 1fr); }
  .st-cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  body.story *,
  body.story *::before,
  body.story *::after { animation: none !important; transition: none !important; }
  .st-js .reveal > * { opacity: 1; transform: none; filter: none; }
}
