/* Shared site navigation — index + inner pages */

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #f8faf5;
  border-bottom: 1px solid rgba(0, 165, 168, 0.14);
  box-shadow: 0 2px 12px rgba(42, 58, 32, 0.05);
  contain: layout style;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.site-header__inner {
  max-width: var(--onx-max-width);
  margin: 0 auto;
  padding: 6px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-logo {
  font-family: var(--onx-font-serif);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  margin-top: -2px;
  align-self: flex-start;
  padding-top: 2px;
}

.site-logo__word {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}

.site-logo__one {
  color: #1e3224;
}

.site-logo__irox {
  background: linear-gradient(108deg, #2d6a6a 0%, #00a5a8 48%, #1a5c5e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-logo__heart {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: block;
  color: #00a5a8;
  transform-origin: center center;
  animation: onx-logo-heart-pulse 1s linear infinite;
  margin-top: -1px;
}

html.is-scrolling .site-logo__heart {
  animation-play-state: paused;
}

@keyframes onx-logo-heart-pulse {
  0%,
  30%,
  100% {
    transform: scale(1);
  }

  5% {
    transform: scale(1.22);
  }
  8% {
    transform: scale(1.06);
  }
  11% {
    transform: scale(1.14);
  }

  17% {
    transform: scale(1.16);
  }
  21% {
    transform: scale(1.03);
  }
  25% {
    transform: scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-logo__heart {
    animation: none;
  }
}

.site-logo:hover .site-logo__one {
  color: #2d6a6a;
}

.site-logo:hover .site-logo__irox {
  filter: brightness(1.1);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #3d5234;
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: #00a5a8;
  border-bottom-color: rgba(0, 165, 168, 0.45);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: 50px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: var(--onx-font-sans);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  flex-shrink: 0;
}

.btn--primary {
  background: linear-gradient(145deg, #3a5240 0%, #2a3a28 100%);
  color: #f5faf0;
  border: 1.5px solid rgba(58, 82, 56, 0.5);
  box-shadow: 0 6px 20px rgba(42, 58, 32, 0.22);
}

.btn--primary:hover {
  background: linear-gradient(145deg, #00a5a8 0%, #2d6a6a 100%);
  border-color: rgba(0, 165, 168, 0.4);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 165, 168, 0.28);
}

.site-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* Journal — always in header (localStorage journal lives in decode-actions.js) */
.onx-journal-nav {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid rgba(58, 68, 53, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #1e3224;
  font-family: var(--onx-font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.onx-journal-nav:hover {
  background: #eef3ea;
  border-color: rgba(0, 165, 168, 0.4);
  color: #1e3224;
}

.onx-journal-nav__badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c45a3a;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

@media (max-width: 900px) {
  .site-nav { display: none; }
}

@media (max-width: 720px) {
  .site-header .btn--primary { display: none; }
  .site-header__inner { padding: 12px 18px; }
  .site-logo__heart { width: 21px; height: 21px; }
  .site-logo__word { font-size: 19px; }
  .site-header__actions { gap: 10px; }
}

/* ── Back to top (sync — must work on homepage where main.css is deferred) ── */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 300;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #00a5a8 0%, #2d6a6a 100%);
  box-shadow:
    0 6px 24px rgba(0, 165, 168, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.92);
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.28s ease,
    box-shadow 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  box-shadow:
    0 10px 32px rgba(0, 165, 168, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.28) inset;
}

.back-to-top:focus-visible {
  outline: 2px solid #00a5a8;
  outline-offset: 3px;
}

.back-to-top__icon {
  display: block;
  margin-top: 2px;
}

.back-to-top__label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  opacity: 0.9;
}

@media (max-width: 720px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 46px;
    height: 46px;
  }

  .back-to-top__label {
    display: none;
  }

  .back-to-top__icon {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.15s ease, visibility 0.15s ease;
    transform: none;
  }

  .back-to-top.is-visible {
    transform: none;
  }
}