/* ==========================================================================
   Reuzelekker navigation — desktop bar + mobile drawer
   Scoped under .rl-* so it never collides with the legacy theme CSS.
   ========================================================================== */

.rl-header {
  --rl-coral: #ff847c;
  --rl-coral-deep: #e8635a;
  --rl-ink: #2b2118;
  --rl-muted: #8a7a70;
  --rl-surface: #fffaf7;
  --rl-line: #f0e4dd;

  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--rl-surface);
  border-bottom: 1px solid var(--rl-line);
  font-family: "Roboto Condensed", system-ui, sans-serif;
  transition: box-shadow 0.2s ease;
}

.rl-header.is-stuck {
  box-shadow: 0 1px 16px rgba(43, 33, 24, 0.07);
}

body.dark .rl-header {
  --rl-ink: #f6efe9;
  --rl-muted: #a89a91;
  --rl-surface: #1b1613;
  --rl-line: #2f2620;
}

.rl-skip {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -120%);
  padding: 10px 18px;
  background: var(--rl-ink);
  color: var(--rl-surface);
  border-radius: 0 0 6px 6px;
  transition: transform 0.15s ease;
  z-index: 10;
}

.rl-skip:focus {
  transform: translate(-50%, 0);
  color: var(--rl-surface);
}

.rl-header__inner {
  /* Width and side gutters come from .container, so the menu lines up with
     the page content. */
  height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.rl-logo {
  display: flex;
  align-items: center;
  flex: none;
}

.rl-logo svg {
  width: 148px;
  height: auto;
  display: block;
}

/* --------------------------------------------------------- desktop nav --- */

.rl-nav {
  flex: 1;
  display: none;
}

.rl-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rl-nav__item--mega {
  position: static;
}

.rl-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  background: none;
  border-radius: 6px;
  color: var(--rl-ink);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.rl-nav__link:hover,
.rl-nav__link:focus-visible {
  background: rgba(255, 132, 124, 0.12);
  color: var(--rl-coral-deep);
}

/* The current page is marked by weight and a coral underline, not a pill. */
.rl-nav__link.is-current {
  position: relative;
  font-weight: 700;
  color: var(--rl-coral-deep);
}

.rl-nav__link.is-current::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 3px;
  height: 2px;
  background: var(--rl-coral);
  border-radius: 2px;
}

.rl-nav__caret {
  transition: transform 0.18s ease;
}

.rl-nav__link[aria-expanded="true"] .rl-nav__caret {
  transform: rotate(180deg);
}

/* ---------------------------------------------------------- mega menu --- */

.rl-mega {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  /* Above page content, which the legacy theme paints with its own stacking. */
  z-index: 1001;
  background: var(--rl-surface);
  border-top: 1px solid var(--rl-line);
  border-bottom: 1px solid var(--rl-line);
  box-shadow: 0 18px 40px -22px rgba(43, 33, 24, 0.4);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.rl-mega.is-open {
  opacity: 1;
  transform: translateY(0);
}

.rl-mega__inner {
  padding-top: 28px;
  padding-bottom: 24px;
}

.rl-mega__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 2px 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.rl-mega__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--rl-ink);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.rl-mega__link:hover,
.rl-mega__link:focus-visible {
  background: rgba(255, 132, 124, 0.12);
  color: var(--rl-coral-deep);
}

.rl-mega__name {
  font-size: 16px;
  font-weight: 500;
}

/* The count is information: how much is actually behind this link. */
.rl-mega__count {
  flex: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--rl-muted);
}

.rl-mega__all {
  display: inline-block;
  padding-top: 16px;
  border-top: 1px solid var(--rl-line);
  width: 100%;
  color: var(--rl-coral-deep);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

.rl-mega__all:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------- tools --- */

.rl-header__tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rl-theme,
.rl-search__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rl-line);
  border-radius: 50%;
  background: none;
  color: var(--rl-ink);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.rl-theme:hover,
.rl-search__toggle:hover {
  border-color: var(--rl-coral);
  color: var(--rl-coral-deep);
}

.rl-theme__moon {
  display: none;
}

body.dark .rl-theme__sun {
  display: none;
}

body.dark .rl-theme__moon {
  display: block;
}

/* ------------------------------------------------------------- burger --- */

.rl-burger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 12px;
  border: 1px solid var(--rl-line);
  border-radius: 999px;
  background: none;
  color: var(--rl-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.rl-burger__box {
  position: relative;
  display: block;
  width: 18px;
  height: 12px;
}

.rl-burger__bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.24s ease;
}

.rl-burger__bar:nth-child(1) {
  top: 1px;
}

.rl-burger__bar:nth-child(2) {
  bottom: 1px;
}

/* Two bars fold into a cross — the motion answers the tap. */
.rl-burger[aria-expanded="true"] .rl-burger__bar:nth-child(1) {
  transform: translateY(4px) rotate(45deg);
}

.rl-burger[aria-expanded="true"] .rl-burger__bar:nth-child(2) {
  transform: translateY(-5px) rotate(-45deg);
}

/* ------------------------------------------------------ mobile drawer --- */

.rl-drawer {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.rl-drawer__scrim {
  position: absolute;
  inset: 0;
  background: rgba(43, 33, 24, 0.45);
  opacity: 0;
  transition: opacity 0.26s ease;
}

.rl-drawer.is-open .rl-drawer__scrim {
  opacity: 1;
}

.rl-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 380px);
  display: flex;
  flex-direction: column;
  background: var(--rl-surface);
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.3, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rl-drawer.is-open .rl-drawer__panel {
  transform: translateX(0);
}

.rl-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.rl-drawer__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rl-muted);
}

.rl-drawer__close {
  display: inline-flex;
  padding: 8px;
  margin: -8px;
  border: 0;
  background: none;
  color: var(--rl-ink);
  cursor: pointer;
}

.rl-drawer__nav {
  padding: 4px 12px 20px;
}

.rl-drawer__link,
.rl-acc__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 12px;
  border: 0;
  border-bottom: 1px solid var(--rl-line);
  background: none;
  color: var(--rl-ink);
  font-family: inherit;
  font-size: 20px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.rl-drawer__link.is-current {
  color: var(--rl-coral-deep);
  font-weight: 700;
}

.rl-acc__caret {
  flex: none;
  color: var(--rl-muted);
  transition: transform 0.2s ease;
}

.rl-acc__trigger.is-open .rl-acc__caret {
  transform: rotate(180deg);
}

.rl-acc__panel {
  margin: 0;
  padding: 6px 0 10px;
  list-style: none;
}

.rl-acc__panel a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 11px 24px;
  color: var(--rl-muted);
  font-size: 17px;
  text-decoration: none;
}

.rl-acc__panel a:hover,
.rl-acc__panel a:focus-visible {
  color: var(--rl-coral-deep);
}

.rl-acc__count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

body.rl-locked {
  overflow: hidden;
}

/* --------------------------------------------------------- breakpoint --- */

@media (min-width: 992px) {
  .rl-nav {
    display: block;
  }

  .rl-burger {
    display: none;
  }

  .rl-header__inner {
    height: 76px;
  }
}

/* -------------------------------------------------------------- search --- */

/* Mobile first: an icon that opens the field as a bar under the header. */
.rl-search__panel {
  display: none;
}

.rl-search.is-open .rl-search__panel {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 12px 12px 16px;
  background: var(--rl-surface);
  border-bottom: 1px solid var(--rl-line);
  box-shadow: 0 12px 24px -16px rgba(43, 33, 24, 0.35);
}

.rl-search.is-open .rl-search__panel > * {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.rl-search__field {
  position: relative;
  display: flex;
  align-items: center;
}

.rl-search__icon {
  position: absolute;
  left: 14px;
  color: var(--rl-muted);
  pointer-events: none;
}

.rl-search__input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--rl-line);
  border-radius: 999px;
  background: #fff;
  color: var(--rl-ink);
  font-family: inherit;
  /* 16px stops iOS from zooming in on focus. */
  font-size: 16px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    width 0.2s ease;
}

.rl-search__input::-webkit-search-cancel-button {
  display: none;
}

.rl-search__input::placeholder {
  color: var(--rl-muted);
}

.rl-search__input:focus {
  border-color: var(--rl-coral);
  box-shadow: 0 0 0 3px rgba(255, 132, 124, 0.2);
  outline: none;
}

body.dark .rl-search__input {
  background: #241d19;
}

.rl-search__close {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--rl-muted);
  cursor: pointer;
}

.rl-search__close:hover {
  color: var(--rl-coral-deep);
}

.rl-search__results {
  margin: 8px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--rl-surface);
  border: 1px solid var(--rl-line);
  border-radius: 14px;
  box-shadow: 0 18px 40px -20px rgba(43, 33, 24, 0.45);
  max-height: min(70vh, 460px);
  overflow-y: auto;
}

.rl-search__option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  color: var(--rl-ink);
  text-decoration: none;
}

[aria-selected="true"] > .rl-search__option,
.rl-search__option:hover {
  background: rgba(255, 132, 124, 0.12);
  color: var(--rl-ink);
}

.rl-search__thumb {
  flex: none;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--rl-line);
}

.rl-search__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rl-search__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rl-search__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rl-search__title mark {
  padding: 0;
  background: none;
  color: var(--rl-coral-deep);
}

.rl-search__meta {
  margin-top: 2px;
  font-size: 13px;
  color: var(--rl-muted);
}

.rl-search__empty {
  padding: 14px 10px;
  font-size: 14px;
  color: var(--rl-muted);
}

/* Desktop: the field sits in the header itself and widens while in use. */
@media (min-width: 992px) {
  .rl-search {
    position: relative;
  }

  .rl-search__toggle,
  .rl-search__close {
    display: none;
  }

  .rl-search__panel,
  .rl-search.is-open .rl-search__panel {
    display: block;
    position: static;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .rl-search__input {
    width: 220px;
    height: 40px;
    padding-right: 14px;
    font-size: 14px;
  }

  .rl-search__input:focus,
  .rl-search__input:not(:placeholder-shown) {
    width: 300px;
  }

  .rl-search__results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 380px;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rl-search__input {
    transition: none;
  }
}

/* Small phones: logo, search, theme and menu must fit in one row. */
@media (max-width: 419.98px) {
  .rl-header__inner {
    gap: 12px;
  }

  .rl-logo svg {
    width: 128px;
  }
}

/* Narrowest phones: the burger keeps its icon, the word is for screen readers only. */
@media (max-width: 359.98px) {
  .rl-burger {
    padding: 8px 12px;
  }

  .rl-burger__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ----------------------------------------------------------- a11y ------- */

.rl-header :focus-visible,
.rl-drawer :focus-visible {
  outline: 2px solid var(--rl-coral-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .rl-header,
  .rl-mega,
  .rl-drawer__scrim,
  .rl-drawer__panel,
  .rl-burger__bar,
  .rl-nav__caret,
  .rl-acc__caret,
  .rl-skip {
    transition-duration: 0.01ms;
  }
}
