/* Shared finishing touches for every page of TheCompoundMove. */

html{scroll-behavior:smooth;}
@media (prefers-reduced-motion:reduce){ html{scroll-behavior:auto;} }
[id]{scroll-margin-top:84px;}

/* Thin, quiet scrollbars */
html{scrollbar-width:thin; scrollbar-color:var(--rule) transparent;}
::-webkit-scrollbar{width:10px; height:10px;}
::-webkit-scrollbar-thumb{background:var(--rule); border-radius:10px; border:2px solid var(--paper);}
::-webkit-scrollbar-thumb:hover{background:var(--ink-faint);}
::-webkit-scrollbar-track{background:transparent;}

::selection{background:var(--accent); color:#fff;}
:focus-visible{outline:2px solid var(--accent); outline-offset:3px;}

/* Sticky header that firms up once you scroll */
body > header{position:sticky !important; top:0; z-index:40 !important; transition:background .25s ease, box-shadow .25s ease, padding .25s ease, border-color .25s ease; border-bottom:1px solid transparent;}
body > header.is-scrolled{
  background:color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter:saturate(1.4) blur(12px); backdrop-filter:saturate(1.4) blur(12px);
  border-bottom-color:var(--rule); box-shadow:0 6px 24px rgba(0,0,0,.12);
}
@supports not (background:color-mix(in srgb, red 50%, blue)){ body > header.is-scrolled{background:var(--paper);} }

/* Scroll progress line (all pages) */
.ui-progress{position:fixed; top:0; left:0; height:2px; width:0; z-index:60; background:linear-gradient(90deg,var(--accent),var(--warn)); pointer-events:none; transition:width .1s linear;}

/* Active section in the homepage nav */
nav a.is-active{border-color:var(--accent) !important; color:var(--accent) !important;}

/* Back to top */
.ui-top{position:fixed; right:18px; bottom:18px; z-index:45; width:44px; height:44px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  background:var(--surface); color:var(--ink); border:1px solid var(--rule); box-shadow:0 10px 28px rgba(0,0,0,.25);
  opacity:0; transform:translateY(12px); pointer-events:none; transition:opacity .25s ease, transform .3s var(--ease, ease), border-color .2s;}
.ui-top.show{opacity:1; transform:none; pointer-events:auto;}
.ui-top:hover{border-color:var(--accent); color:var(--accent);}
.ui-top svg{width:18px; height:18px;}

/* Share row on articles */
.ui-share{display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:28px 0 8px; padding-top:20px; border-top:1px solid var(--rule);}
.ui-share-label{font-family:'Zilla Slab',serif; font-weight:700; font-size:17px; color:var(--ink); margin-right:6px;}
.ui-share a, .ui-share button{display:inline-flex; align-items:center; gap:7px; font:inherit; font-size:13.5px; font-weight:600; text-decoration:none; cursor:pointer;
  color:var(--ink); background:var(--surface); border:1px solid var(--rule); border-radius:999px; padding:8px 13px; transition:border-color .2s, transform .2s;}
.ui-share a:hover, .ui-share button:hover{border-color:var(--accent); transform:translateY(-1px);}
.ui-share svg{width:15px; height:15px; fill:currentColor;}
.ui-share .is-done{border-color:var(--up); color:var(--up);}

/* Soft page entrance */
@media (prefers-reduced-motion:no-preference){
  body{animation:uiFade .45s ease both;}
  @keyframes uiFade{from{opacity:0;} to{opacity:1;}}
}

@media print{
  body > header, .ui-top, .ui-progress, .ui-share, .kg, .bg-layers, #introOverlay{display:none !important;}
  body{background:#fff !important; color:#000 !important;}
}
