/* ofinanse: floating TOC + highlighter (single posts) */

mark.ofn-hl {
  color: inherit;
  background-color: transparent;
  background-image: linear-gradient(
    to bottom,
    transparent 42%,
    rgba(255, 214, 10, 0.45) 42%
  );
  padding: 0 0.15em;
  border-radius: 0.12em 0.38em 0.18em 0.42em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

@media (prefers-reduced-motion: no-preference) {
  mark.ofn-hl {
    background-repeat: no-repeat;
    background-size: 0 100%;
    animation: ofn-hl-draw 0.7s ease forwards;
  }

  @keyframes ofn-hl-draw {
    to { background-size: 100% 100%; }
  }
}

.ofn-toc {
  --ofn-toc-bg: #040914;
  --ofn-toc-text: #f5f1e8;
  --ofn-toc-shadow: #232a44;
  --ofn-toc-accent: #376bcb;
  box-sizing: border-box;
  background: var(--ofn-toc-bg);
  color: var(--ofn-toc-text);
  border: 1px solid var(--ofn-toc-shadow);
  border-radius: 10px;
  box-shadow: 6px 6px 0 var(--ofn-toc-shadow);
  padding: 14px 12px 12px;
  font-size: 14px;
  line-height: 1.4;
  z-index: 80;
}

.ofn-toc *,
.ofn-toc-fab,
.ofn-toc-backdrop {
  box-sizing: border-box;
}

.ofn-toc__title {
  margin: 0 0 10px;
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ofn-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ofn-toc__list a {
  display: block;
  color: var(--ofn-toc-text);
  text-decoration: none;
  padding: 7px 8px 7px 10px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ofn-toc__list a:hover {
  background: rgba(55, 107, 203, 0.14);
}

.ofn-toc__list a.is-active,
.ofn-toc__list a[aria-current="true"] {
  background: rgba(55, 107, 203, 0.22);
  border-left-color: var(--ofn-toc-accent);
  color: #fff;
}

.ofn-toc__list a:focus-visible {
  outline: 2px solid var(--ofn-toc-accent);
  outline-offset: 2px;
}

.ofn-toc-fab {
  display: none;
  position: fixed;
  right: 16px;
  bottom: var(--ofn-toc-fab-bottom, 20px);
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #232a44;
  background: #040914;
  color: #f5f1e8;
  box-shadow: 5px 5px 0 #232a44;
  cursor: pointer;
  z-index: 90;
  align-items: center;
  justify-content: center;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.ofn-toc-fab:hover,
.ofn-toc-fab:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 #232a44;
  outline: none;
}

.ofn-toc-fab:focus-visible {
  outline: 3px solid #376bcb;
  outline-offset: 3px;
}

.ofn-toc-fab:active,
.ofn-toc-fab[aria-expanded="true"] {
  transform: translate(5px, 5px);
  box-shadow: 0 0 0 #232a44;
}

.ofn-toc-fab svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.ofn-toc-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 20, 0.35);
  z-index: 85;
}

/* Desktop: floating panel to the right of the article column */
@media (min-width: 1200px) {
  .ofn-toc {
    position: fixed;
    top: var(--ofn-toc-top, 100px);
    left: var(--ofn-toc-left, auto);
    width: var(--ofn-toc-width, 230px);
    max-height: var(--ofn-toc-max-height, calc(100vh - var(--ofn-toc-top, 100px) - 24px));
    overflow-y: auto;
  }

  .ofn-toc.is-hidden-desktop {
    display: none;
  }
}

/* Mobile / tablet: hidden sheet + 3D FAB */
@media (max-width: 1199.98px) {
  .ofn-toc-fab {
    display: inline-flex;
  }

  .ofn-toc {
    position: fixed;
    right: 16px;
    bottom: calc(var(--ofn-toc-fab-bottom, 20px) + 68px);
    left: auto;
    width: min(320px, calc(100vw - 32px));
    max-height: min(70vh, calc(100vh - var(--ofn-toc-fab-bottom, 20px) - 96px));
    overflow-y: auto;
    transform: translateY(12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  }

  .ofn-toc.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .ofn-toc-backdrop.is-open {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ofn-toc,
  .ofn-toc-fab,
  mark.ofn-hl {
    animation: none;
    transition: none;
  }

  mark.ofn-hl {
    background-size: 100% 100%;
  }
}

/* Single-post hero meta pills (author, date, category).
   Scoped to .glass-header pills that wrap those blocks, so archive
   hero (a single "ofinanse.pl" chip) is never affected — this file
   is also enqueued only on singular posts. */
.glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-author),
.glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-date),
.glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-terms) {
  width: auto !important;
  max-width: 100%;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}

.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-author,
.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-author__content,
.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-date,
.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-terms {
  display: inline-flex;
  align-items: center;
  width: auto !important;
  max-width: none;
  flex: 0 0 auto !important;
  flex-grow: 0 !important;
  flex-basis: auto !important;
  margin: 0;
}

.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-author__name,
.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-date time,
.glass-header > .is-layout-flex > .wp-block-group.has-background .wp-block-post-terms a {
  margin: 0;
  white-space: nowrap;
}

.glass-header .ofn-meta-icon {
  flex: 0 0 auto;
  line-height: 1;
  font-size: 1em;
}

.glass-header .ofn-date-short {
  display: none;
}

@media (max-width: 1199.98px) {
  .glass-header {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .glass-header > .is-layout-flex:has(.wp-block-post-author) {
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px !important;
  }

  .glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-author),
  .glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-date),
  .glass-header > .is-layout-flex > .wp-block-group.has-background:has(.wp-block-post-terms) {
    padding: 4px 8px !important;
    font-size: 12px !important;
    gap: 4px !important;
    white-space: nowrap;
  }

  .glass-header .ofn-meta-icon {
    font-size: 12px;
  }
}

/* Short date (e.g. 10.11.2026) only on narrow phones, original text stays in the DOM. */
@media (max-width: 430px) {
  .glass-header .ofn-date-long {
    display: none;
  }

  .glass-header .ofn-date-short {
    display: inline;
  }
}

/* Allow two lines only on very narrow screens. */
@media (max-width: 339.98px) {
  .glass-header > .is-layout-flex:has(.wp-block-post-author) {
    flex-wrap: wrap;
  }
}
