/* ==========================================================================
   Retro Fusion - a Web 1.0 Hugo theme
   --------------------------------------------------------------------------
   Contents
     01. Tokens & reset
     02. Base typography
     03. Tiled backgrounds
     04. Layout shell
     05. Window chrome
     06. Buttons
     07. Cards
     08. Header, logo & marquee
     09. Navigation (multi-level dropdowns)
     10. Breadcrumbs
     11. Hero
     12. Carousel
     13. Services grid
     14. FAQ accordion
     15. Sidebar widgets
     16. Meta strip, chips, badges & counter
     17. Article, prose & table of contents
     18. Share, prev/next & related
     19. Pagination
     20. Footer & webring
     21. Back-to-top
     22. Utilities
     23. Responsive
     24. Motion, media queries and print
   ========================================================================== */

/* ==========================================================================
   01. Tokens & reset
   --------------------------------------------------------------------------
   Every colour below is overridable from hugo.toml via [params.theme].
   head.html emits the :root block; these are the fallbacks.
   ========================================================================== */

:root {
  --rf-bg: #c0c0c0;
  --rf-bg-alt: #d4d0c8;
  --rf-surface: #ffffff;
  --rf-surface-alt: #f4f4f4;
  --rf-ink: #101010;
  --rf-ink-soft: #4a4a4a;
  --rf-primary: #000080;
  --rf-primary-alt: #008080;
  --rf-accent: #ff2d95;
  --rf-accent-2: #ffcc00;
  --rf-link: #0000ee;
  --rf-link-visited: #551a8b;
  --rf-border: #000000;
  --rf-bevel-light: #ffffff;
  --rf-bevel-dark: #6e6e6e;
  --rf-radius: 0;

  --rf-font-body: Verdana, Geneva, 'DejaVu Sans', sans-serif;
  --rf-font-head: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  --rf-font-mono: 'Courier New', Courier, monospace;
  --rf-font-pixel: var(--rf-font-head);

  --rf-max-width: 1080px;
  --rf-gap: 20px;

  --rf-bevel: 3px;
  --rf-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--rf-font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--rf-ink);
  background-color: var(--rf-bg);
  overflow-x: hidden;
}

img, picture, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Keep the classic look crisp rather than mushy on retina */
img { image-rendering: auto; }

hr {
  border: 0;
  height: 4px;
  margin: 1.75rem 0;
  background:
    repeating-linear-gradient(
      90deg,
      var(--rf-border) 0 6px,
      transparent 6px 12px
    );
}

/* ==========================================================================
   02. Base typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--rf-font-head);
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--rf-primary);
  text-shadow: 1px 1px 0 var(--rf-bevel-light);
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.95rem); }
h3 { font-size: clamp(1.15rem, 1rem + 0.7vw, 1.4rem); }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; }

p { margin: 0 0 1.1em; }

a {
  color: var(--rf-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:visited { color: var(--rf-link-visited); }
a:hover,
a:focus { color: var(--rf-accent); }

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px dashed var(--rf-accent);
  outline-offset: 2px;
}

code, kbd, samp, pre {
  font-family: var(--rf-font-mono);
  font-size: 0.94em;
}

kbd {
  background: var(--rf-bg-alt);
  border: 2px outset var(--rf-bevel-light);
  border-radius: 0;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--rf-surface-alt);
  border: 2px solid var(--rf-border);
  border-left-width: 8px;
  border-left-color: var(--rf-primary-alt);
}

blockquote p:last-child { margin-bottom: 0; }

::selection {
  background: var(--rf-primary);
  color: #fff;
}

/* ==========================================================================
   03. Tiled backgrounds
   --------------------------------------------------------------------------
   data-tile is set on <html> from params.theme.tile.
   ========================================================================== */

html[data-tile="checker"] body {
  background-image:
    conic-gradient(from 90deg at 50% 50%,
      #b8b8b8 25%, var(--rf-bg) 0 50%, #b8b8b8 0 75%, var(--rf-bg) 0);
  background-size: 32px 32px;
}

html[data-tile="grid"] body {
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.07) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.07) 2px, transparent 2px);
  background-size: 24px 24px;
}

html[data-tile="dots"] body {
  background-image: radial-gradient(rgba(0, 0, 0, 0.16) 2px, transparent 2px);
  background-size: 20px 20px;
}

html[data-tile="stars"] body {
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 70px 90px, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 130px 40px, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 180px 140px, rgba(255, 255, 255, 0.5), transparent);
  background-color: #0b0b3b;
  background-size: 220px 180px;
}
html[data-tile="stars"] .rf-window,
html[data-tile="stars"] .rf-card { border-color: #eaeaea; }

html[data-tile="diagonal"] body {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.35) 0 12px,
    transparent 12px 24px);
}

/* Optional CRT scanline overlay: params.theme.scanlines = true */
body.has-scanlines::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.045) 0 1px,
    transparent 1px 3px);
}

/* ==========================================================================
   04. Layout shell
   ========================================================================== */

.rf-shell {
  max-width: var(--rf-max-width);
  margin: 0 auto;
  padding: var(--rf-gap);
}

.rf-layout {
  display: block;
}

.rf-layout--with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: calc(var(--rf-gap) * 1.4);
  align-items: start;
}

.rf-layout__main { min-width: 0; }

/* Children of the stacked layout get breathing room. The grid variant
   already has `gap`, so exclude it, or the sidebar starts one gap
   lower than the article sitting beside it. */
.rf-layout:not(.rf-layout--with-sidebar) > * + * { margin-top: var(--rf-gap); }

.rf-section { margin: 0 0 calc(var(--rf-gap) * 1.6); }

.rf-section__head {
  margin-bottom: var(--rf-gap);
  text-align: center;
}

.rf-section__head--bar {
  text-align: left;
  border-bottom: 4px double var(--rf-border);
  padding-bottom: 0.4rem;
}

.rf-section__title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rf-section__title::before,
.rf-section__title::after {
  content: "★";
  color: var(--rf-accent-2);
  font-size: 0.7em;
  vertical-align: middle;
  margin: 0 0.5em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.rf-section__head--bar .rf-section__title::before { content: "▸"; margin-left: 0; }

.rf-section__subtitle {
  margin: 0.25rem 0 0;
  color: var(--rf-ink-soft);
  font-size: 0.95rem;
}

.rf-section__more { text-align: center; margin-top: var(--rf-gap); }

/* ==========================================================================
   05. Window chrome
   ========================================================================== */

.rf-window {
  background: var(--rf-surface);
  border: var(--rf-bevel) solid var(--rf-border);
  border-radius: var(--rf-radius);
  box-shadow:
    inset -2px -2px 0 var(--rf-bevel-dark),
    inset 2px 2px 0 var(--rf-bevel-light),
    var(--rf-shadow);
  margin: 0 0 var(--rf-gap);
  overflow: hidden;
}

.rf-window__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 5px 6px 5px 10px;
  background: linear-gradient(90deg, var(--rf-primary) 0%, var(--rf-primary-alt) 100%);
  border-bottom: var(--rf-bevel) solid var(--rf-border);
  color: #fff;
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: default;
}

summary.rf-window__bar { cursor: pointer; list-style: none; }
summary.rf-window__bar::-webkit-details-marker { display: none; }

/* The page <h1> lives in here on most templates, so neutralise the global
   heading styles rather than letting them fight the title bar. */
.rf-window__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  font-family: var(--rf-font-head);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.rf-window__controls { display: flex; gap: 3px; flex: 0 0 auto; }

.rf-window__btn {
  display: grid;
  place-items: center;
  width: 18px;
  height: 16px;
  background: var(--rf-bg);
  border: 2px outset var(--rf-bevel-light);
  border-radius: 0;
  color: #000;
  font-family: var(--rf-font-body);
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
}

.rf-window__btn--close { background: #ff8c8c; }

.rf-window__body { padding: calc(var(--rf-gap) * 0.9); }
.rf-window__body > :last-child { margin-bottom: 0; }

.rf-window__img { width: 100%; display: block; }

.rf-window--framed { margin-bottom: 0; }

.rf-error { max-width: 720px; margin-inline: auto; }

.rf-error__code {
  font-family: var(--rf-font-mono);
  font-size: clamp(4rem, 3rem + 8vw, 8rem);
  line-height: 0.9;
  font-weight: 700;
  color: var(--rf-accent);
  text-shadow: 3px 3px 0 var(--rf-primary), 6px 6px 0 rgba(0, 0, 0, 0.25);
  margin: 0 0 0.2em;
}

.rf-error__title { font-size: 1.3rem; }

/* ==========================================================================
   06. Buttons
   ========================================================================== */

.rf-btn {
  display: inline-block;
  padding: 0.55em 1.1em;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) outset var(--rf-bevel-light);
  border-radius: var(--rf-radius);
  color: #000;
  font-family: var(--rf-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
  transition: transform 60ms linear, box-shadow 60ms linear;
}

.rf-btn:visited { color: #000; }

.rf-btn:hover,
.rf-btn:focus {
  background: #e6e2da;
  color: #000;
}

.rf-btn:active {
  border-style: inset;
  transform: translate(2px, 2px);
  box-shadow: none;
}

.rf-btn--primary {
  background: linear-gradient(180deg, #3b6fe0 0%, var(--rf-primary) 100%);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}
.rf-btn--primary:visited { color: #fff; }
.rf-btn--primary:hover,
.rf-btn--primary:focus {
  background: linear-gradient(180deg, #5583ea 0%, #12129c 100%);
  color: #fff;
}

.rf-btn--accent {
  background: linear-gradient(180deg, #ff5fb0 0%, var(--rf-accent) 100%);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}
.rf-btn--accent:visited { color: #fff; }
.rf-btn--accent:hover,
.rf-btn--accent:focus { background: linear-gradient(180deg, #ff7dbf 0%, #d8006f 100%); color: #fff; }

.rf-btn--ghost {
  background: transparent;
  color: #fff;
  border-color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}
.rf-btn--ghost:visited { color: #fff; }
.rf-btn--ghost:hover,
.rf-btn--ghost:focus { background: rgba(255, 255, 255, 0.18); color: #fff; }

.rf-btn--sm { padding: 0.35em 0.75em; font-size: 0.82rem; }
.rf-btn--lg { padding: 0.75em 1.6em; font-size: 1.05rem; }

/* ==========================================================================
   07. Cards
   ========================================================================== */

/* `stretch` (not `start`) is what makes every card in a row the same height. */
.rf-cards {
  display: grid;
  gap: var(--rf-gap);
  align-items: stretch;
}

.rf-cards--stack { grid-template-columns: minmax(0, 1fr); }
.rf-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rf-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rf-cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.rf-card {
  position: relative;
  /* Block, not flex-column. See the card notes further down. */
  display: block;
  background: var(--rf-surface);
  border: var(--rf-bevel) solid var(--rf-border);
  border-radius: var(--rf-radius);
  box-shadow:
    inset -2px -2px 0 var(--rf-bevel-dark),
    inset 2px 2px 0 var(--rf-bevel-light),
    3px 3px 0 rgba(0, 0, 0, 0.3);
  padding: calc(var(--rf-gap) * 0.8);
  transition: transform 90ms linear, box-shadow 90ms linear;
}

.rf-card:hover {
  transform: translate(-2px, -2px);
  box-shadow:
    inset -2px -2px 0 var(--rf-bevel-dark),
    inset 2px 2px 0 var(--rf-bevel-light),
    5px 5px 0 rgba(0, 0, 0, 0.34);
}

.rf-card--post.is-featured {
  background: linear-gradient(180deg, #fffdf0 0%, var(--rf-surface) 60%);
  border-color: var(--rf-accent);
}

/* ---------------------------------------------------------------------------
   Post card internals.

   Keep .rf-card and .rf-card__text as plain blocks. As flex containers they
   would blockify their children's display, and -webkit-line-clamp stops
   working when that happens. No error, no warning: long excerpts just render
   at full length and spill out over the card below.

   The clamped elements use a fixed height rather than min-height so that if a
   browser ignores the clamp the text clips instead of escaping.
--------------------------------------------------------------------------- */

.rf-card__title {
  margin: 0 0 0.4em;
  font-size: 1.25rem;
}

.rf-card__title a { text-decoration: none; }
.rf-card__title a:hover { text-decoration: underline; }

/* Post cards: title pinned to exactly N lines. Scoped to --post so service
   card headings keep their natural height. */
.rf-card--post .rf-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--rf-title-lines, 2);
  line-clamp: var(--rf-title-lines, 2);
  overflow: hidden;
  height: calc(var(--rf-title-lines, 2) * 1.2em + 0.3em + 3px);
  border-bottom: 3px double var(--rf-border);
  padding-bottom: 0.3em;
}

.rf-card__body {
  display: flex;
  gap: calc(var(--rf-gap) * 0.8);
  align-items: flex-start;
  margin-top: 0.5rem;
}

.rf-card__thumb {
  flex: 0 0 150px;
  border: 2px solid var(--rf-border);
  background: var(--rf-bg-alt);
  padding: 2px;
}
.rf-card__thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* Stand-in for a post with no cover image. Same 4:3 box, so the card keeps
   the same height as its neighbours. */
.rf-card__thumb--placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background-image:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 6px, transparent 6px 12px),
    radial-gradient(rgba(0, 0, 0, 0.12) 1.5px, transparent 1.6px);
  background-size: auto, 12px 12px;
}

.rf-card__thumb-mark {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--rf-primary);
  opacity: 0.5;
}

/* Plain block. See the note above about line-clamp vs flexbox. */
.rf-card__text {
  flex: 1 1 auto;
  min-width: 0;
}
.rf-card__text p { margin-bottom: 0.7em; }

/* The equaliser: exactly N lines tall, clipping anything longer. */
.rf-card--post .rf-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--rf-excerpt-lines, 3);
  line-clamp: var(--rf-excerpt-lines, 3);
  overflow: hidden;
  height: calc(var(--rf-excerpt-lines, 3) * 1.65em);
  margin: 0 0 0.7em;
}

/* Tags: normally one row, wrapping to a second rather than clipping. The
   min-height keeps a card with no tags the same height as one with them.

   No overflow:hidden. A chip is a single unbreakable label, so a row that
   doesn't fit would be sliced mid-chip at the card edge, which looks like a
   rendering fault. A card one line taller looks fine. */
.rf-card--post .rf-card__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.9em;
  margin: 0 0 0.7em;
}

.rf-card__more { margin: 0; }

/* In multi-column grids a side-by-side thumbnail gets cramped, so the image
   moves above the text and the card reads as a uniform tile. */
.rf-cards--2 .rf-card__body,
.rf-cards--3 .rf-card__body,
.rf-cards--4 .rf-card__body { flex-direction: column; }

.rf-cards--2 .rf-card__thumb,
.rf-cards--3 .rf-card__thumb,
.rf-cards--4 .rf-card__thumb {
  flex: 0 0 auto;
  width: 100%;
}

.rf-flag {
  display: inline-block;
  background: var(--rf-accent-2);
  border: 2px solid var(--rf-border);
  padding: 0.05em 0.45em;
  font-size: 0.8em;
  color: #000;
  text-shadow: none;
}

.rf-badge-flag {
  position: absolute;
  top: -10px;
  right: -8px;
  background: var(--rf-accent);
  color: #fff;
  border: 2px solid var(--rf-border);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15em 0.5em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Service cards ---- */

.rf-card--service { text-align: center; }
.rf-card--service .rf-card__head { margin-bottom: 0.5rem; }
.rf-card--service .rf-card__title {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0.2em;
  font-size: 1.1rem;
}

.rf-card__icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.5rem;
  font-size: 1.8rem;
  line-height: 1;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) outset var(--rf-bevel-light);
}

.rf-empty { text-align: center; padding: calc(var(--rf-gap) * 1.4); }
.rf-empty > :last-child { margin-bottom: 0; }

/* ==========================================================================
   08. Header, logo & marquee
   ========================================================================== */

.rf-header { margin-bottom: var(--rf-gap); }

.rf-header__banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--rf-gap);
  padding: calc(var(--rf-gap) * 0.9);
  background: linear-gradient(135deg, var(--rf-primary) 0%, var(--rf-primary-alt) 55%, #12b0b0 100%);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow:
    inset -2px -2px 0 rgba(0, 0, 0, 0.35),
    inset 2px 2px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  overflow: hidden;
}

/* Retro halftone sparkle in the banner corner */
.rf-header__banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1.5px, transparent 1.6px);
  background-size: 14px 14px;
  opacity: 0.5;
}

.rf-header__brand { position: relative; z-index: 1; min-width: 0; }

.rf-logo { display: inline-block; text-decoration: none; }

.rf-logo__text {
  display: inline-block;
  font-family: var(--rf-font-pixel);
  font-size: clamp(1.5rem, 1rem + 2.6vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.rf-logo__text--pixel { text-shadow: 3px 3px 0 var(--rf-accent), 6px 6px 0 rgba(0, 0, 0, 0.4); }

.rf-logo__text--plain { text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45); }

.rf-logo__text--rainbow {
  background: linear-gradient(90deg, #ff004d, #ff8a00, #ffe600, #29d94b, #00c2ff, #8b5cf6, #ff004d);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: none;
  animation: rf-rainbow 8s linear infinite;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.5));
}

@keyframes rf-rainbow {
  from { background-position: 0% 50%; }
  to { background-position: 300% 50%; }
}

.rf-logo__text--chrome {
  background: linear-gradient(180deg, #fff 0%, #b9c6d8 45%, #4a5a70 52%, #e8eef7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.55));
}

.rf-logo__img { max-height: 90px; width: auto; }

.rf-tagline {
  margin: 0.35rem 0 0;
  color: #eaf6ff;
  font-size: 0.95rem;
  font-style: italic;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.rf-header__badges {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---- Ticker ---- */

.rf-marquee {
  overflow: hidden;
  margin-top: 8px;
  background: #000;
  border: var(--rf-bevel) inset var(--rf-bevel-light);
  color: #39ff14;
  font-family: var(--rf-font-mono);
  font-size: 0.9rem;
  padding: 4px 0;
}

.rf-marquee__track {
  display: inline-flex;
  white-space: nowrap;
  animation: rf-marquee 28s linear infinite;
  will-change: transform;
}

.rf-marquee__text { padding-right: 4rem; }

@keyframes rf-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.rf-marquee:hover .rf-marquee__track,
.rf-marquee:focus-within .rf-marquee__track { animation-play-state: paused; }

/* ==========================================================================
   09. Navigation
   ========================================================================== */

.rf-nav {
  position: relative;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) solid var(--rf-border);
  border-top: 0;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
  z-index: 50;
}

.rf-nav--sticky {
  position: sticky;
  top: 0;
  z-index: 60;
}

.rf-nav__toggle {
  display: none;
  width: 100%;
  padding: 0.7em 1em;
  background: linear-gradient(180deg, #3b6fe0 0%, var(--rf-primary) 100%);
  border: 0;
  color: #fff;
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  align-items: center;
  gap: 0.6em;
}

.rf-nav__toggle-bars { display: inline-flex; flex-direction: column; gap: 3px; }
.rf-nav__toggle-bars i { display: block; width: 18px; height: 3px; background: #fff; }

.rf-nav__drawer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.4rem;
}

.rf-nav__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rf-nav__item { position: relative; display: flex; align-items: center; }

.rf-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.6em 0.85em;
  color: #000;
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 0.93rem;
  text-decoration: none;
  border: 2px solid transparent;
  white-space: nowrap;
}

.rf-nav__link:visited { color: #000; }

.rf-nav__link:hover,
.rf-nav__link:focus {
  background: var(--rf-surface);
  border: 2px outset var(--rf-bevel-light);
  color: var(--rf-primary);
}

.rf-nav__item.is-current > .rf-nav__link {
  background: var(--rf-primary);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

.rf-nav__caret { font-size: 0.7em; }

.rf-nav__sub-toggle {
  display: none;
  background: transparent;
  border: 0;
  font-size: 0.7rem;
  padding: 0.6em 0.4em;
  cursor: pointer;
  color: #000;
}

/* ---- Dropdown panels ---- */

.rf-nav__menu .rf-nav__menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 70;
  display: block;
  min-width: 220px;
  padding: 4px;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: var(--rf-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
}

.rf-nav__item:hover > .rf-nav__menu,
.rf-nav__item:focus-within > .rf-nav__menu,
.rf-nav__item.is-open > .rf-nav__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rf-nav__menu .rf-nav__menu .rf-nav__item { display: block; width: 100%; }

.rf-nav__menu .rf-nav__link {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.rf-nav__menu .rf-nav__item:last-child > .rf-nav__link { border-bottom: 0; }

/* Third level and deeper opens to the side */
.rf-nav__menu .rf-nav__menu .rf-nav__menu {
  top: -5px;
  left: 100%;
}

.rf-nav__menu .rf-nav__item--has-children > .rf-nav__link::after {
  content: "▸";
  float: right;
  font-size: 0.7em;
  opacity: 0.7;
}

.rf-nav__menu--l1 > .rf-nav__item--has-children > .rf-nav__link::after { content: "▾"; }

.rf-nav__search {
  display: flex;
  gap: 4px;
  margin-left: auto;
  padding: 0.3rem;
}

.rf-nav__search input {
  font-family: var(--rf-font-body);
  font-size: 0.9rem;
  padding: 0.35em 0.6em;
  border: 2px inset var(--rf-bevel-light);
  background: var(--rf-surface);
  min-width: 0;
}

.rf-nav__cta { margin: 0.3rem 0.3rem 0.3rem auto; }

/* ==========================================================================
   10. Breadcrumbs
   ========================================================================== */

.rf-breadcrumbs {
  margin-bottom: var(--rf-gap);
  padding: 0.5rem 0.8rem;
  background: var(--rf-surface-alt);
  border: 2px inset var(--rf-bevel-light);
  font-size: 0.88rem;
}

.rf-breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rf-breadcrumbs__item { display: flex; align-items: center; gap: 0.4rem; }
.rf-breadcrumbs__sep { color: var(--rf-bevel-dark); font-weight: 700; }
.rf-breadcrumbs__item--current { font-weight: 700; color: var(--rf-ink-soft); }

/* ==========================================================================
   11. Hero
   ========================================================================== */

.rf-hero {
  margin-bottom: calc(var(--rf-gap) * 1.5);
  padding: calc(var(--rf-gap) * 1.8) calc(var(--rf-gap) * 1.4);
  background: linear-gradient(135deg, #123 0%, var(--rf-primary) 45%, var(--rf-primary-alt) 100%);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow:
    inset -2px -2px 0 rgba(0, 0, 0, 0.4),
    inset 2px 2px 0 rgba(255, 255, 255, 0.3),
    var(--rf-shadow);
  background-size: cover;
  background-position: center;
  color: #fff;
}

.rf-hero__inner {
  display: grid;
  gap: calc(var(--rf-gap) * 1.4);
  align-items: center;
}

.rf-hero--split .rf-hero__inner { grid-template-columns: 1.15fr 0.85fr; }
.rf-hero--center { text-align: center; }
.rf-hero--center .rf-hero__inner { grid-template-columns: minmax(0, 1fr); }
.rf-hero--center .rf-hero__actions { justify-content: center; }
.rf-hero--right { text-align: right; }
.rf-hero--right .rf-hero__actions { justify-content: flex-end; }

.rf-hero__eyebrow { margin: 0 0 0.8rem; }

.rf-hero__title {
  margin: 0 0 0.5em;
  color: #fff;
  font-size: clamp(1.9rem, 1.3rem + 3.2vw, 3.2rem);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

.rf-hero__subtitle {
  font-size: clamp(1rem, 0.95rem + 0.5vw, 1.25rem);
  margin: 0 0 1em;
  color: #e8f6ff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.rf-hero__text { margin-bottom: 1.2em; }

.rf-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.6em;
}

.rf-hero__note { font-size: 0.88rem; opacity: 0.9; margin: 0; }

.rf-hero__media { min-width: 0; }

/* ==========================================================================
   12. Carousel
   ========================================================================== */

.rf-carousel {
  position: relative;
  margin-bottom: calc(var(--rf-gap) * 1.5);
  padding: 4px;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: var(--rf-shadow);
}

.rf-carousel__heading {
  margin: 0.4rem 0.6rem 0.6rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rf-carousel__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  background: #000;
  border: 2px inset var(--rf-bevel-light);
}

.rf-carousel__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rf-carousel__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  min-width: 0;
}

.rf-carousel__link {
  position: relative;
  display: block;
  color: #fff;
  text-decoration: none;
}

.rf-carousel__img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

.rf-carousel__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.2rem 1.4rem;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.82) 60%);
  color: #fff;
}

.rf-carousel__title {
  margin: 0 0 0.25em;
  color: #fff;
  font-size: 1.25rem;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}

.rf-carousel__text { margin: 0 0 0.6em; font-size: 0.94rem; }

.rf-carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 52px;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) outset var(--rf-bevel-light);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.rf-carousel__arrow:hover { background: #fff; }
.rf-carousel__arrow--prev { left: 10px; }
.rf-carousel__arrow--next { right: 10px; }

.rf-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0 0.3rem;
}

.rf-carousel__dot {
  width: 16px;
  height: 16px;
  padding: 0;
  background: var(--rf-surface);
  border: 2px outset var(--rf-bevel-light);
  cursor: pointer;
}

.rf-carousel__dot.is-active {
  background: var(--rf-accent);
  border-style: inset;
}

/* ==========================================================================
   13. Services grid
   ========================================================================== */

.rf-services .rf-card { height: 100%; }

/* ==========================================================================
   14. FAQ accordion
   ========================================================================== */

.rf-faq { margin-bottom: calc(var(--rf-gap) * 1.5); }

.rf-faq__list {
  border: var(--rf-bevel) solid var(--rf-border);
  background: var(--rf-surface);
  box-shadow: var(--rf-shadow);
}

.rf-faq__item + .rf-faq__item { border-top: 2px solid var(--rf-border); }

.rf-faq__q {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--rf-bg-alt);
  font-family: var(--rf-font-head);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  border-bottom: 2px solid transparent;
}

.rf-faq__q::-webkit-details-marker { display: none; }
.rf-faq__q:hover { background: #e6e2da; }

.rf-faq__item[open] > .rf-faq__q {
  background: linear-gradient(90deg, var(--rf-primary) 0%, var(--rf-primary-alt) 100%);
  color: #fff;
  border-bottom: 2px solid var(--rf-border);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

.rf-faq__icon {
  display: inline-block;
  transition: transform 140ms ease;
  font-size: 0.85em;
  line-height: 1.6;
}

.rf-faq__item[open] .rf-faq__icon { transform: rotate(90deg); }
.rf-faq__qtext { flex: 1 1 auto; }

.rf-faq__a {
  padding: 1rem 1.2rem;
  background: var(--rf-surface);
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.rf-faq__a > :last-child { margin-bottom: 0; }

.rf-faq__footnote {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  text-align: center;
  color: var(--rf-ink-soft);
}

/* ==========================================================================
   15. Sidebar widgets
   ========================================================================== */

.rf-sidebar { display: flex; flex-direction: column; gap: var(--rf-gap); }

.rf-sidebar--sticky {
  position: sticky;
  top: calc(var(--rf-gap) + 3.2rem);
}

.rf-widget {
  background: var(--rf-surface);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow:
    inset -2px -2px 0 var(--rf-bevel-dark),
    inset 2px 2px 0 var(--rf-bevel-light),
    3px 3px 0 rgba(0, 0, 0, 0.3);
}

.rf-widget__title {
  margin: 0;
  padding: 4px 8px;
  background: linear-gradient(90deg, var(--rf-primary) 0%, var(--rf-primary-alt) 100%);
  border-bottom: var(--rf-bevel) solid var(--rf-border);
  color: #fff;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.rf-widget__body { padding: 0.85rem; font-size: 0.92rem; }
.rf-widget__body > :last-child { margin-bottom: 0; }

.rf-widget__list { list-style: none; margin: 0; padding: 0; }
.rf-widget__list li {
  padding: 0.4rem 0;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.25);
}
.rf-widget__list li:last-child { border-bottom: 0; }

.rf-widget__list--bullets li::before {
  content: "▸ ";
  color: var(--rf-accent);
  font-weight: 700;
}

.rf-widget__date {
  display: block;
  font-size: 0.78rem;
  color: var(--rf-ink-soft);
}

.rf-author { text-align: center; }
.rf-author__avatar {
  margin: 0 auto 0.6rem;
  border: var(--rf-bevel) solid var(--rf-border);
  background: var(--rf-bg-alt);
  padding: 2px;
  border-radius: var(--rf-radius);
}
.rf-author__name { font-weight: 700; margin: 0 0 0.35rem; }
.rf-author__bio { font-size: 0.88rem; color: var(--rf-ink-soft); }

/* ==========================================================================
   16. Meta strip, chips, badges & counter
   ========================================================================== */

.rf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  font-size: 0.82rem;
  color: var(--rf-ink-soft);
  margin-bottom: 0.6rem;
}

.rf-meta__item { display: inline-flex; align-items: center; gap: 0.35rem; }
.rf-meta__item a { color: var(--rf-link); }

/* In a card the meta strip holds one line. The min-height pads short strips up
   to match, otherwise a post with a "last updated" date carries one extra item
   and its card ends up taller than its neighbours.

   It may wrap on a narrow column rather than being clipped: "3 min re..."
   looks broken, a second line doesn't. */
.rf-meta--list {
  flex-wrap: wrap;
  align-items: center;
  min-height: 1.8em;
  margin-bottom: 0.45em;
}

/* Grid tiles are too narrow for the whole strip, so they show the date only.
   Hiding items outright keeps every tile the same height. */
.rf-cards--2 .rf-meta--list .rf-meta__item:not(.rf-meta__item--date),
.rf-cards--3 .rf-meta--list .rf-meta__item:not(.rf-meta__item--date),
.rf-cards--4 .rf-meta--list .rf-meta__item:not(.rf-meta__item--date) {
  display: none;
}

/* The single-post strip can wrap freely; there is room for it there. */
.rf-article__intro .rf-meta { margin-bottom: 0.4rem; }

.rf-chip {
  display: inline-block;
  padding: 0.1em 0.55em;
  background: var(--rf-bg-alt);
  border: 2px outset var(--rf-bevel-light);
  color: #000;
  font-size: 0.78rem;
  text-decoration: none;
  white-space: nowrap;
}
.rf-chip:visited { color: #000; }
.rf-chip:hover,
.rf-chip:focus { background: var(--rf-accent-2); color: #000; }

.rf-count-badge {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.05em 0.4em;
  background: var(--rf-primary);
  border: 2px solid var(--rf-border);
  color: #fff;
  font-family: var(--rf-font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

/* ---- Tag cloud ---- */

.rf-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  margin: 0;
}

.rf-cloud__tag {
  display: inline-block;
  padding: 0.1em 0.5em;
  background: var(--rf-surface-alt);
  border: 2px solid var(--rf-border);
  color: var(--rf-link);
  text-decoration: none;
  line-height: 1.4;
}
.rf-cloud__tag:hover,
.rf-cloud__tag:focus { background: var(--rf-accent-2); color: #000; }

.rf-cloud__t1 { font-size: 0.85rem; }
.rf-cloud__t2 { font-size: 0.95rem; }
.rf-cloud__t3 { font-size: 1.08rem; }
.rf-cloud__t4 { font-size: 1.22rem; }
.rf-cloud__t5 { font-size: 1.38rem; font-weight: 700; background: #fff6d8; }

.rf-cloud--lg .rf-cloud__t1 { font-size: 0.95rem; }
.rf-cloud--lg .rf-cloud__t5 { font-size: 1.7rem; }
.rf-cloud__count {
  font-family: var(--rf-font-mono);
  font-size: 0.7em;
  color: var(--rf-ink-soft);
}

/* ---- 88x31 badges ---- */

.rf-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 0.8rem;
}
.rf-badges img { border: 1px solid rgba(0, 0, 0, 0.5); }

/* ---- Visitor counter ---- */

.rf-counter-label { margin: 0 0 0.35rem; font-size: 0.85rem; text-align: center; }

.rf-counter {
  margin: 0 0 0.5rem;
  padding: 6px 8px;
  background: #000;
  border: var(--rf-bevel) inset var(--rf-bevel-light);
  text-align: center;
}

.rf-counter__digits {
  font-family: var(--rf-font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: #39ff14;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.85);
}

.rf-counter-note {
  margin: 0;
  font-size: 0.78rem;
  text-align: center;
  color: var(--rf-ink-soft);
}

.rf-blink { animation: rf-blink 1.1s steps(1, end) infinite; color: #ff2d2d; }

@keyframes rf-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---- Retro table ---- */

.rf-table-wrap { overflow-x: auto; }

.rf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--rf-surface);
}

.rf-table th,
.rf-table td {
  border: 2px solid var(--rf-border);
  padding: 0.45em 0.7em;
  text-align: left;
}

.rf-table thead th {
  background: linear-gradient(180deg, var(--rf-primary) 0%, var(--rf-primary-alt) 100%);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

.rf-table tbody tr:nth-child(even) { background: var(--rf-surface-alt); }
.rf-table tbody tr:hover { background: #fff6d8; }
.rf-table__num { text-align: right; white-space: nowrap; }

/* ==========================================================================
   17. Article, prose & TOC
   ========================================================================== */

.rf-article { margin-bottom: var(--rf-gap); }

.rf-article__bar { position: relative; }

.rf-article__lede {
  font-size: 1.08rem;
  font-style: italic;
  color: var(--rf-ink-soft);
  border-left: 6px solid var(--rf-accent-2);
  padding-left: 0.8rem;
  margin: 0.6rem 0 1.2rem;
}

.rf-article__content { margin-top: 1rem; }

.rf-prose { font-size: 1.02rem; }

.rf-prose > :first-child { margin-top: 0; }

.rf-prose h2 {
  margin-top: 2rem;
  padding-bottom: 0.25rem;
  border-bottom: 3px double var(--rf-border);
}

.rf-prose h3 { margin-top: 1.6rem; }
.rf-prose h2 + h3 { margin-top: 0.8rem; }

.rf-prose ul,
.rf-prose ol { padding-left: 1.4rem; margin: 0 0 1.1em; }
.rf-prose li { margin-bottom: 0.35em; }
.rf-prose ul li::marker { color: var(--rf-accent); }

.rf-prose img {
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: var(--rf-shadow);
  margin: 1.2rem auto;
  background: var(--rf-bg-alt);
  padding: 3px;
}

.rf-prose figure { margin: 1.5rem 0; }
.rf-prose figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--rf-ink-soft);
  font-style: italic;
}

.rf-prose pre {
  background: #10142a;
  color: #e8e8ff;
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: var(--rf-shadow);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
}

.rf-prose pre code { color: inherit; background: none; padding: 0; }

.rf-prose :not(pre) > code {
  background: #f0f0e4;
  border: 1px solid #c9c9b4;
  padding: 0.08em 0.35em;
  color: #7a2f00;
}

.rf-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
}
.rf-prose table th,
.rf-prose table td { border: 2px solid var(--rf-border); padding: 0.4em 0.65em; }
.rf-prose table thead th { background: var(--rf-bg-alt); }

.rf-prose .rf-btn { text-decoration: none; color: #000; }
.rf-prose .rf-btn--primary { color: #fff; }

/* ---- TOC ---- */

.rf-toc { margin: 1.2rem 0; }
.rf-toc__bar { cursor: pointer; }
.rf-toc__body { padding: 0.8rem 1rem; background: var(--rf-surface-alt); }

.rf-toc__body nav { margin: 0; }

.rf-toc__body ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.rf-toc__body ul ul { padding-left: 1.1rem; }
.rf-toc__body li { margin: 0.2rem 0; }

.rf-toc__body a {
  text-decoration: none;
  font-size: 0.92rem;
  display: inline-block;
  padding: 0.1em 0;
}
.rf-toc__body a:hover { text-decoration: underline; }

.rf-toc__body > nav > ul > li > a::before {
  content: "▸ ";
  color: var(--rf-accent);
  font-weight: 700;
}

/* ---- Author box ---- */

.rf-author-box { margin-bottom: var(--rf-gap); }
.rf-author-box .rf-author { display: flex; gap: 1rem; text-align: left; align-items: flex-start; }
.rf-author-box .rf-author__avatar { margin: 0; flex: 0 0 auto; }

/* ==========================================================================
   18. Share, prev/next & related
   ========================================================================== */

/* The "Tagged:" row. Previously unstyled, which left chips squeezed together
   with no even spacing and nothing separating them from the article body. */
.rf-article__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 3px double var(--rf-border);
}

.rf-article__tags-label {
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 0.15rem;
}

/* Tags already drew the divider, so don't stack a second one on top of it. */
.rf-article__tags + .rf-share {
  margin-top: 0.9rem;
  padding-top: 0;
  border-top: 0;
}

.rf-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 3px double var(--rf-border);
}

.rf-share__label {
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 0.9rem;
}

.rf-share__btn { text-decoration: none; }

.rf-prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--rf-gap);
  margin-bottom: var(--rf-gap);
}

.rf-prevnext__item {
  display: block;
  padding: 0.8rem 1rem;
  background: var(--rf-surface);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
  text-decoration: none;
  min-width: 0;
}

.rf-prevnext__item:hover { background: #fffbe8; }
.rf-prevnext__item.is-empty { visibility: hidden; }
.rf-prevnext__item--next { text-align: right; }

.rf-prevnext__label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rf-ink-soft);
}

.rf-prevnext__title {
  display: block;
  font-family: var(--rf-font-head);
  font-weight: 700;
  color: var(--rf-primary);
}

.rf-related { margin-top: calc(var(--rf-gap) * 1.4); }

/* ==========================================================================
   19. Pagination
   ========================================================================== */

.rf-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: var(--rf-gap) 0;
  padding: 0.6rem;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.rf-pagination__pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rf-pagination__num {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  background: var(--rf-surface);
  border: 2px outset var(--rf-bevel-light);
  color: var(--rf-link);
  font-family: var(--rf-font-mono);
  font-weight: 700;
  text-decoration: none;
}

.rf-pagination__num:hover { background: var(--rf-accent-2); color: #000; }

.rf-pagination__num.is-current {
  background: var(--rf-primary);
  border-style: inset;
  color: #fff;
}

.rf-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   20. Footer & webring
   ========================================================================== */

.rf-footer {
  margin-top: calc(var(--rf-gap) * 2);
  background: #2b2b3d;
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow:
    inset -2px -2px 0 rgba(0, 0, 0, 0.5),
    inset 2px 2px 0 rgba(255, 255, 255, 0.18);
  color: #d8d8ea;
}

.rf-footer__inner { padding: calc(var(--rf-gap) * 1.2); }

.rf-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(2, 1fr) 1.4fr;
  gap: calc(var(--rf-gap) * 1.2);
}

.rf-footer__col { min-width: 0; }

.rf-footer__heading {
  margin: 0 0 0.7rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--rf-primary-alt);
  color: #fff;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}

.rf-footer__logo { margin: 0 0 0.8rem; }
.rf-footer__logo img { max-height: 60px; width: auto; }
.rf-footer__logo .rf-logo__text { font-size: 1.4rem; }

.rf-footer__about { font-size: 0.9rem; }
.rf-footer__tagline { font-size: 0.85rem; font-style: italic; color: #a9a9c8; }

.rf-footer__links { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.rf-footer__links li { margin-bottom: 0.35rem; }

.rf-footer a { color: #a8d8ff; }
.rf-footer a:visited { color: #c9b3ff; }
.rf-footer a:hover,
.rf-footer a:focus { color: var(--rf-accent-2); }

/* Footer buttons keep the button palette. "Back to Top" is a
   <a class="rf-btn">, so the link colours above were winning and painting it
   light blue on light grey. */
.rf-footer .rf-btn,
.rf-footer .rf-btn:visited,
.rf-footer .rf-btn:hover,
.rf-footer .rf-btn:focus,
.rf-footer .rf-btn:focus-visible { color: #000; }

.rf-footer .rf-btn--primary,
.rf-footer .rf-btn--primary:visited,
.rf-footer .rf-btn--primary:hover,
.rf-footer .rf-btn--primary:focus,
.rf-footer .rf-btn--primary:focus-visible,
.rf-footer .rf-btn--accent,
.rf-footer .rf-btn--accent:visited,
.rf-footer .rf-btn--accent:hover,
.rf-footer .rf-btn--accent:focus,
.rf-footer .rf-btn--accent:focus-visible { color: #fff; }

.rf-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
}

.rf-social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--rf-bg-alt);
  border: 2px outset var(--rf-bevel-light);
  color: #000;
  font-size: 1rem;
  text-decoration: none;
}

/* Scoped under .rf-footer: the generic `.rf-footer a:hover` is more specific
   than a bare `.rf-social a` and was winning, turning the icon the same yellow
   as the hover background. :visited had the same problem. */
.rf-footer .rf-social a,
.rf-footer .rf-social a:visited { color: #000; }

.rf-footer .rf-social a:hover,
.rf-footer .rf-social a:focus,
.rf-footer .rf-social a:focus-visible {
  background: var(--rf-accent-2);
  color: #000;
}

.rf-footer__totop { margin: 0; }

.rf-footer__bottom {
  margin-top: calc(var(--rf-gap) * 1.2);
  padding-top: 0.9rem;
  border-top: 3px double rgba(255, 255, 255, 0.25);
  font-size: 0.82rem;
  text-align: center;
  color: #a9a9c8;
}

.rf-footer__bottom p { margin: 0 0 0.3rem; }

/* ---- Webring ---- */

.rf-webring {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: var(--rf-gap) auto 0;
  padding: 0.5rem 0.9rem;
  max-width: 620px;
  background: #000;
  border: 2px inset var(--rf-bevel-light);
  font-family: var(--rf-font-mono);
  font-size: 0.82rem;
  color: #39ff14;
  text-align: center;
}

.rf-webring__title { font-weight: 700; letter-spacing: 0.06em; }
.rf-webring__links { display: flex; flex-wrap: wrap; gap: 0.7rem; justify-content: center; }
.rf-webring a { color: #39ff14; }
.rf-webring a:hover { color: #fff; }

/* ==========================================================================
   21. Back-to-top
   ========================================================================== */

.rf-totop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  padding: 0.5em 0.85em;
  background: var(--rf-bg-alt);
  border: var(--rf-bevel) outset var(--rf-bevel-light);
  box-shadow: var(--rf-shadow);
  font-family: var(--rf-font-head);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--rf-ink);
  cursor: pointer;
}

.rf-totop:hover,
.rf-totop:focus,
.rf-totop:focus-visible {
  background: var(--rf-accent-2);
  color: #000;
}
.rf-totop[hidden] { display: none; }

/* ==========================================================================
   22. Utilities
   ========================================================================== */

/* Skip link. Sits above the viewport and slides down on focus, so Tab reaches
   it but it never appears during mouse use or when a script moves focus.
   position:fixed keeps it pinned regardless of scroll position. */
.rf-skip-link {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 500;
  padding: 0.75em 1.4em;
  background: var(--rf-primary);
  border: 3px solid var(--rf-border);
  border-top: 0;
  color: #fff;
  font-family: var(--rf-font-head);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transform: translate(-50%, -130%);
  transition: transform 120ms ease;
}

.rf-skip-link:focus,
.rf-skip-link:focus-visible {
  color: #fff;
  transform: translate(-50%, 0);
  outline: 3px solid var(--rf-accent-2);
  outline-offset: 0;
}

/* <main> is focused programmatically by the back-to-top button; a focus ring
   around the entire page body would be noise, not information. */
#main:focus { outline: none; }

/* ---- Inline SVG icons (partials/svg-icon.html) -------------------------- */

.rf-icon {
  width: 1em;
  height: 1em;
  fill: currentColor;
  display: inline-block;
  vertical-align: -0.14em;   /* optically centred against adjacent text */
  flex: 0 0 auto;
}

.rf-social a .rf-icon { width: 18px; height: 18px; }

.rf-footer__links .rf-icon {
  width: 1.05em;
  height: 1.05em;
  opacity: 0.8;
}

.rf-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rf-archive-head { margin-bottom: var(--rf-gap); }
.rf-archive-head__desc { font-size: 1.02rem; }
.rf-archive-head__count { font-size: 0.9rem; color: var(--rf-ink-soft); margin: 0; }

.rf-cta {
  margin: calc(var(--rf-gap) * 1.5) 0;
  padding: calc(var(--rf-gap) * 1.5);
  text-align: center;
  background: linear-gradient(135deg, var(--rf-primary) 0%, var(--rf-primary-alt) 100%);
  border: var(--rf-bevel) solid var(--rf-border);
  box-shadow:
    inset -2px -2px 0 rgba(0, 0, 0, 0.4),
    inset 2px 2px 0 rgba(255, 255, 255, 0.3),
    var(--rf-shadow);
}

.rf-cta__title { color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); }
.rf-cta__text { color: #e8f6ff; }
.rf-cta p:last-child { margin-bottom: 0; }

/* ==========================================================================
   23. Responsive
   ========================================================================== */

@media (max-width: 980px) {
  /* A post already ends with its "Written by" box, so once the sidebar
     stacks underneath, the author widget is the same thing twice. */
  .kind-page .rf-widget--author { display: none; }
  .rf-layout--with-sidebar {
    grid-template-columns: minmax(0, 1fr);
  }

  .rf-sidebar--sticky { position: static; }

  .rf-footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rf-cards--3,
  .rf-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .rf-hero--split .rf-hero__inner { grid-template-columns: minmax(0, 1fr); }

  .rf-layout { display: block; }
  .rf-layout > * + * { margin-top: var(--rf-gap); }
}

@media (max-width: 720px) {
  :root { --rf-gap: 14px; }

  .rf-nav__toggle { display: flex; }

  .rf-nav__drawer {
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.4rem;
  }

  .rf-nav__drawer.is-open { display: flex; }

  .rf-nav__menu {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .rf-nav__item {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .rf-nav__link {
    flex: 1 1 auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.18);
  }

  .rf-nav__sub-toggle { display: block; }

  /* On mobile the dropdown becomes an inline disclosure, not a floating panel */
  .rf-nav__menu .rf-nav__menu {
    position: static;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    width: 100%;
    min-width: 0;
    box-shadow: none;
    border: 0;
    border-left: 4px solid var(--rf-primary);
    background: rgba(0, 0, 0, 0.04);
    padding-left: 0.5rem;
  }

  .rf-nav__item.is-open > .rf-nav__menu { display: block; }

  .rf-nav__menu .rf-nav__menu .rf-nav__menu { left: auto; top: auto; }

  .rf-nav__menu .rf-nav__item--has-children > .rf-nav__link::after { content: ""; }

  .rf-nav__search { margin: 0.5rem 0; width: 100%; }
  .rf-nav__search input { flex: 1 1 auto; }
  .rf-nav__cta { margin: 0.5rem 0; }

  .rf-cards--2,
  .rf-cards--3,
  .rf-cards--4 { grid-template-columns: minmax(0, 1fr); }

  .rf-card__body { flex-direction: column; }
  .rf-card__thumb { flex: 1 1 auto; width: 100%; }

  .rf-prevnext { grid-template-columns: minmax(0, 1fr); }
  .rf-prevnext__item.is-empty { display: none; }
  .rf-prevnext__item--next { text-align: left; }

  .rf-footer__grid { grid-template-columns: minmax(0, 1fr); }
  .rf-footer__bottom { text-align: left; }

  .rf-pagination { justify-content: center; }
  .rf-pagination__prev,
  .rf-pagination__next { flex: 1 1 auto; }

  .rf-carousel__caption { padding: 0.8rem; }
  .rf-carousel__title { font-size: 1rem; }
  .rf-carousel__text { display: none; }
  .rf-carousel__arrow { width: 32px; height: 40px; }

  .rf-section__title::before,
  .rf-section__title::after { content: ""; margin: 0; }

  .rf-author-box .rf-author { flex-direction: column; align-items: center; text-align: center; }
}

@media (max-width: 400px) {
  .rf-shell { padding: 8px; }
  .rf-window__body { padding: 0.8rem; }
  .rf-hero { padding: 1.2rem 0.9rem; }
}

/* ==========================================================================
   24. Motion preferences, forced colors & print
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .rf-marquee__track { animation: none; white-space: normal; }
  .rf-marquee__text { padding-right: 0; }
  .rf-marquee__text + .rf-marquee__text { display: none; }
  .rf-blink { animation: none; opacity: 1; }
  .rf-logo__text--rainbow { animation: none; }
}

@media (forced-colors: active) {
  .rf-window,
  .rf-card,
  .rf-btn,
  .rf-widget { border: 2px solid CanvasText; }
  .rf-window__bar { background: Highlight; color: HighlightText; }
  .rf-logo__text--rainbow,
  .rf-logo__text--chrome {
    -webkit-text-fill-color: CanvasText;
    color: CanvasText;
  }
}

@media print {
  html[data-tile] body { background: #fff !important; }
  .rf-nav,
  .rf-sidebar,
  .rf-totop,
  .rf-share,
  .rf-carousel,
  .rf-footer__col--badges,
  .rf-marquee,
  .rf-webring { display: none !important; }
  .rf-window,
  .rf-card { box-shadow: none; border: 1px solid #000; }
  .rf-article a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
