/* apulsense.css — variabili condivise e barra di navigazione.
   Lo caricano la home e ogni capitolo: qui non c'è nulla che tocchi body,
   heading o layout del capitolo. Solo custom property, un font e la barra. */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ap-pietra: #F2EBDD;
  --ap-terra: #9B4A2C;
  --ap-ulivo: #6E7A4E;
  --ap-adriatico: #1F4E6B;
  --ap-inchiostro: #1C1A17;
  --ap-font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --ap-font-text: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --ap-ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Altezza della barra: i capitoli la usano per far scendere la propria
     testata fissa (top: var(--apulsense-bar-h)). Va a 0 quando la barra si
     nasconde scorrendo verso il basso. */
  --apulsense-bar-h: 44px;
}
html.apulsense-bar-hidden { --apulsense-bar-h: 0px; }

.apulsense-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 44px;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(16px, 3vw, 40px);
  background: rgba(28, 26, 23, 0.92);
  color: var(--ap-pietra);
  font: 500 15px/1 var(--ap-font-text);
  letter-spacing: 0.01em;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(242, 235, 221, 0.10), inset 0 -2px 0 var(--ap-cur, transparent);
  transform: translateY(0);
  transition: transform 0.35s var(--ap-ease);
}
html.apulsense-bar-hidden .apulsense-bar { transform: translateY(-100%); }

.apulsense-bar a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 44px;
  white-space: nowrap;
  opacity: 0.92;
  transition: opacity 0.2s;
}
.apulsense-bar a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 0.2em; }
.apulsense-bar a:focus-visible { outline: 2px solid var(--ap-pietra); outline-offset: -4px; }
.apulsense-bar b { font-family: var(--ap-font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.apulsense-bar__title {
  flex: 1;
  text-align: center;
  font-size: 13.5px;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.apulsense-bar__next[hidden] { display: none; }
.apulsense-bar__next::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ap-next, var(--ap-pietra));
  box-shadow: 0 0 0 1px rgba(242, 235, 221, 0.3);
}
@media (max-width: 640px) {
  .apulsense-bar__title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .apulsense-bar { transition: none; }
}
