/* QNSET Our Values page (Views/Home/Values.cshtml): a long-form essay in two
   parts. Builds on qx.css (tokens, buttons, reveals); motion in values.js.
   Prefix: qv-. */

/* The hero glow reaches past the page edge; clip it so phones can't scroll sideways. */
.qv {
  overflow-x: clip;
}

/* ---------- Reading progress ---------- */

.qv-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 3px;
  pointer-events: none;
}

.qv-progress span {
  display: block;
  height: 100%;
  background: var(--qx-spectrum);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}

/* ---------- Hero ---------- */

.qv-hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(4rem, 12vh, 8rem) clamp(4rem, 10vh, 6rem);
}

.qv-hero::before {
  content: '';
  position: absolute;
  inset: -10% -20% auto auto;
  z-index: -1;
  width: min(60rem, 90vw);
  aspect-ratio: 1;
  background:
    radial-gradient(closest-side, rgba(157, 77, 255, 0.18), transparent),
    radial-gradient(closest-side at 30% 70%, rgba(255, 45, 74, 0.12), transparent);
  filter: blur(20px);
  animation: qv-drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

.qv-hero-kicker {
  opacity: 0;
  animation: qx-fade 0.8s ease 0.1s forwards;
}

.qv-hero-title {
  margin: 0;
  font-size: clamp(2.8rem, 7.8vw, 7.75rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.qv-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.qv-line > span {
  display: inline-block;
  transform: translateY(110%);
  animation: qx-rise 1.1s var(--qx-ease) forwards;
}

.qv-line:nth-child(1) > span { animation-delay: 0.15s; }
.qv-line:nth-child(2) > span { animation-delay: 0.3s; }
.qv-line:nth-child(3) > span { animation-delay: 0.45s; }

.qv-hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: end;
  gap: 2.5rem 5rem;
  margin-top: clamp(2.5rem, 6vh, 4rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--qx-line);
  opacity: 0;
  animation: qx-fade-up 0.9s var(--qx-ease) 0.9s forwards;
}

.qv-hero-lead {
  max-width: 50ch;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--qx-muted);
}

.qv-hero-lead a {
  color: var(--qx-ink);
  text-decoration-line: underline;
  text-decoration-color: rgba(244, 244, 247, 0.35);
  text-underline-offset: 0.2em;
}

.qv-hero-parts {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qv-hero-parts a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--qx-line);
  border-radius: 0.9rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--qx-ink);
  text-decoration: none;
  transition: border-color 0.3s ease, background-color 0.3s ease, translate 0.5s var(--qx-ease);
}

.qv-hero-parts a:hover {
  border-color: rgba(244, 244, 247, 0.3);
  background: rgba(244, 244, 247, 0.04);
  translate: 6px 0;
}

.qv-hero-num {
  min-width: 1.6rem;
  font-family: var(--qx-mono);
  font-size: 0.78rem;
  color: var(--qx-faint);
}

/* ---------- Part heads: a giant numeral slides under the heading ---------- */

.qv-part {
  position: relative;
}

.qv-part-head {
  position: relative;
  overflow: hidden;
  padding-block: clamp(6rem, 16vh, 11rem) clamp(3rem, 8vh, 5rem);
  border-top: 1px solid var(--qx-line);
}

.qv-part-numeral {
  position: absolute;
  top: 50%;
  right: var(--qx-gutter);
  font-family: var(--qx-mono);
  font-size: clamp(11rem, 26vw, 24rem);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.08em;
  background: var(--qx-spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.16;
  transform: translate(calc(14% - var(--p, 0) * 22%), -50%);
  pointer-events: none;
  user-select: none;
}

.qv-part-head-text {
  position: relative;
}

.qv-part-head .qx-h2 {
  max-width: 14ch;
}

/* ---------- Body: sticky contents + essay ---------- */

.qv-body {
  display: grid;
  grid-template-columns: 15rem minmax(0, 44rem);
  justify-content: start;
  gap: clamp(3rem, 10vw, 10rem);
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

.qv-toc {
  position: sticky;
  top: 7rem;
  align-self: start;
}

.qv-toc ol {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qv-toc a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.7rem 0 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--qx-faint);
  text-decoration: none;
  transition: color 0.3s ease;
}

.qv-toc a:hover,
.qv-toc-item.is-active a {
  color: var(--qx-ink);
}

.qv-toc-num {
  font-family: var(--qx-mono);
  font-size: 0.7rem;
}

.qv-toc-bar {
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: var(--qx-line);
}

.qv-toc-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--qx-spectrum);
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}

/* ---------- Essay sections ---------- */

.qv-c--red { --c: var(--qx-red); }
.qv-c--purple { --c: var(--qx-purple); }
.qv-c--blue { --c: #5b8bff; }

.qv-item {
  position: relative;
  padding-block: clamp(3rem, 8vh, 5rem);
  scroll-margin-top: 5rem;
}

.qv-item + .qv-item {
  border-top: 1px solid var(--qx-line);
}

.qv-item-num {
  display: block;
  margin-bottom: 1.25rem;
  font-family: var(--qx-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--c);
}

.qv-item-num::after {
  content: '';
  display: inline-block;
  width: 2.5rem;
  height: 1px;
  margin-left: 0.75rem;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--c), transparent);
}

.qv-item-title {
  margin: 0 0 1.75rem;
  font-size: clamp(1.8rem, 3.4vw, 2.75rem);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.qv-p {
  margin: 0 0 1.35rem;
  font-size: 1.14rem;
  line-height: 1.75;
  color: var(--qx-muted);
  text-wrap: pretty;
}

.qv-p:last-child {
  margin-bottom: 0;
}

.qv-item-title + .qv-p {
  color: rgba(244, 244, 247, 0.84);
}

/* Pull quotes: words light up as the quote scrolls through the viewport */
.qv-quote {
  position: relative;
  margin: 2.5rem 0;
  padding: 0.25rem 0 0.25rem 1.75rem;
}

.qv-quote::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c), transparent);
}

.qv-quote p {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.qv-w {
  opacity: 0.16;
  transition: opacity 0.35s ease;
}

.qv-w.is-lit {
  opacity: 1;
}

/* ---------- Closing ---------- */

.qv-close {
  position: relative;
  isolation: isolate;
  padding-block: clamp(6rem, 16vh, 10rem);
  overflow: hidden;
  border-top: 1px solid var(--qx-line);
  text-align: center;
}

.qv-close::before {
  content: '';
  position: absolute;
  inset: auto 0 -40%;
  z-index: -1;
  height: 80%;
  background: radial-gradient(50% 60% at 50% 100%, rgba(157, 77, 255, 0.2), transparent 70%);
  pointer-events: none;
}

.qv-close-rule {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--qx-spectrum);
  transform: scaleX(0);
  transition: transform 1.4s var(--qx-ease) 0.2s;
}

.qv-close.is-in .qv-close-rule,
:root:not(.qx-js) .qv-close-rule {
  transform: scaleX(1);
}

.qv-close-inner {
  display: grid;
  justify-items: center;
}

.qv-close-title {
  max-width: 16ch;
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.25rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.qv-close-lead {
  max-width: 46ch;
  margin: 1.5rem 0 2.25rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--qx-muted);
}

.qv-close .qx-actions {
  justify-content: center;
}

@keyframes qv-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-8%, 6%) scale(1.12); }
}

/* ---------- Smaller screens ---------- */

@media (max-width: 959px) {
  .qv-hero-foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .qv-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .qv-toc {
    display: none;
  }
}

@media (max-width: 639px) {
  .qv-p {
    font-size: 1.05rem;
  }

  .qv-quote {
    padding-left: 1.25rem;
  }
}
