/* ------------------------------------------------------------
   Base typography
   ------------------------------------------------------------ */
html {
    font-size: 100%;
    line-height: 1.6;
    color: #222;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: #fff;
}

body {
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: stretch;
}

main {
    flex: 1;
}


/* ------------------------------------------------------------
   Layout containers
   ------------------------------------------------------------ */
main,
footer {
    width: 100%;
    max-width: 1450px;
    margin: 0 auto;
    padding: 1.5rem;
    box-sizing: border-box;
}

nav {
    padding: 0;
}

header,
.site-footer {
    max-width: 1450px; /* matches main content width */
    margin: 0 auto;
}

header {
    padding: 0; /* keep header tidy */
}


/* Header row: logo left, nav + mode controls right */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  max-width: 1450px;
  margin: 0 auto;
  padding: 0.25rem 0.75rem; /* minimal breathing room */
  box-sizing: border-box;
}

.top-controls > * {
  min-width: 0;
}

@media (max-width: 925px) {
    .site-header {
        flex-direction: column;
        align-items: stretch;
    }
}



/* Mode controls stay top-right until wrap triggers */
.top-controls .mode-controls-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}



/* ------------------------------------------------------------
   Headings
   ------------------------------------------------------------ */
h1, h2, h3 {
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* ------------------------------------------------------------
   Links (Light Mode defaults)
   ------------------------------------------------------------ */
a {
    color: #0645ad;
    text-decoration: none;
}

a:hover {
    background: #e8f0ff;
    color: #003c8f;
}

a:focus {
    outline: 2px solid #0645ad;
    outline-offset: 2px;
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Lists
   ------------------------------------------------------------ */
ul {
    padding-left: 1.25rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------
   Navigation
   ------------------------------------------------------------ */
nav a {
    margin-right: 1rem;
    display: inline-block;
}

/* ------------------------------------------------------------
   Skip link
   ------------------------------------------------------------ */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* ------------------------------------------------------------
   Screen Reader Mode
   ------------------------------------------------------------ */
body.sr-mode {
    font-size: 1.25rem;
    line-height: 1.8;
    letter-spacing: 0.5px;
}

body.sr-mode a {
    text-decoration: underline;
    padding: 0.1rem 0;
    display: inline-block;
}

/* ------------------------------------------------------------
   Dark Mode
   ------------------------------------------------------------ */
body.dark-mode {
    background: #111;
    color: #e5e5e5;
}

body.dark-mode a {
    color: #9ecbff;
}

body.dark-mode a:hover {
    background: #333;
    color: #9ecbff;
}

body.dark-mode a:focus {
    outline: 2px solid #9ecbff;
}

body.dark-mode .menu-toggle {
    color: #9ecbff;
}

body.dark-mode .main-nav {
    background: #111;
}

body.dark-mode .main-nav a {
    color: #9ecbff;
}

/* ------------------------------------------------------------
   High Contrast Mode
   ------------------------------------------------------------ */
body.high-contrast {
    background: #000;
    color: #fff;
}

body.high-contrast a {
    color: #ff0;
    text-decoration: underline;
}

body.high-contrast a:hover {
    background: transparent;
    color: #ff0;
    text-decoration: underline;
}

body.high-contrast a:focus {
    outline: 2px solid #ff0;
}

body.high-contrast .menu-toggle {
    color: #ff0;
}

body.high-contrast .main-nav {
    background: #000;
}

body.high-contrast .main-nav a {
    color: #ff0;
}

/* ------------------------------------------------------------
   Mode controls (Unified & Fixed Alignment)
   ------------------------------------------------------------ */

/* Mode buttons pinned top-right */
.mode-controls-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.mode-controls-top button {
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #222;
  cursor: pointer;
  border-radius: 3px;
}

.mode-controls-top button:hover {
    background: #e9e9e9;
}

.mode-controls-top button:focus {
    outline: 2px solid #003c8f;
    outline-offset: 2px;
}

.mode-controls-top button[aria-pressed="true"] {
    border-color: #003c8f;
    background: #d6e6ff;
    color: #000;
}

/* Dark mode buttons */
body.dark-mode .mode-controls-top button {
    background: #222;
    border-color: #555;
    color: #e5e5e5;
}

body.dark-mode .mode-controls-top button:hover {
    background: #333;
}

body.dark-mode .mode-controls-top button:focus {
    outline: 2px solid #9ecbff;
}

body.dark-mode .mode-controls-top button[aria-pressed="true"] {
    background: #0645ad;
    border-color: #9ecbff;
    color: #fff;
}

/* High contrast buttons */
body.high-contrast .mode-controls-top button {
    background: #000;
    border-color: #fff;
    color: #fff;
}

body.high-contrast .mode-controls-top button:hover {
    background: #222;
}

body.high-contrast .mode-controls-top button:focus {
    outline: 2px solid #ff0;
}

body.high-contrast .mode-controls-top button[aria-pressed="true"] {
    background: #ff0;
    border-color: #000;
    color: #000;
}

/* 3. The primary navigation container row */
.site-header {
    width: 100%;
    max-width: 1450px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;   /* Fixed horizontal padding to match layout */
    box-sizing: border-box;
    border-bottom: 1px solid #ddd;
    
    display: flex;
    align-items: center;
    justify-content: space-between; /* Keeps logo left, moves nav right */
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 42px;
    height: auto;
}

.brand-name {
    font-size: 1.6rem;
    font-weight: 600;
    color: inherit;
}

/* Navigation */

/* 4. The actual menu structure (About, Privacy, etc.) */
.main-nav {
    margin-left: auto; /* Fallback insurance to push the nav right */
}

.main-nav ul {
    display: flex;
    justify-content: flex-end; /* Ensures inner items stay right-aligned */
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav a {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.main-nav a:hover,
.main-nav a:focus {
    background: #e8f0ff;
    outline: none;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #0645ad;
    position: relative;
    z-index: 2000;
}
/* ------------------------------------------------------------
   Mobile Navigation
   ------------------------------------------------------------ */
@media (max-width: 925px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 70px;
        right: 1rem;
        background: #fff;
        border: 1px solid #ddd;
        padding: 1rem;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: 1000;
    }

    .main-nav.open {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ------------------------------------------------------------
   Footer Navigation
   ------------------------------------------------------------ */
.site-footer {
    border-top: 1px solid #ddd;
    margin-top: 3rem;
    padding: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #555;
}

.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.footer-nav a {
    color: inherit;
    text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a:focus {
    text-decoration: underline;
}

/* ------------------------------------------------------------
   Responsive adjustments
   ------------------------------------------------------------ */
@media (max-width: 600px) {
    main,
    header,
    nav,
    footer {
        padding: 1rem;
    }

    nav a {
        margin-right: 0.75rem;
    }
}

.page-watermark {
    position: fixed;
    top: -10%;              /* lifted higher, slightly off the top */
    left: 50%;
    transform: translateX(-50%);
    width: 1450px;
    opacity: 0.10;          /* slightly stronger visibility */
    z-index: 1;             /* bring it above background layers */
    pointer-events: none;
}

/* ------------------------------------------------------------
   CARD GRID LAYOUT
------------------------------------------------------------ */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1.5rem;
    align-items: start; /* key line */
    margin: 2rem 0;
    position: relative;
    z-index: 2;
}

/* ------------------------------------------------------------
   CARD BASE STYLE
------------------------------------------------------------ */

.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e5e5e5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover,
.card:focus-within {
    border-color: #bbb;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* ------------------------------------------------------------
   CARD HEADINGS
------------------------------------------------------------ */

.card h2,
.card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: #222;
}

/* ------------------------------------------------------------
   CARD LISTS
------------------------------------------------------------ */

.card ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.card li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;   /* ⭐ REQUIRED FOR TOOLTIP ANCHOR */
    overflow: visible;    /* ⭐ REQUIRED FOR tooltip to escape */
}


.card li .place-name {
    flex: 1 1 auto;
    min-width: 0;
}

.card li:last-child {
    border-bottom: none;
}

.local-map-card img {
    width: 100%;
    max-width: 512px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* ------------------------------------------------------------
   META BLOCK (keeps badges + map button together)
------------------------------------------------------------ */

.card li .meta-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;          /* pushes block to the right */
    justify-content: flex-end;  /* right-aligns contents */
}

/* ------------------------------------------------------------
   BADGES (for types, languages, etc.)
------------------------------------------------------------ */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: #eef2ff;
    color: #334;
    margin-left: 0.4rem;
}

.badge-distance {
    position: relative; /* ensures tooltip positions correctly */
    background: #e0e0e0;
    color: #333;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 0.35rem;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   MAP BUTTON (Unified, theme-aware)
------------------------------------------------------------ */

.map-button {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #222;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.map-button:hover {
    background: #e9e9e9;
}

.map-button:focus {
    outline: 2px solid #0645ad;
    outline-offset: 2px;
}

/* Dark mode */
body.dark-mode .map-button {
    background: #222;
    border-color: #555;
    color: #e5e5e5;
}

body.dark-mode .map-button:hover {
    background: #333;
}

body.dark-mode .map-button:focus {
    outline: 2px solid #9ecbff;
}

/* High contrast */
body.high-contrast .map-button {
    background: #000;
    border: 2px solid #fff;
    color: #fff;
}

body.high-contrast .map-button:hover {
    background: #222;
}

body.high-contrast .map-button:focus {
    outline: 2px solid #ff0;
}


/* ------------------------------------------------------------
   LANGUAGE CARDS
------------------------------------------------------------ */

.language-name {
    font-weight: 600;
    color: #222;
}

.language-local {
    color: #555;
    font-style: italic;
}

/* ------------------------------------------------------------
   DARK MODE SUPPORT
------------------------------------------------------------ */

body.dark .card {
    background: #1e1e1e;
    border-color: #333;
    box-shadow: none;
}

body.dark .card:hover {
    border-color: #555;
}

body.dark .card h2,
body.dark .card h3 {
    color: #f0f0f0;
}

body.dark .card li {
    border-bottom-color: #333;
}

body.dark .badge {
    background: #333;
    color: #ddd;
}

/* ------------------------------------------------------------
   HIGH CONTRAST MODE
------------------------------------------------------------ */

body.contrast .card {
    background: #fff;
    border: 2px solid #000;
    box-shadow: none;
}

body.contrast .card h2,
body.contrast .card h3 {
    color: #000;
}

body.contrast .badge {
    background: #000;
    color: #fff;
}

/* ------------------------------------------------------------
   BREADCRUMBS
------------------------------------------------------------ */

#place-name {
    word-break: break-word;
    hyphens: auto;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    margin-top: 0;
}
.breadcrumbs {
    margin-bottom: 0.5rem;
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;  /* was something like 1.5rem */
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}


.breadcrumbs li {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.breadcrumbs li::after {
    content: "›";
    margin-left: 0.35rem;
    color: #888;
}

.breadcrumbs li:last-child::after {
    content: "";
}


/* ------------------------------------------------------------
   CARD FIXES TO MATCH EXISTING JS (dark-mode / high-contrast)
   ------------------------------------------------------------ */

/* Dark mode cards (JS uses dark-mode) */
body.dark-mode .card {
    background: #1e1e1e;
    border-color: #333;
    color: #f0f0f0;
    box-shadow: none;
}

body.dark-mode .card li {
    border-bottom-color: #333;
}

body.dark-mode .badge,
body.dark-mode .badge-distance {
    background: #333;
    color: #ddd;
}

/* High contrast cards (JS uses high-contrast) */
body.high-contrast .card {
    background: #000;
    border: 2px solid #fff;
    color: #fff;
    box-shadow: none;
}

body.high-contrast .badge,
body.high-contrast .badge-distance {
    background: #fff;
    color: #000;
}

/* ------------------------------------------------------------
   FIX: Card titles in dark + high contrast modes
------------------------------------------------------------ */

body.dark-mode .card h2,
body.dark-mode .card h3 {
    color: #f0f0f0;
}

body.high-contrast .card h2,
body.high-contrast .card h3 {
    color: #fff;
}

/* Base colours (light mode) */
:root {
    --tooltip-bg: #333;
    --tooltip-text: #fff;
    --tooltip-border: #333;
    --tooltip-icon: #666;
}

/* Dark mode */
body.dark-mode {
    --tooltip-bg: #eee;
    --tooltip-text: #000;
    --tooltip-border: #eee;
    --tooltip-icon: #ccc;
}

/* High contrast mode */
body.contrast-mode {
    --tooltip-bg: #000;
    --tooltip-text: #ff0;
    --tooltip-border: #ff0;
    --tooltip-icon: #ff0;
}

/* Screen reader mode (hide icon visually) */
body.reader-mode .coming-soon {
    display: none;
}

/* ------------------------------ */
/* TOOL TIP                       */
/* ------------------------------ */

/* LIGHT MODE (default) */
/*

body:not(.dark-mode):not(.high-contrast) .coming-soon-circle {
    fill: #222;
    stroke: #222;
}
body:not(.dark-mode):not(.high-contrast) .coming-soon-text {
    fill: #fff;
}
*/
/* DARK MODE */
/*
body.dark-mode .coming-soon-circle {
    fill: #000;
    stroke: #fff;
}
body.dark-mode .coming-soon-text {
    fill: #fff;
}
*/
/* HIGH CONTRAST MODE */
/*
body.high-contrast .coming-soon-circle {
    fill: #000;
    stroke: #fff;
}
body.high-contrast .coming-soon-text {
    fill: #fff;
}
*/


.coming-soon {
    position: relative;
    display: inline-block;
    margin-left: 4px;
    cursor: help;
}

.coming-soon-icon {
    width: 1.0em;
    height: 1.0em;
    vertical-align: middle;
}

.coming-soon-circle {
    stroke-width: 1.5;
    fill: var(--tooltip-bg);
    stroke: var(--tooltip-border);
}

.coming-soon-text {
    font-size: 25px;
    font-weight: 700;
    fill: var(--tooltip-text);
    text-anchor: middle;
    dominant-baseline: middle;
}



/* ------------------------------ */
/* POPUP                          */
/* ------------------------------ */

/* Popup */
.coming-soon:hover::after {
    content: "Page coming soon";
    position: absolute;
    top: -32px;
    left: 0;
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 9999;
    opacity: 0.95;
}

/* Popup arrow */
.coming-soon:hover::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 6px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--tooltip-bg) transparent transparent transparent;
    z-index: 9999;
}

/* ------------------------------------------------------------
   Direction arrows (ported from compass-test.html)
------------------------------------------------------------ */

/* Arrow shape */
.arrow {
  width: 0.9rem;
  height: 0.9rem;
  display: inline-block;
  clip-path: polygon(50% 0%, 25% 100%, 75% 100%);
  transform-origin: center;
  position: relative;
  top: 3px;        /* ↓↓↓ THIS IS THE FIX ↓↓↓ */
  z-index: 10;
  overflow: visible;
  transition: all 0.2s ease;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.3));
}

.arrow:hover::after {
  content: attr(data-label);
  position: absolute;
  bottom: 140%; /* adjust to sit above arrow */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  animation: fadeIn 0.15s forwards;
}
/* Hover glow + scale (rotation preserved) */
.arrow:hover {
  transform: rotate(var(--angle)) scale(1.25);
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.8))
          drop-shadow(0 0 8px rgba(0,0,0,0.6));
}

/* Rotation angles using CSS variables */
.n   { --angle: 0deg; }
.nne { --angle: 22.5deg; }
.ne  { --angle: 45deg; }
.ene { --angle: 67.5deg; }
.e   { --angle: 90deg; }
.ese { --angle: 112.5deg; }
.se  { --angle: 135deg; }
.sse { --angle: 157.5deg; }
.s   { --angle: 180deg; }
.ssw { --angle: 202.5deg; }
.sw  { --angle: 225deg; }
.wsw { --angle: 247.5deg; }
.w   { --angle: 270deg; }
.wnw { --angle: 292.5deg; }
.nw  { --angle: 315deg; }
.nnw { --angle: 337.5deg; }

/* Apply rotation */
.arrow {
  transform: rotate(var(--angle));
}


@keyframes fadeIn {
  to { opacity: 1; }
}

/* ------------------------------------------------------------
   Mode colours (exact match to compass-test)
------------------------------------------------------------ */

/* Light mode */
body:not(.dark-mode):not(.high-contrast) .n,
body:not(.dark-mode):not(.high-contrast) .e,
body:not(.dark-mode):not(.high-contrast) .s,
body:not(.dark-mode):not(.high-contrast) .w { background: #00A652; }

body:not(.dark-mode):not(.high-contrast) .ne,
body:not(.dark-mode):not(.high-contrast) .se,
body:not(.dark-mode):not(.high-contrast) .sw,
body:not(.dark-mode):not(.high-contrast) .nw { background: #FFDD33; }

body:not(.dark-mode):not(.high-contrast) .nne,
body:not(.dark-mode):not(.high-contrast) .ene,
body:not(.dark-mode):not(.high-contrast) .ese,
body:not(.dark-mode):not(.high-contrast) .sse,
body:not(.dark-mode):not(.high-contrast) .ssw,
body:not(.dark-mode):not(.high-contrast) .wsw,
body:not(.dark-mode):not(.high-contrast) .wnw,
body:not(.dark-mode):not(.high-contrast) .nnw { background: #3366CC; }

/* Dark mode */
body.dark-mode .n, body.dark-mode .e, body.dark-mode .s, body.dark-mode .w { background: #00A652; }
body.dark-mode .ne, body.dark-mode .se, body.dark-mode .sw, body.dark-mode .nw { background: #FFDD33; }
body.dark-mode .nne, body.dark-mode .ene, body.dark-mode .ese, body.dark-mode .sse,
body.dark-mode .ssw, body.dark-mode .wsw, body.dark-mode .wnw, body.dark-mode .nnw { background: #3366CC; }

/* High contrast */
body.high-contrast .n, body.high-contrast .e, body.high-contrast .s, body.high-contrast .w { background: #00FF7F; }
body.high-contrast .ne, body.high-contrast .se, body.high-contrast .sw, body.high-contrast .nw { background: #FFFF00; }
body.high-contrast .nne, body.high-contrast .ene, body.high-contrast .ese, body.high-contrast .sse,
body.high-contrast .ssw, body.high-contrast .wsw, body.high-contrast .wnw, body.high-contrast .nnw { background: #66CCFF; }


/* Tooltip anchored ONLY to arrow-wrap */
.arrow-wrap {
    position: relative;
    display: inline-block;
}

.arrow-wrap:hover::after {
    content: attr(data-label);
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
    animation: fadeIn 0.15s forwards;
}

/* Direction abbreviations: no underline, no native tooltip */
.dir-text,
abbr.dir-text {
  text-decoration: none;   /* removes dotted underline */
  border-bottom: none;     /* removes dotted border */
  cursor: default;         /* prevents help cursor */
  pointer-events: none;    /* disables hover tooltip */
}


/* Same name card enhancements (integrates with site modes) */
.same-name-block { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.same-name-subhead { font-size: 0.95rem; margin: 0 0 0.4rem 0; font-weight: 600; color: inherit; }

/* Central link wrapper */
.same-name-center-wrapper {
  display: flex;
  justify-content: center;
  margin: 0.6rem 0;
  width: 100%;
}
.same-name-center-list { list-style: none; padding: 0; margin: 0; }
.same-name-center { padding: 0; margin: 0; }

/* Emphasised link styling */
.name-page-link {
  display: inline-block;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  transition: background 0.15s ease, transform 0.08s ease;
  line-height: 1.1;
}
.name-page-strong {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #c2185b; /* brand accent for light mode */
}

/* Hover and focus */
.name-page-link:hover .name-page-strong,
.name-page-link:focus .name-page-strong {
  text-decoration: underline;
  transform: translateY(-1px);
  outline: none;
}

/* Focus ring for keyboard users */
.name-page-link:focus {
  outline: 3px solid #0645ad;
  outline-offset: 3px;
  border-radius: 6px;
}

/* Respect dark mode colours (site uses body.dark-mode) */
body.dark-mode .name-page-strong {
  color: #ff8fb3; /* lighter accent for dark background */
}
body.dark-mode .name-page-link:focus {
  outline-color: #9ecbff;
}

/* High contrast mode */
body.high-contrast .name-page-strong {
  color: #fff;
  background: #000;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
body.high-contrast .name-page-link:focus {
  outline: 3px solid #ff0;
}

/* Screen reader mode adjustments (body.sr-mode) */
body.sr-mode .name-page-strong {
  font-weight: 700;
  text-decoration: underline; /* helps sighted users in SR mode */
}
body.sr-mode .name-page-link {
  padding: 0.35rem 0.6rem;
}

/* Small screens */
@media (max-width: 480px) {
  .same-name-subhead { font-size: 0.92rem; }
  .name-page-strong { font-size: 0.98rem; }
  .name-page-link { padding: 0.35rem 0.6rem; }
}

/* Keep list spacing consistent with card li rules */
.same-name-list li { margin: 0.25rem 0; padding: 0; }


.same-name-subhead {
  font-size: 0.98rem;
  margin: 0 0 0.35rem 0;
  font-weight: 600;
  color: inherit;
}

.same-name-center-wrapper { margin: 0.6rem 0; text-align: center; }
.name-page-strong { font-weight: 700; font-size: 1rem; display:inline-block; padding:0.25rem 0.6rem; }

/* ------------------------------------------------------------
   Pagination
------------------------------------------------------------ */

.pagination {
    margin-top: 2rem;
    text-align: center;
}

.pagination-summary {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.pagination-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-list li {
    display: inline-block;
}

.pagination-list a {
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    font-size: 0.9rem;
}

.pagination-list a:hover {
    background: #e8f0ff;
}

.pagination-list .current {
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #0645ad;
    color: #fff;
    font-weight: 600;
}

.pagination-list .ellipsis {
    padding: 0.35rem 0.6rem;
    font-size: 1rem;
}

body.dark-mode .pagination-list a {
    background: #222;
    border-color: #555;
    color: #e5e5e5;
}

body.dark-mode .pagination-list a:hover {
    background: #333;
}

body.dark-mode .pagination-list .current {
    background: #0645ad;
    color: #fff;
    border-color: #9ecbff;
}

body.dark-mode .pagination-summary {
    color: #e5e5e5;
}

body.dark-mode .ellipsis {
    color: #aaa;
}

body.high-contrast .pagination-list a {
    background: #000;
    border: 2px solid #fff;
    color: #fff;
}

body.high-contrast .pagination-list a:hover {
    background: #222;
}

body.high-contrast .pagination-list .current {
    background: #ff0;
    color: #000;
    border-color: #000;
}

body.high-contrast .pagination-summary {
    color: #ff0;
}

body.high-contrast .ellipsis {
    color: #ff0;
}

@media (max-width: 925px) {
    .site-header {
        display: flex;
        flex-direction: row;
        align-items: flex-start;  
        justify-content: space-between;
        width: 100%;
    }

    .main-nav {
        order: 2;                  
        margin-left: auto;         
        /* 🚀 Changed right margin from 1.5rem to 3.5rem to pull the entire box leftward */
        margin-right: 3.5rem;      
        padding-top: 2.25rem;       
        /* 🚀 Set an explicit width to make the box wider and give text breathing room */
        width: 120px;              
    }

    .main-nav ul {
        display: flex;
        flex-direction: column;    
        /* 🚀 Changed from flex-end back to flex-start to left-align the list items */
        align-items: flex-start;   
        gap: 0.75rem;                 
        padding: 0;
        margin: 0;
        list-style: none;
        width: 100%;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        display: block;            /* 🚀 Swapped to block so text uses full width of container */
        padding: 0.25rem 0;
        margin: 0;
    }
}


.card.minimised .card-body {
  display: none;
  max-height: 0;  
}


.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding-top: 0.25rem;   /* lifts header text and icons upward */
  /*padding-bottom: 0.25rem;/* keeps spacing balanced */
}

.card-title {
  margin: 0;
}


.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.card-body {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 2000px; /* large enough for full content */
}

.card-test.minimised .card-test-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.card-test.minimised {
  border-radius: 12px;
  height: 24px;
}

.icon-expand { display: inline; }
.icon-minimise { display: none; }

.card.minimised .icon-expand { display: inline; }
.card.minimised .icon-minimise { display: none; }

.card:not(.minimised) .icon-expand { display: none; }
.card:not(.minimised) .icon-minimise { display: inline; }


.card-controls {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  justify-content: flex-end;
}

.global-toggle {
  background: var(--button-bg, #333);
  color: var(--button-text, #fff);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

/* Base style */
.global-toggle {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

/* Light mode */
body:not(.dark-mode):not(.high-contrast) .global-toggle {
    background: #e8e8e8;
    color: #222;
}
body:not(.dark-mode):not(.high-contrast) .global-toggle:hover {
    background: #dcdcdc;
}

/* Dark mode */
body.dark-mode .global-toggle {
    background: #333;
    color: #fff;
}
body.dark-mode .global-toggle:hover {
    background: #444;
}

/* High contrast mode */
body.high-contrast .global-toggle {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
}
body.high-contrast .global-toggle:hover {
    background: #111;
}

.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    margin-right: 0.5rem;
    user-select: none;
}
.drag-handle:active {
    cursor: grabbing;
}

/* SHARE */

/* Shared card export styling */
.card-export-frame {
    border: 2px solid #ccc;
    border-radius: 12px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
}

.card-export-logo {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 64px;
    opacity: 0.8;
}

/* Drag ghost styling */
.drag-ghost {
    opacity: 0.5;
    transform: scale(0.98);
}

/* Share button hover */
.icon-btn.share:hover .icon-share {
    opacity: 1;
    transform: scale(1.1);
}


/* Back-to-top arrow */
#backToTop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 1.25rem;

    /* 💡 THE Viewport FIX: Force placement halfway down without transforms */
    top: 66vh;
    margin-top: -1.2rem; /* Half the element height to center it perfectly */
    
    padding: 0.5rem 0.75rem;
    font-size: 1.2rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #222;
    cursor: pointer;
    z-index: 99999;
    
    animation: revealLinear both;
    animation-timeline: scroll(root);
    animation-range: 0px 25px;
    

}

/* Native GPU animation transition */
@keyframes revealLinear {
    from {
        opacity: 0;
        visibility: hidden;
        transform: translate3d(0, 15px, 0); /* Gentle fade up */
    }
    to {
        opacity: 1;
        visibility: visible;
        transform: translate3d(0, 0, 0);
    }
}

/* Dark mode */
body.dark-mode #backToTop {
    background: #222;
    border-color: #555;
    color: #eee;
}

/* High contrast */
body.high-contrast #backToTop {
    background: #000;
    border: 2px solid #fff;
    color: #fff;
}


