/* Founder's Story — immersive reading experience */

@keyframes story-grid-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}
@keyframes story-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -18px) scale(1.05); }
}
@keyframes story-pulse-glow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}
@keyframes story-scroll-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(6px); opacity: 1; }
}

.story-page {
  --story-accent: #ff5200;
  --story-glass: rgba(8, 18, 32, 0.72);
  --story-glass-border: rgba(255, 255, 255, 0.1);
}

.story-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 82, 0, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(15, 42, 71, 0.5), transparent 50%),
    radial-gradient(ellipse 50% 35% at 0% 80%, rgba(255, 82, 0, 0.06), transparent 45%);
}

.story-page .content {
  position: relative;
  z-index: 1;
}

/* ── Scroll progress ── */
.story-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.06);
}
.story-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff5200, #ff8c42, #ff5200);
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(255, 82, 0, 0.8);
  transition: width 0.08s linear;
}

.story-chapter-badge {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 0.45rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 82, 0, 0.4);
  background: rgba(6, 15, 26, 0.88);
  backdrop-filter: blur(12px);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
@media (min-width: 1024px) {
  .story-chapter-badge { display: none; }
}

/* ── Hero ── */
.story-shell {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.story-hero {
  position: relative;
  overflow: hidden;
  border-radius: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, #060f1a 0%, #0b1f38 45%, #0f2a47 100%);
  padding: 2.5rem 1.5rem 2.75rem;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
@media (min-width: 768px) {
  .story-hero { padding: 3.5rem 2.5rem 3.75rem; }
}

.story-hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.story-hero-grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(255, 82, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 82, 0, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
  animation: story-grid-drift 20s linear infinite;
}
.story-hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: story-orb-float 8s ease-in-out infinite;
}
.story-hero-orb--1 {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -60px;
  background: rgba(255, 82, 0, 0.25);
}
.story-hero-orb--2 {
  width: 200px;
  height: 200px;
  bottom: -40px;
  left: -40px;
  background: rgba(15, 42, 71, 0.8);
  animation-delay: -3s;
}

.story-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.story-hero .speed-stripe {
  width: 5rem;
  margin: 0.25rem auto 0.5rem;
}
.story-hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 0.95;
  max-width: 18ch;
}
.story-hero-byline {
  font-size: 0.8125rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.story-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.story-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.story-hero-meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ff5200;
}
.story-hero-meta span:first-child::before { display: none; }
.story-hero-cta {
  margin-top: 1rem;
  text-decoration: none;
}
.story-scroll-hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  font-size: 0.5625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}
.story-scroll-hint svg {
  animation: story-scroll-bounce 2s ease-in-out infinite;
}

/* ── Jump grid (TOC cards) ── */
.story-jump {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.story-jump-label {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 0.6875rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}
.story-jump-grid {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 640px) {
  .story-jump-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .story-jump-grid { grid-template-columns: repeat(5, 1fr); }
}

.story-jump-card {
  --tilt-x: 0;
  --tilt-y: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 7.5rem;
  padding: 1rem 1rem 0.85rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transform: perspective(800px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s ease-out;
}
.story-jump-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 82, 0, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.25s;
}
.story-jump-card:hover,
.story-jump-card:focus-visible,
.story-jump-card.is-active {
  border-color: rgba(255, 82, 0, 0.55);
  box-shadow: 0 12px 40px rgba(255, 82, 0, 0.15), 0 0 0 1px rgba(255, 82, 0, 0.2);
  outline: none;
}
.story-jump-card:hover::before,
.story-jump-card.is-active::before { opacity: 1; }
.story-jump-card.is-active {
  background: rgba(255, 82, 0, 0.08);
}
.story-jump-num {
  position: relative;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1;
  color: rgba(255, 82, 0, 0.35);
  transition: color 0.2s;
}
.story-jump-card:hover .story-jump-num,
.story-jump-card.is-active .story-jump-num { color: #ff5200; }
.story-jump-title {
  position: relative;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 0.8125rem;
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}
.story-jump-url {
  position: relative;
  margin-top: auto;
  font-size: 0.625rem;
  color: #ff5200;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  opacity: 0.85;
}

/* ── Mobile chapter strip ── */
.story-chapter-strip {
  position: sticky;
  top: 3px;
  z-index: 50;
  margin: -0.5rem -0.25rem 0;
  padding: 0.65rem 0;
  background: linear-gradient(to bottom, rgba(6, 15, 26, 0.95), rgba(6, 15, 26, 0.85) 70%, transparent);
  backdrop-filter: blur(8px);
}
@media (min-width: 1024px) {
  .story-chapter-strip { display: none; }
}
.story-strip-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0 0.25rem 0.15rem;
  -webkit-overflow-scrolling: touch;
}
.story-strip-scroll::-webkit-scrollbar { display: none; }
.story-strip-link {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.4);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.story-strip-link span {
  color: #ff5200;
  font-weight: 900;
}
.story-strip-link.is-active,
.story-strip-link:hover,
.story-strip-link:focus-visible {
  border-color: rgba(255, 82, 0, 0.5);
  background: rgba(255, 82, 0, 0.12);
  color: #fff;
  outline: none;
}

/* ── Main layout: rail + content ── */
.story-main {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .story-main {
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 2.5rem;
  }
}

.story-rail {
  display: none;
}
@media (min-width: 1024px) {
  .story-rail {
    display: block;
    position: sticky;
    top: 1.5rem;
  }
}
.story-rail-label {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 0.625rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin: 0 0 1rem 0.25rem;
}
.story-rail-track {
  position: absolute;
  left: 0.65rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}
.story-rail-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to bottom, #ff5200, rgba(255, 82, 0, 0.3));
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 82, 0, 0.6);
  transition: height 0.08s linear;
}
.story-rail-nav {
  position: relative;
  padding-left: 1.75rem;
}
.story-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.story-rail-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.story-rail-link:hover,
.story-rail-link:focus-visible {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}
.story-rail-link.is-active {
  border-color: rgba(255, 82, 0, 0.35);
  background: rgba(255, 82, 0, 0.1);
  color: #fff;
}
.story-rail-link-num {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 900;
  font-size: 0.625rem;
  letter-spacing: 0.15em;
  color: #ff5200;
}
.story-rail-link-title {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Article & chapters ── */
.story-doc {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.story-chapter {
  scroll-margin-top: 5rem;
}
@media (min-width: 1024px) {
  .story-chapter { scroll-margin-top: 2rem; }
}

.story-chapter-panel {
  position: relative;
  padding: 1.75rem 1.35rem 2rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease, border-color 0.3s;
}
.story-chapter-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.story-chapter-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, transparent, rgba(255, 82, 0, 0.5), transparent);
  opacity: 0.6;
}
@media (min-width: 768px) {
  .story-chapter-panel { padding: 2.25rem 2rem 2.5rem; }
}

.story-chapter-label {
  font-size: 0.625rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #ff5200;
  margin: 0 0 0.65rem;
}
.story-chapter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.story-doc h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 900;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
  flex: 1 1 12rem;
}

.story-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 82, 0, 0.4);
  background: rgba(255, 82, 0, 0.1);
  color: #ff5200;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, color 0.15s;
}
.story-copy-btn:hover,
.story-copy-btn:focus-visible {
  background: rgba(255, 82, 0, 0.22);
  border-color: rgba(255, 82, 0, 0.65);
  outline: none;
  transform: translateY(-1px);
}
.story-copy-btn.is-copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

.story-doc p {
  font-size: 1.0625rem;
  line-height: 1.88;
  margin: 0 0 1.2rem;
  color: rgba(255, 255, 255, 0.84);
}
.story-doc em { font-style: italic; color: rgba(255, 255, 255, 0.95); }
.story-doc a:not(.story-copy-btn) {
  color: #ff5200;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 82, 0, 0.45);
  transition: color 0.15s;
}
.story-doc a:not(.story-copy-btn):hover { color: #ff7333; }

.story-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 1.5rem 0 1.75rem;
}
@media (max-width: 480px) {
  .story-stats { grid-template-columns: 1fr; }
}
.story-stat {
  padding: 1rem 0.75rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 82, 0, 0.25);
  background: rgba(255, 82, 0, 0.06);
  text-align: center;
}
.story-stat-value {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 900;
  font-size: 1.75rem;
  line-height: 1;
  color: #ff5200;
  text-shadow: 0 0 24px rgba(255, 82, 0, 0.35);
}
.story-stat-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.story-pullquote {
  margin: 1.75rem 0;
  padding: 1.25rem 1.35rem;
  border-left: 3px solid #ff5200;
  border-radius: 0 0.75rem 0.75rem 0;
  background: rgba(255, 82, 0, 0.06);
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
}

.story-divider {
  border: none;
  height: 1px;
  margin: 1.75rem 0;
  background: linear-gradient(90deg, transparent, rgba(255, 82, 0, 0.4), transparent);
}
.story-cta {
  margin-top: 1.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 82, 0, 0.35);
  background: linear-gradient(135deg, rgba(255, 82, 0, 0.1), rgba(255, 82, 0, 0.03));
  font-size: 0.9375rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.story-cta a { font-weight: 600; }
.story-footer-note {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  padding-top: 1.5rem;
  line-height: 1.7;
}

/* ── Light mode ── */
[data-theme="light"] .story-page::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 82, 0, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(11, 31, 56, 0.06), transparent 50%);
}
[data-theme="light"] .story-hero {
  background: linear-gradient(145deg, #f8fafc 0%, #eef2f7 50%, #e8eef5 100%);
  border-color: rgba(11, 31, 56, 0.1);
  box-shadow: 0 24px 60px rgba(11, 31, 56, 0.1);
}
[data-theme="light"] .story-hero-grid { opacity: 0.4; }
[data-theme="light"] .story-jump-card,
[data-theme="light"] .story-chapter-panel {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(11, 31, 56, 0.1);
}
[data-theme="light"] .story-jump-title,
[data-theme="light"] .story-doc h2 { color: #0b1f38; }
[data-theme="light"] .story-doc p { color: rgba(6, 15, 26, 0.82); }
[data-theme="light"] .story-chapter-badge {
  background: rgba(255, 255, 255, 0.92);
  color: #0b1f38;
}
[data-theme="light"] .story-chapter-strip {
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0.98), rgba(248, 250, 252, 0.9) 70%, transparent);
}
[data-theme="light"] .story-strip-link {
  background: rgba(255, 255, 255, 0.9);
  color: rgba(6, 15, 26, 0.65);
  border-color: rgba(11, 31, 56, 0.12);
}
[data-theme="light"] .story-rail-link { color: rgba(6, 15, 26, 0.55); }
[data-theme="light"] .story-rail-link.is-active { color: #0b1f38; }
[data-theme="light"] .story-pullquote { color: #0b1f38; }

@media (prefers-reduced-motion: reduce) {
  .story-hero-grid,
  .story-hero-orb,
  .story-scroll-hint svg { animation: none !important; }
  .story-chapter-panel {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .story-jump-card { transform: none !important; }
}
