/* ============================================================
   RG DIGITAL WORKSHOP — small finishing details
   Loaded after navigation.css. Nothing here redesigns a section:
   scrollbar, chapter ticks on #bar, header reaction, chapter ruler,
   back-to-top, a few corner marks / sheet labels and ink strokes.
   ============================================================ */

/* ---------- 1 · signature scrollbar ---------- */
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:#0b1712}
::-webkit-scrollbar-corner{background:#0b1712}
::-webkit-scrollbar-thumb{background-color:#4d6853;border-radius:3px;transition:background-color .25s}
::-webkit-scrollbar-thumb:hover{background-color:var(--lime)}
.nav-index-panel::-webkit-scrollbar-track{background:rgba(25,115,79,.1)}
@supports (-moz-appearance:none){*{scrollbar-width:thin;scrollbar-color:#4d6853 #0b1712}}
@media(max-width:760px){::-webkit-scrollbar{width:4px;height:4px}}

/* ---------- 2 · chapter ticks hanging under the existing #bar ---------- */
#bar-ticks{position:fixed;top:0;left:0;right:0;height:10px;z-index:141;pointer-events:none;transition:opacity .6s}
#bar-ticks i{position:absolute;top:3px;left:0;width:1px;height:5px;background:rgba(213,243,106,.26);transition:height .3s,background-color .3s,box-shadow .3s}
#bar-ticks i.is-passed{background:rgba(213,243,106,.5)}
#bar-ticks i.is-active{height:8px;background:var(--lime);box-shadow:0 0 5px rgba(213,243,106,.5)}

/* ---------- 3 · header reaction after leaving the top ---------- */
.nav{transition:background-color .45s,border-color .45s,box-shadow .45s,transform .45s cubic-bezier(.2,.8,.2,1),opacity .45s}
.nav.is-scrolled{background-color:rgba(11,23,18,.975);border-bottom-color:rgba(213,243,106,.14);box-shadow:0 9px 20px -11px rgba(2,9,6,.55),inset 0 -1px 0 rgba(213,243,106,.07)}

/* ---------- 4 · right-hand chapter ruler (desktop) ---------- */
.rg-ruler{position:fixed;right:5px;top:50%;z-index:45;transform:translateY(-50%);display:flex;flex-direction:column;padding:5px 3px 5px 2px;background:rgba(11,23,18,.66);border:1px solid rgba(213,243,106,.12);border-radius:8px;transition:opacity .5s,visibility .5s}
.rg-ruler a{position:relative;display:flex;align-items:center;justify-content:flex-end;width:16px;height:22px;color:#a9b9a9}
.rg-ruler a::before{content:"";width:5px;height:1px;background:currentColor;opacity:.5;transition:width .25s,opacity .25s,box-shadow .25s}
.rg-ruler a::after{content:"";position:absolute;right:11px;top:50%;width:4px;height:4px;margin-top:-2px;border-radius:50%;background:var(--lime);opacity:0;transform:scale(.4);transition:opacity .25s,transform .25s}
.rg-ruler a:hover::before,.rg-ruler a:focus-visible::before{width:8px;opacity:1}
.rg-ruler a.is-current{color:var(--lime)}
.rg-ruler a.is-current::before{width:9px;height:2px;opacity:1;box-shadow:0 0 6px rgba(213,243,106,.45)}
.rg-ruler a.is-current::after{opacity:1;transform:none}
.rg-ruler a:focus-visible{outline:2px solid var(--lime);outline-offset:-2px;border-radius:4px}
.rg-ruler .r-n{position:absolute;right:calc(100% + 10px);top:50%;transform:translate(4px,-50%);padding:4px 8px;background:#0b1712;border:1px solid rgba(213,243,106,.3);color:#e6e9df;font:700 .66rem var(--h);letter-spacing:.13em;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s,transform .18s,visibility .18s}
.rg-ruler .r-n b{margin-right:6px;color:var(--lime)}
.rg-ruler a:hover .r-n,.rg-ruler a:focus-visible .r-n{opacity:1;visibility:visible;transform:translate(0,-50%)}
@media(max-width:1000px),(hover:none){.rg-ruler{display:none}}

/* ---------- 5 · back to top ---------- */
.rg-top{position:fixed;right:22px;bottom:22px;z-index:46;display:grid;place-items:center;width:42px;height:42px;padding:0;color:var(--lime);background:#0f2a1f;border:1.5px solid rgba(213,243,106,.45);border-radius:52% 48% 50% 50%/49% 52% 48% 51%;box-shadow:0 5px 14px rgba(2,9,6,.3);opacity:0;visibility:hidden;transform:translateY(10px) rotate(-6deg);transition:opacity .35s,visibility .35s,transform .35s cubic-bezier(.2,.8,.2,1),border-color .25s,background-color .25s}
.rg-top svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform .25s}
.rg-top.is-visible{opacity:1;visibility:visible;transform:none}
.rg-top.is-visible:hover{transform:translateY(-2px) rotate(-5deg);border-color:var(--lime);background:#14382a}
.rg-top:hover svg{transform:translateY(-2px)}
.rg-top:focus-visible{outline:2px solid var(--lime);outline-offset:3px}
/* the pinned Services / Work stages carry captions in the bottom-right corner */
html[data-chapter="services"] .rg-top,html[data-chapter="work"] .rg-top{opacity:0;visibility:hidden;pointer-events:none}
/* toasts keep their place above the button instead of sitting under it */
#toasts{transition:bottom .3s}
html.rg-top-on #toasts{bottom:78px}
@media(max-width:860px){
  .rg-top{right:14px;bottom:calc(14px + env(safe-area-inset-bottom,0px));width:38px;height:38px}
  html.rg-top-on #toasts{bottom:68px}
  /* chapters whose own controls live at the bottom of the screen */
  html[data-chapter="services"] .rg-top,html[data-chapter="work"] .rg-top,html[data-chapter="bundles"] .rg-top,html[data-chapter="start"] .rg-top{opacity:0;visibility:hidden;pointer-events:none}
}

/* quiet entrance with the header after the opening sequence */
html.intro #bar-ticks,html.intro .rg-ruler,html.intro .rg-top{opacity:0;visibility:hidden}
html.intro.rc #bar-ticks,html.intro.rc .rg-ruler{opacity:1;visibility:visible}

/* ---------- 6 · corner marks (only where a section had none) ---------- */
.fcard{position:relative}
.rg-crop{position:absolute;inset:-10px;z-index:3;pointer-events:none;
  background:
   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2319734F' stroke-opacity='.55' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M1.2 14.6C1 10 1.4 5 1.1 1.4 5 1.1 10 1.5 14.8 1.2'/%3E%3C/svg%3E") left top/15px 15px no-repeat,
   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2319734F' stroke-opacity='.55' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M1.2 1.3C5 1.6 10 1.1 14.6 1.4 14.9 5 14.5 10 14.8 14.7'/%3E%3C/svg%3E") right top/15px 15px no-repeat,
   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2319734F' stroke-opacity='.55' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M14.8 1.4C14.5 5 15 10 14.6 14.8 10 14.4 5 14.9 1.3 14.6'/%3E%3C/svg%3E") right bottom/15px 15px no-repeat,
   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2319734F' stroke-opacity='.55' stroke-width='1.3' stroke-linecap='round'%3E%3Cpath d='M1.3 1.2C1.5 5 1 10 1.4 14.7 5 14.9 10 14.4 14.6 14.8'/%3E%3C/svg%3E") left bottom/15px 15px no-repeat}

/* ---------- 8 · sheet labels (same voice as .sketch-scale / .svs-tb) ---------- */
.rg-tag{position:absolute;left:16px;right:16px;top:calc(100% + 14px);display:flex;justify-content:space-between;gap:12px;margin:0;color:#718073;font:700 .66rem var(--h);letter-spacing:.12em;white-space:nowrap;pointer-events:none}
.rg-tag-end{justify-content:flex-end;left:auto;right:4px;top:calc(100% + 18px)}
@media(max-width:860px){.rg-tag{display:none}}

/* ---------- 7 · ink strokes that draw themselves once ---------- */
[data-ink]{position:relative}
p.note[data-ink]{width:fit-content}
.ink-stroke{position:absolute;left:-2%;width:104%;overflow:visible;pointer-events:none}
.ink-stroke path{fill:none;stroke:var(--em);stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset .75s cubic-bezier(.45,.05,.25,1) .1s}
.ink-stroke path+path{stroke:var(--lime);transition-delay:.5s;transition-duration:.45s}
.ink-stroke.is-drawn path{stroke-dashoffset:0}
.ink-stroke.on-dark path{stroke:var(--lime);stroke-width:2.4}
.ink-stroke.on-dark path+path{stroke:var(--lab-mint,#8be2c2)}

@media(prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  #bar-ticks i,.nav,.rg-ruler,.rg-ruler a::before,.rg-ruler a::after,.rg-ruler .r-n,.rg-top,.rg-top svg,#toasts,.ink-stroke path{transition:none!important}
  .ink-stroke path{stroke-dashoffset:0}
  html.intro #bar-ticks,html.intro .rg-ruler{opacity:1;visibility:visible}
}
