/* Journal physical-interaction layer.
   These rules only refine response states. Approved journal assets, page
   geometry, typography, content, and navigation behavior remain unchanged. */
:root {
  --journal-motion-fast: 150ms;
  --journal-motion-medium: 240ms;
  --journal-motion-ease: cubic-bezier(.2, .72, .2, 1);
  --journal-focus-green: rgba(7, 95, 58, .92);
  --journal-focus-copper: rgba(202, 137, 91, .94);
}

/* Journal library: heavy bound books lift as a single object, then settle
   against the table when pressed. */
.journal-library-choice {
  transform-origin: center 58%;
  transition: transform var(--journal-motion-medium) var(--journal-motion-ease),
    filter var(--journal-motion-medium) ease,
    opacity .36s ease;
}
.journal-library-choice:hover,
.journal-library-choice:focus-visible {
  transform: translateY(-3px) scale(1.006);
  filter: brightness(1.075) saturate(1.025);
}
.journal-library-choice:hover::before,
.journal-library-choice:focus-visible::before {
  opacity: .9;
  transform: scale(1.025);
}
.journal-library-choice:active {
  transform: translateY(1px) scale(.997);
  filter: brightness(.96) saturate(.98);
}
.journal-library-choice:focus-visible {
  outline: 0;
}
.journal-library-choice:focus-visible .journal-library-choice-label strong {
  text-decoration: underline;
  text-decoration-color: var(--journal-focus-copper);
  text-decoration-thickness: 2px;
  text-underline-offset: .35rem;
}

/* Return tabs remain attached to the surrounding table or leather rail. */
.journal-library-page .route-topline a,
.journal-detail-page .route-topline a {
  display: inline-block;
  transform-origin: left center;
  transition: color var(--journal-motion-fast) ease,
    text-shadow var(--journal-motion-fast) ease,
    transform var(--journal-motion-fast) var(--journal-motion-ease);
}
.journal-library-page .route-topline a:hover,
.journal-library-page .route-topline a:focus-visible,
.journal-detail-page .route-topline a:hover,
.journal-detail-page .route-topline a:focus-visible {
  color: #a8e7ba;
  text-shadow: 0 2px 4px #000, 0 0 10px rgba(7, 95, 58, .32);
  transform: translateX(2px);
}
.journal-library-page .route-topline a:active,
.journal-detail-page .route-topline a:active {
  transform: translate(1px, 1px);
  filter: brightness(.9);
}

/* Field Journal contents: inked rows move like a finger tracing the page. */
.journal-index-entry {
  transform-origin: left center;
  transition: background-color var(--journal-motion-fast) ease,
    transform var(--journal-motion-fast) var(--journal-motion-ease),
    box-shadow var(--journal-motion-fast) ease;
}
.journal-index-entry:hover,
.journal-index-entry:focus-visible {
  background: linear-gradient(90deg, rgba(7, 95, 58, .09), transparent 82%);
  transform: translateX(2px);
  box-shadow: inset 2px 0 0 rgba(7, 95, 58, .34);
}
.journal-index-entry:active {
  transform: translate(1px, 1px);
  background: linear-gradient(90deg, rgba(67, 43, 23, .12), transparent 82%);
  box-shadow: inset 2px 0 0 rgba(55, 34, 17, .42);
}
.journal-index-edge-turn {
  transform-origin: right center;
  transition: color var(--journal-motion-fast) ease,
    border-color var(--journal-motion-fast) ease,
    transform var(--journal-motion-fast) var(--journal-motion-ease),
    text-shadow var(--journal-motion-fast) ease;
}
.journal-index-edge-turn:hover,
.journal-index-edge-turn:focus-visible {
  transform: translateY(-1px) rotate(-.2deg);
  text-shadow: 0 1px 0 rgba(255, 236, 193, .28);
}
.journal-index-edge-turn:active {
  transform: translateY(1px);
  filter: brightness(.9);
}

/* Spread turns sit on the leather edge; they press firmly without changing
   the page or control dimensions. */
.journal-spread-controls button,
.journal-mobile-pager button {
  transform-origin: center;
  transition: transform var(--journal-motion-fast) var(--journal-motion-ease),
    color var(--journal-motion-fast) ease,
    background-color var(--journal-motion-fast) ease,
    border-color var(--journal-motion-fast) ease,
    box-shadow var(--journal-motion-fast) ease,
    filter var(--journal-motion-fast) ease;
}
.journal-spread-controls button:not(:disabled):hover,
.journal-spread-controls button:not(:disabled):focus-visible {
  color: #f0bd76;
  transform: translateY(-1px);
  text-shadow: 0 2px 2px #070503, 0 0 10px rgba(194, 121, 66, .38);
}
.journal-spread-controls button:not(:disabled):active,
.journal-spread-controls button:not(:disabled).is-pressed {
  transform: translateY(1px);
  color: #bd8144;
  filter: brightness(.88);
}
.journal-spread-controls button:disabled {
  transform: none;
  filter: none;
}
.journal-mobile-pager button:hover,
.journal-mobile-pager button:focus-visible {
  color: #173e2a;
  border-color: rgba(7, 95, 58, .68);
  background: rgba(7, 95, 58, .07);
  transform: translateY(-1px);
}
.journal-mobile-pager button:active,
.journal-mobile-pager button.is-pressed {
  transform: translateY(1px);
  background: rgba(80, 48, 24, .1);
  box-shadow: inset 0 2px 3px rgba(65, 38, 18, .22);
}

/* Entry navigation and related signals stay printed into the parchment. */
.journal-entry-nav-link,
.journal-entry-nav-index,
.journal-related-strip,
.journal-related-note {
  transform-origin: center;
  transition: transform var(--journal-motion-fast) var(--journal-motion-ease),
    background-color var(--journal-motion-fast) ease,
    box-shadow var(--journal-motion-fast) ease,
    filter var(--journal-motion-fast) ease;
}
.journal-entry-nav-link:hover,
.journal-entry-nav-link:focus-visible,
.journal-entry-nav-index:hover,
.journal-entry-nav-index:focus-visible {
  background: rgba(7, 95, 58, .055);
  transform: translateY(-1px);
}
.journal-entry-nav-link:active,
.journal-entry-nav-index:active {
  transform: translateY(1px);
  background: rgba(65, 38, 18, .08);
  box-shadow: inset 0 2px 3px rgba(65, 38, 18, .16);
}
.journal-related-strip:hover,
.journal-related-strip:focus-visible,
.journal-related-note:hover,
.journal-related-note:focus-visible {
  background: rgba(7, 95, 58, .055);
  transform: translateX(2px);
}
.journal-related-strip:active,
.journal-related-note:active {
  transform: translate(1px, 1px);
  background: rgba(65, 38, 18, .08);
  filter: brightness(.95);
}

/* War Journal campaign rows remain flat ink until selected. */
.journal-campaign-record,
.journal-campaign-field {
  transform-origin: left center;
  transition: background-color var(--journal-motion-fast) ease,
    transform var(--journal-motion-fast) var(--journal-motion-ease),
    box-shadow var(--journal-motion-fast) ease,
    filter var(--journal-motion-fast) ease;
}
.journal-campaign-record:hover,
.journal-campaign-record:focus-visible,
.journal-campaign-field:hover,
.journal-campaign-field:focus-visible {
  background: linear-gradient(90deg, rgba(7, 95, 58, .085), transparent 88%);
  transform: translateX(2px);
  box-shadow: inset 2px 0 0 rgba(7, 95, 58, .3);
}
.journal-campaign-record:active,
.journal-campaign-record.is-pressed,
.journal-campaign-field:active {
  transform: translate(1px, 1px);
  background: linear-gradient(90deg, rgba(65, 38, 18, .11), transparent 88%);
  box-shadow: inset 2px 0 0 rgba(65, 38, 18, .42);
  filter: brightness(.95);
}

/* Map markers behave like mounted metal pins. The parchment map itself stays
   completely stationary. */
.journal-campaign-map-view .campaign-route-marker {
  transform-origin: center;
  transition: transform var(--journal-motion-fast) var(--journal-motion-ease),
    filter var(--journal-motion-fast) ease,
    border-color var(--journal-motion-fast) ease,
    box-shadow var(--journal-motion-fast) ease;
}
.journal-campaign-map-view .campaign-route-marker:hover,
.journal-campaign-map-view .campaign-route-marker:focus-visible {
  transform: translate(-50%, -50%) scale(1.04);
  filter: brightness(1.1) saturate(1.05);
  border-color: rgba(7, 95, 58, .9);
  box-shadow: 0 0 0 3px rgba(7, 95, 58, .16), 0 3px 7px rgba(0, 0, 0, .72), inset 0 0 0 2px rgba(8, 13, 8, .54);
}
.journal-campaign-map-view .campaign-route-marker:active {
  transform: translate(-50%, -49%) scale(1.015);
  filter: brightness(.92);
  box-shadow: 0 0 0 2px rgba(7, 95, 58, .12), 0 1px 3px rgba(0, 0, 0, .72), inset 0 2px 3px rgba(0, 0, 0, .5);
}
.journal-campaign-map-view .campaign-route-marker[aria-pressed="true"] {
  filter: brightness(1.08) saturate(1.06);
}

/* Journal maps reuse the campaign SVG route paths outside the home-page
   #campaign scope. Keep every open curve stroke-only so the browser does not
   close it into an accidental solid black wedge. */
.journal-campaign-map-view .campaign-route-overlay path {
  fill: none;
}

/* Inline campaign actions keep the same ink hierarchy while gaining an
   unmistakable press state. */
.journal-chronicle-feature a,
.journal-mark-detail > a,
.journal-campaign-return {
  transform-origin: left center;
  transition: transform var(--journal-motion-fast) var(--journal-motion-ease),
    color var(--journal-motion-fast) ease,
    border-color var(--journal-motion-fast) ease,
    filter var(--journal-motion-fast) ease;
}
.journal-chronicle-feature a:hover,
.journal-chronicle-feature a:focus-visible,
.journal-mark-detail > a:hover,
.journal-mark-detail > a:focus-visible,
.journal-campaign-return:hover,
.journal-campaign-return:focus-visible {
  transform: translateX(2px);
}
.journal-chronicle-feature a:active,
.journal-mark-detail > a:active,
.journal-campaign-return:active,
.journal-campaign-return.is-pressed {
  transform: translate(1px, 1px);
  filter: brightness(.84);
}

/* Clear focus marks stay inside the page and do not alter layout. */
.journal-detail :is(a, button):focus-visible {
  outline: 2px solid var(--journal-focus-green);
  outline-offset: 2px;
}
.journal-spread-controls button:focus-visible {
  outline-color: var(--journal-focus-copper);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .journal-library-choice,
  .journal-library-choice::before,
  .journal-library-page .route-topline a,
  .journal-detail-page .route-topline a,
  .journal-index-entry,
  .journal-index-edge-turn,
  .journal-spread-controls button,
  .journal-mobile-pager button,
  .journal-entry-nav-link,
  .journal-entry-nav-index,
  .journal-related-strip,
  .journal-related-note,
  .journal-campaign-record,
  .journal-campaign-field,
  .journal-campaign-map-view .campaign-route-marker,
  .journal-chronicle-feature a,
  .journal-mark-detail > a,
  .journal-campaign-return {
    transition: none !important;
  }
  .journal-library-choice:hover,
  .journal-library-choice:focus-visible,
  .journal-library-choice:active,
  .journal-library-page .route-topline a:hover,
  .journal-library-page .route-topline a:focus-visible,
  .journal-library-page .route-topline a:active,
  .journal-detail-page .route-topline a:hover,
  .journal-detail-page .route-topline a:focus-visible,
  .journal-detail-page .route-topline a:active,
  .journal-index-entry:hover,
  .journal-index-entry:focus-visible,
  .journal-index-entry:active,
  .journal-index-edge-turn:hover,
  .journal-index-edge-turn:focus-visible,
  .journal-index-edge-turn:active,
  .journal-spread-controls button:not(:disabled):hover,
  .journal-spread-controls button:not(:disabled):focus-visible,
  .journal-spread-controls button:not(:disabled):active,
  .journal-spread-controls button:not(:disabled).is-pressed,
  .journal-mobile-pager button:hover,
  .journal-mobile-pager button:focus-visible,
  .journal-mobile-pager button:active,
  .journal-mobile-pager button.is-pressed,
  .journal-entry-nav-link:hover,
  .journal-entry-nav-link:focus-visible,
  .journal-entry-nav-link:active,
  .journal-entry-nav-index:hover,
  .journal-entry-nav-index:focus-visible,
  .journal-entry-nav-index:active,
  .journal-related-strip:hover,
  .journal-related-strip:focus-visible,
  .journal-related-strip:active,
  .journal-related-note:hover,
  .journal-related-note:focus-visible,
  .journal-related-note:active,
  .journal-campaign-record:hover,
  .journal-campaign-record:focus-visible,
  .journal-campaign-record:active,
  .journal-campaign-record.is-pressed,
  .journal-campaign-field:hover,
  .journal-campaign-field:focus-visible,
  .journal-campaign-field:active,
  .journal-campaign-map-view .campaign-route-marker:hover,
  .journal-campaign-map-view .campaign-route-marker:focus-visible,
  .journal-campaign-map-view .campaign-route-marker:active,
  .journal-chronicle-feature a:hover,
  .journal-chronicle-feature a:focus-visible,
  .journal-chronicle-feature a:active,
  .journal-mark-detail > a:hover,
  .journal-mark-detail > a:focus-visible,
  .journal-mark-detail > a:active,
  .journal-campaign-return:hover,
  .journal-campaign-return:focus-visible,
  .journal-campaign-return:active,
  .journal-campaign-return.is-pressed {
    transform: none !important;
  }
  .journal-campaign-map-view .campaign-route-marker,
  .journal-campaign-map-view .campaign-route-marker:hover,
  .journal-campaign-map-view .campaign-route-marker:focus-visible,
  .journal-campaign-map-view .campaign-route-marker:active {
    transform: translate(-50%, -50%) !important;
  }
}
