/* Vision Pouya — GUIDE EXPERIENCE ("field manual" design layer).
   Loaded ONLY for items with "design": "guide". Everything is scoped under
   .guide-page / .guide-* so no other page changes. Mobile-first, RTL-aware
   (logical properties), transform/opacity motion only, reduced-motion safe.
   Art direction: a night-operations edition of Obsidian & Gold — cinematic
   full-bleed hero, editorial chapters with ghost numerals, a reading HUD
   (progress filament + chapter rail), and instrument-grade data components. */

/* ------------------------------------------------------------ reading HUD -- */
.guide-progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 150;
  background: rgb(212 168 67 / .12); pointer-events: none;
}
.guide-progress i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright) 60%, var(--neon));
  transform: scaleX(0); transform-origin: left;
  box-shadow: 0 0 12px rgb(212 168 67 / .55);
}
[dir="rtl"] .guide-progress i { transform-origin: right;
  background: linear-gradient(-90deg, var(--gold), var(--gold-bright) 60%, var(--neon)); }

/* ------------------------------------------------------------------- hero -- */
.guide-page { padding-top: 0; }
.guide-hero {
  position: relative; overflow: hidden;
  /* full-bleed breakout from the 760px prose column */
  width: 100vw; margin-inline-start: calc(50% - 50vw);
  min-height: min(88svh, 780px);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--topbar-h) + 48px) var(--gutter) clamp(56px, 9vh, 96px);
  margin-bottom: clamp(28px, 6vw, 56px);
  isolation: isolate;
}
.guide-hero-media { position: absolute; inset: 0; z-index: -3; }
.guide-hero-media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.82) contrast(1.06) brightness(.6);
  transform: scale(1.06);            /* parallax headroom (JS drifts it) */
  will-change: transform;
}
.guide-hero-veil {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 90% at 50% 108%, rgb(11 11 15 / .2) 30%, transparent 70%),
    linear-gradient(180deg, rgb(11 11 15 / .78) 0%, rgb(11 11 15 / .25) 34%,
      rgb(11 11 15 / .58) 68%, var(--bg) 99%);
}
/* slow-breathing gold aurora — pure decoration, killed for reduced motion */
.guide-hero-aurora {
  position: absolute; z-index: -1; inset-inline-start: -18%; bottom: -32%;
  width: 68%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 40deg,
    rgb(212 168 67 / .30), rgb(79 227 193 / .10), transparent 62%, rgb(212 168 67 / .22));
  filter: blur(72px); opacity: .5;
  animation: guide-aurora 14s ease-in-out infinite alternate;
}
@keyframes guide-aurora {
  from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  to   { transform: translate3d(6%, -7%, 0) rotate(38deg) scale(1.14); }
}
.guide-hero-inner { max-width: 880px; margin-inline: auto; width: 100%; text-align: center; }
.guide-kicker {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: .8rem; font-weight: 700; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold-bright);
}
.guide-kicker::before, .guide-kicker::after {
  content: ""; height: 1px; width: clamp(28px, 8vw, 74px); flex: none;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.guide-kicker::after { background: linear-gradient(-90deg, transparent, var(--gold)); }
.guide-title {
  margin-top: 18px;
  font-size: clamp(2.3rem, 8.5vw, 4.4rem); font-weight: 800; line-height: 1.18;
  letter-spacing: -.015em;
  background: linear-gradient(100deg,
    var(--ink) 20%, var(--gold-bright) 42%, var(--ink) 60%, var(--ink) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: guide-sheen 7s var(--ease-out) infinite;
}
@keyframes guide-sheen {
  0%, 55%, 100% { background-position: 0% 0; }
  25% { background-position: 100% 0; }
}
.guide-excerpt {
  color: rgb(242 239 232 / .8); font-size: clamp(1.02rem, 2.6vw, 1.24rem);
  max-width: 40em; margin: 18px auto 0; text-wrap: balance;
}
.guide-chips { list-style: none; padding: 0; margin: 26px 0 0;
  display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.guide-chips li {
  padding: 8px 16px; border-radius: 999px; font-size: .84rem; font-weight: 600;
  color: var(--ink); border: 1px solid rgb(212 168 67 / .38);
  background: rgb(20 20 27 / .55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.guide-meta { margin-top: 22px; color: rgb(168 164 155 / .85); font-size: .84rem; }
.guide-cue {
  position: absolute; bottom: 14px; inset-inline-start: 50%;
  translate: -50% 0; width: 1px; height: 42px; overflow: hidden;
  background: rgb(212 168 67 / .2);
}
[dir="rtl"] .guide-cue { translate: 50% 0; }
.guide-cue span {
  position: absolute; top: -14px; inset-inline-start: -1.5px;
  width: 4px; height: 14px; border-radius: 2px; background: var(--gold-bright);
  animation: guide-cue 2.2s var(--ease-out) infinite;
}
@keyframes guide-cue { 0% { top: -14px; opacity: 0; } 30% { opacity: 1; }
  100% { top: 42px; opacity: 0; } }

/* --------------------------------------------------- chapter rail / TOC ---- */
/* One element, two presentations: in-flow contents card on phones,
   fixed side rail with dots from 1180px up. */
.guide-rail { margin: 0 0 30px; }
.guide-rail[hidden] { display: none; }
.guide-rail-head {
  font-size: .76rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-bright); margin-bottom: 10px;
}
.guide-rail a {
  display: flex; align-items: center; gap: 12px; padding: 9px 4px;
  text-decoration: none; color: var(--ink-dim); border-radius: 10px;
  transition: color .2s var(--ease-out);
}
.guide-rail a:hover { color: var(--ink); }
.guide-rail a[aria-current="true"] { color: var(--gold-bright); }
.guide-rail .gr-dot {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: rgb(212 168 67 / .35);
  transition: background-color .2s, box-shadow .2s, transform .2s var(--ease-out);
}
.guide-rail a[aria-current="true"] .gr-dot {
  background: var(--gold-bright); transform: scale(1.35);
  box-shadow: 0 0 10px rgb(212 168 67 / .7);
}
.guide-rail .gr-no { font-size: .74rem; font-weight: 700; color: var(--gold);
  min-width: 1.4em; text-align: center; }
.guide-rail .gr-t { font-size: .9rem; font-weight: 600; line-height: 1.35; }
@media (max-width: 1179.98px) {
  .guide-rail {
    border: var(--ring); border-radius: var(--radius); background: var(--bg-elev);
    padding: 18px clamp(14px, 3.5vw, 22px);
  }
  .guide-rail a { border-inline-start: 2px solid rgb(212 168 67 / .18);
    border-radius: 0; padding-inline-start: 14px; margin-inline-start: 2px; }
  .guide-rail a[aria-current="true"] { border-inline-start-color: var(--gold); }
  .guide-rail .gr-dot { display: none; }
}
@media (min-width: 1180px) {
  .guide-rail {
    position: fixed; z-index: 90; top: 50%; inset-inline-end: 26px;
    transform: translateY(-50%); margin: 0; max-width: 210px;
  }
  .guide-rail-head { display: none; }
  .guide-rail a { padding: 7px 6px; }
  .guide-rail .gr-no { display: none; }
  .guide-rail .gr-t {
    font-size: .8rem; opacity: 0; translate: 8px 0;
    transition: opacity .22s var(--ease-out), translate .22s var(--ease-out);
  }
  [dir="rtl"] .guide-rail .gr-t { translate: -8px 0; }
  .guide-rail:hover .gr-t, .guide-rail a[aria-current="true"] .gr-t,
  .guide-rail a:focus-visible .gr-t { opacity: 1; translate: 0 0; }
}

/* ------------------------------------------------------- editorial chapters -- */
/* "## گام N — …" step-cards lose the toy box and become magazine chapters:
   a huge outlined ghost numeral, a hairline rule, and generous air. */
.guide-body { font-size: 1.1rem; }
.guide-body .step-card {
  position: relative; border: 0; border-radius: 0; background: none;
  padding: 0; margin-top: clamp(56px, 10vw, 88px);
}
.guide-body .step-card::before {
  content: ""; position: absolute; top: -28px; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, var(--gold) 0, rgb(212 168 67 / .06) 70%, transparent);
}
[dir="rtl"] .guide-body .step-card::before {
  background: linear-gradient(-90deg, var(--gold) 0, rgb(212 168 67 / .06) 70%, transparent);
}
.guide-body .step-card + .step-card { margin-top: clamp(56px, 10vw, 88px); }
.guide-body h2.step-h {
  display: block; font-size: clamp(1.45rem, 4.5vw, 1.9rem); line-height: 1.3;
  margin: 0; padding: 0; border: 0;
}
.guide-body .step-no {
  display: block; width: auto; height: auto; margin-bottom: -0.34em;
  background: none; box-shadow: none; border-radius: 0;
  font-size: clamp(3.6rem, 11vw, 5.4rem); font-weight: 800; line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgb(212 168 67 / .5);
  text-shadow: 0 0 34px rgb(212 168 67 / .18);
  user-select: none;
}
@supports not (-webkit-text-stroke: 1px black) {
  .guide-body .step-no { color: rgb(212 168 67 / .32); }
}
.guide-body .step-t { display: block; }
.guide-body .step-card > * + * { margin-top: 1.05em; }
.guide-body .step-card .prose-figure { background: var(--bg-elev); }

/* plain ## sections (non-step) — quieter chapter heads in the same key */
.guide-body > h2:not(.step-h) {
  border-top: 0; padding-top: 0; margin-top: clamp(56px, 10vw, 80px);
  font-size: clamp(1.4rem, 4.2vw, 1.75rem);
}
.guide-body > h2:not(.step-h)::before {
  width: 56px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  box-shadow: none;
}
[dir="rtl"] .guide-body > h2:not(.step-h)::before {
  background: linear-gradient(-90deg, var(--gold), transparent);
}

/* deep-lit figures */
.guide-body .prose-figure {
  border-color: rgb(212 168 67 / .3);
  box-shadow: 0 24px 70px rgb(0 0 0 / .5), 0 0 0 1px rgb(212 168 67 / .06);
}

/* ------------------------------------------------------------- components -- */
/* feature-card grid — :::features around "- **Title** — description" */
.guide-body .md-features ul { list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .guide-body .md-features ul { grid-template-columns: 1fr 1fr; } }
.guide-body .md-features li {
  position: relative; margin: 0; padding: 20px 20px 22px;
  border: 1px solid rgb(212 168 67 / .2); border-radius: var(--radius);
  background: linear-gradient(165deg, var(--bg-elev), rgb(20 20 27 / .4));
  overflow: hidden;
  transition: transform .22s var(--ease-out), border-color .22s, box-shadow .22s;
}
.guide-body .md-features li::before {
  content: ""; position: absolute; top: 0; inset-inline-start: 20px;
  width: 34px; height: 2.5px; border-radius: 0 0 3px 3px;
  background: var(--gold); box-shadow: 0 0 12px rgb(212 168 67 / .5);
}
@media (hover: hover) {
  .guide-body .md-features li:hover {
    transform: translateY(-3px); border-color: rgb(212 168 67 / .5);
    box-shadow: 0 14px 44px rgb(0 0 0 / .45);
  }
}
.guide-body .md-features li strong {
  display: block; font-size: 1.06rem; color: var(--gold-bright); margin-bottom: 6px;
}
.guide-body .md-features li { color: var(--ink-dim); font-size: .96rem; line-height: 1.75; }

/* download vault — :::vault around "- [Label](url) — note" */
.guide-body .md-vault ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.guide-body .md-vault li {
  margin: 0; padding: 16px 18px;
  border: 1px solid rgb(212 168 67 / .26); border-radius: 14px;
  background: var(--bg-elev);
  color: var(--ink-dim); font-size: .92rem; line-height: 1.7;
  transition: border-color .22s, background-color .22s;
}
.guide-body .md-vault li:hover { border-color: var(--gold); background: var(--bg-elev2); }
.guide-body .md-vault li a {
  display: inline-block; font-weight: 700; font-size: 1.04rem;
  color: var(--gold-bright); text-decoration: none;
}
.guide-body .md-vault li a::after {
  content: "↗"; margin-inline-start: 7px; font-size: .85em;
  display: inline-block; transition: translate .2s var(--ease-out);
}
.guide-body .md-vault li:hover a::after { translate: 2px -2px; }
.guide-body .md-vault li a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* comparison grid — :::vs with "= HeadA | HeadB" then "label: A | B" */
.guide-body .md-vs {
  border: 1px solid rgb(212 168 67 / .24); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elev); font-size: .95rem;
}
.guide-body .md-vs .vs-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px;
  padding: 13px 16px; align-items: baseline;
}
.guide-body .md-vs .vs-row + .vs-row { border-top: 1px solid rgb(212 168 67 / .12); }
.guide-body .md-vs .vs-label {
  grid-column: 1 / -1; font-size: .76rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim);
}
.guide-body .md-vs .vs-a, .guide-body .md-vs .vs-b { line-height: 1.65; }
.guide-body .md-vs .vs-b { color: var(--gold-bright); }
.guide-body .md-vs .vs-head {
  background: linear-gradient(180deg, rgb(212 168 67 / .14), rgb(212 168 67 / .03));
  padding-block: 11px;
}
.guide-body .md-vs .vs-head .vs-a, .guide-body .md-vs .vs-head .vs-b {
  font-weight: 800; font-size: 1rem; color: var(--ink);
}
.guide-body .md-vs .vs-head .vs-b { color: var(--gold-bright); }
@media (min-width: 680px) {
  .guide-body .md-vs .vs-row { grid-template-columns: 150px 1fr 1fr; }
  .guide-body .md-vs .vs-label { grid-column: auto; align-self: center; }
}

/* instrument params — copy-on-tap (guide.js) */
.guide-body .md-params .md-param { position: relative; cursor: copy;
  border-color: rgb(212 168 67 / .3);
  background: linear-gradient(180deg, var(--bg-elev), rgb(20 20 27 / .5)); }
.guide-body .md-param dd { font-size: 1.55rem; letter-spacing: .02em; }
.guide-body .md-param::after {
  content: "⧉"; position: absolute; top: 7px; inset-inline-end: 9px;
  font-size: .72rem; color: rgb(212 168 67 / .5);
}
.guide-body .md-param.copied::after { content: "✓"; color: var(--neon); }
.guide-body .md-param.copied { border-color: var(--neon); }

/* refined callouts */
.guide-body .md-callout {
  background: linear-gradient(165deg, var(--bg-elev), rgb(20 20 27 / .35));
  border-radius: 14px;
}

/* ------------------------------------------------------------- reveals ----- */
.gv { opacity: 0; transform: translateY(18px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
  transition-delay: var(--d, 0s); }
.gv.gv-in { opacity: 1; transform: none; }
.no-io .gv, .no-js .gv { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .guide-hero-aurora, .guide-cue { display: none; }
  .guide-title { animation: none; }
  .guide-hero-media img { transform: none; }
  .gv { opacity: 1; transform: none; transition: none; }
}
