/* Shared base + navigation — A Visitor's Guide to the City */

:root {
  --label-font: "Cinzel", serif;

  --bg: #070505;
  --fg: rgba(245, 230, 200, 0.92);
  --accent: rgba(245, 210, 150, 0.90);
  --accent-2: rgba(255, 215, 150, 0.92);
  --outline: rgba(20, 14, 10, 0.95);
  --shadow: rgba(0, 0, 0, 0.65);

  --nav-logo-size: 52px;
  --nav-gap: 12px;
  --nav-btn-minw: 132px;
  --z-nav: 20;
  --z-tooltip: 1000;
}

* { box-sizing: border-box; }

html { overflow-y: scroll; }
@supports (scrollbar-gutter: stable) {
  html { scrollbar-gutter: stable; }
}

body {
  margin: 0;
  font-family: var(--label-font);
  color: var(--fg);
  overflow-x: hidden;

  background-color: var(--bg);
  background-image: url("bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 55% at 50% 25%, rgba(0,0,0,0.08), rgba(0,0,0,0.38) 70%, rgba(0,0,0,0.55)),
    linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.28));
}

.nav-wide,
main,
footer {
  position: relative;
  z-index: 10;
}

/* ===== NAV BAR ===== */

.nav-wide {
  width: 100%;
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  overflow: visible;
}

.nav-wide .nav {
  min-height: 0;
  display: flex;
  align-items: center;
  position: sticky;
  top: 12px;
  z-index: var(--z-nav);

  width: 100%;
  margin: 10px 0 8px;
  padding: 12px 18px;
  border-radius: 14px;

  border: 1px solid rgba(80, 55, 32, 0.95);
  outline: 1px solid rgba(255, 215, 150, 0.36);
  outline-offset: 5px;

  background: transparent;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.62),
    0 0 30px rgba(255, 215, 150, 0.18);

  overflow: visible;
}

.nav-wide .nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 14px;

  background-color: rgba(12, 10, 10, 0.94);
  background-image: linear-gradient(180deg, rgba(28, 18, 12, 0.92), rgba(10, 8, 8, 0.92));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  pointer-events: none;
  border-radius: 16px;

  background:
    repeating-linear-gradient(90deg,
      rgba(255, 215, 150, 0.20) 0 10px,
      rgba(0, 0, 0, 0) 10px 24px
    ) 0 0 / 100% 6px no-repeat,
    repeating-linear-gradient(90deg,
      rgba(255, 215, 150, 0.18) 0 9px,
      rgba(0, 0, 0, 0) 9px 22px
    ) 0 100% / 100% 6px no-repeat,
    repeating-linear-gradient(0deg,
      rgba(255, 215, 150, 0.18) 0 9px,
      rgba(0, 0, 0, 0) 9px 22px
    ) 0 0 / 6px 100% no-repeat,
    repeating-linear-gradient(0deg,
      rgba(255, 215, 150, 0.18) 0 9px,
      rgba(0, 0, 0, 0) 9px 22px
    ) 100% 0 / 6px 100% no-repeat,
    radial-gradient(70px 70px at 0% 0%, rgba(255, 215, 150, 0.22), rgba(0,0,0,0) 65%),
    radial-gradient(70px 70px at 100% 0%, rgba(255, 215, 150, 0.20), rgba(0,0,0,0) 65%),
    radial-gradient(70px 70px at 0% 100%, rgba(255, 215, 150, 0.16), rgba(0,0,0,0) 65%),
    radial-gradient(70px 70px at 100% 100%, rgba(255, 215, 150, 0.16), rgba(0,0,0,0) 65%);

  opacity: 0.95;
  filter:
    drop-shadow(0 0 10px rgba(255, 215, 150, 0.14))
    drop-shadow(0 0 22px rgba(255, 180, 90, 0.10));

  animation: runeGlow 5.5s ease-in-out infinite;
}

@keyframes runeGlow {
  0%, 100% {
    opacity: 0.82;
    filter:
      drop-shadow(0 0 10px rgba(255, 215, 150, 0.16))
      drop-shadow(0 0 24px rgba(255, 180, 90, 0.10));
  }
  50% {
    opacity: 1;
    filter:
      drop-shadow(0 0 14px rgba(255, 215, 150, 0.22))
      drop-shadow(0 0 34px rgba(255, 180, 90, 0.16));
  }
}

.nav .nav-corners {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: 14px;
}

.nav .nav-corners::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255,215,150,0.85) 0%, rgba(255,215,150,0.28) 38%, rgba(0,0,0,0) 72%) 0 0/56px 56px no-repeat,
    linear-gradient(225deg, rgba(255,215,150,0.85) 0%, rgba(255,215,150,0.28) 38%, rgba(0,0,0,0) 72%) 100% 0/56px 56px no-repeat,
    linear-gradient(45deg, rgba(255,215,150,0.78) 0%, rgba(255,215,150,0.22) 38%, rgba(0,0,0,0) 72%) 0 100%/56px 56px no-repeat,
    linear-gradient(-45deg, rgba(255,215,150,0.78) 0%, rgba(255,215,150,0.22) 38%, rgba(0,0,0,0) 72%) 100% 100%/56px 56px no-repeat;
  opacity: 0.95;
  filter:
    drop-shadow(0 0 10px rgba(255, 215, 150, 0.18))
    drop-shadow(0 0 22px rgba(255, 180, 90, 0.12));
}

.nav .nav-corners::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 12px;
  border: 1px solid rgba(255, 215, 150, 0.28);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.65) inset,
    0 0 18px rgba(255, 215, 150, 0.06);
  opacity: 0.9;
}

.nav-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: var(--nav-gap);
  overflow: visible;
}

.nav-left,
.nav-right {
  min-width: 0;
}

.nav-left { justify-self: start; padding-left: 8px; }
.nav-right { justify-self: end; padding-right: 8px; }

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.nav-left .nav-buttons { justify-content: flex-start; }
.nav-right .nav-buttons { justify-content: flex-end; }

.nav-btn {
  position: relative;
  overflow: hidden;

  font-family: var(--label-font);
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent-2);
  text-decoration: none;

  padding: 10px 16px;
  min-width: var(--nav-btn-minw);
  max-width: 100%;
  min-height: 44px;
  display: grid;
  place-items: center;

  border-radius: 16px;
  border: 1px solid rgba(255, 215, 150, 0.55);
  outline: 1px solid rgba(145, 95, 45, 0.55);
  outline-offset: 4px;

  background: linear-gradient(180deg, rgba(70, 46, 26, 0.70), rgba(12, 10, 10, 0.45));

  box-shadow:
    0 10px 26px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 0 0 1px rgba(0,0,0,0.35);

  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
}

.nav-btn::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(140px 60px at 20% 40%, rgba(255, 215, 150, 0.26), rgba(0,0,0,0) 65%),
    radial-gradient(140px 60px at 80% 60%, rgba(255, 215, 150, 0.22), rgba(0,0,0,0) 65%),
    radial-gradient(70px 70px at 16% 52%, rgba(255, 215, 150, 0.22), rgba(0,0,0,0) 62%),
    radial-gradient(70px 70px at 84% 48%, rgba(255, 215, 150, 0.18), rgba(0,0,0,0) 62%);
  mix-blend-mode: screen;
  transform: rotate(-6deg);
  filter: blur(0.2px);
}

.nav-btn::after {
  content: "";
  position: absolute;
  inset: 6px 10px;
  border-radius: 12px;
  pointer-events: none;
  border: 1px solid rgba(255, 215, 150, 0.28);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45) inset;
  opacity: 0.9;
}

.nav-btn:hover {
  border-color: rgba(255, 215, 150, 0.75);
  color: #fff2d0;
  box-shadow:
    0 0 0 3px rgba(255, 215, 150, 0.12),
    0 14px 34px rgba(0,0,0,0.60),
    0 0 26px rgba(255, 215, 150, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}

.nav-btn:focus-visible {
  outline: 3px solid rgba(255, 215, 150, 0.35);
  outline-offset: 6px;
}

.nav-btn.is-active,
.nav-btn.active {
  color: #fff2d0;
  border-color: rgba(255, 215, 150, 0.85);
  box-shadow:
    0 0 0 3px rgba(255, 215, 150, 0.14),
    0 14px 34px rgba(0,0,0,0.60),
    0 0 32px rgba(255, 215, 150, 0.22),
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.35);
}

.nav-center-title {
  position: relative;
  z-index: 6;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow: visible;

  font-family: var(--label-font);
  font-size: clamp(15px, 1.05vw, 24px);
  font-weight: 600;
  letter-spacing: clamp(1px, 0.35vw, 8px);
  text-transform: uppercase;
  color: var(--accent);

  text-shadow:
    -1px -1px 0 var(--outline),
     1px -1px 0 var(--outline),
    -1px  1px 0 var(--outline),
     1px  1px 0 var(--outline),
     0   2px 0 var(--shadow);

  white-space: normal;
  text-align: center;
  line-height: 1.12;
}

.nav-center-title.nav-title-link {
  text-decoration: none;
  cursor: pointer;
}

.nav-logo {
  width: var(--nav-logo-size);
  height: var(--nav-logo-size);
  object-fit: contain;
  flex: 0 0 auto;
  filter:
    drop-shadow(0 0 10px rgba(255, 215, 150, 0.18))
    drop-shadow(0 0 22px rgba(255, 180, 90, 0.10));
  transform: translateY(1px);
}

.nav-title-text { display: inline-block; line-height: 1; }

.nav-title-hint {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  display: block;
  white-space: nowrap;

  font-family: var(--label-font);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.8px;
  text-transform: none;
  line-height: 1.2;

  color: var(--accent-2);
  background: rgba(20, 14, 10, 0.96);
  border: 1px solid rgba(107, 74, 43, 0.9);
  border-radius: 12px;
  padding: 8px 10px;

  box-shadow:
    0 12px 30px rgba(0,0,0,0.55),
    0 0 18px rgba(255, 215, 150, 0.10);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
  z-index: var(--z-tooltip);
}

.nav-center-title:hover .nav-title-hint,
.nav-center-title:focus-visible .nav-title-hint {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(2px);
}

/* Map district link tooltips */
.label-link {
  text-decoration: none;
  z-index: 3;
}

.label-link:hover,
.label-link:focus-visible {
  z-index: 4;
}

.label-link::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 10px);
  white-space: nowrap;

  font-family: var(--label-font);
  font-size: 13px;
  letter-spacing: 0.8px;
  text-transform: none;

  color: var(--accent-2);
  background: rgba(20, 14, 10, 0.92);
  border: 1px solid rgba(107, 74, 43, 0.9);
  border-radius: 12px;
  padding: 8px 10px;

  box-shadow:
    0 12px 30px rgba(0,0,0,0.55),
    0 0 18px rgba(255, 215, 150, 0.10);

  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.label-link:hover::after,
.label-link:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 16px);
}

@media (max-width: 600px) {
  .connector {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav::after { animation: none; }
  .nav-btn { transition: none; }
  .nav-title-hint { transition: none; }
}

@media (min-width: 1500px) {
  :root {
    --nav-btn-minw: 150px;
  }

  .nav-wide .nav {
    padding: 14px 22px;
  }

  .nav-center-title {
    font-size: clamp(18px, 1.2vw, 28px);
    letter-spacing: clamp(3px, 0.5vw, 12px);
    gap: 12px;
  }

  .nav-btn {
    font-size: 15px;
    letter-spacing: 1.4px;
    padding: 11px 20px;
  }
}

@media (max-width: 1200px) {
  body {
    background-attachment: scroll;
  }

  .nav-wide .nav {
    min-height: auto;
    top: 8px;
    padding: 12px 14px;
  }

  .nav-inner {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "home about"
      "overview journals"
      "novels novels"
      "title title";
    gap: 10px;
    grid-auto-rows: minmax(44px, auto);
  }

  .nav-left,
  .nav-right,
  .nav-buttons {
    display: contents;
  }

  .nav-home-btn { grid-area: home; }
  .nav-about-btn { grid-area: about; }
  .nav-overview-btn { grid-area: overview; }
  .nav-journals-btn { grid-area: journals; }
  .nav-novels-btn { grid-area: novels; }

  .nav-btn {
    font-size: 13px;
    padding: 10px 12px;
    min-height: 44px;
    min-width: 0;
    width: 100%;
    height: 100%;
    justify-self: stretch;
  }

  .nav-center-title {
    grid-area: title;
    justify-self: center;
    font-size: clamp(18px, 4.2vw, 22px);
    letter-spacing: clamp(3px, 2.2vw, 8px);
    white-space: normal;
    text-align: center;
    padding: 2px 6px;
    z-index: 6;
    transform: none;
  }

  .nav-title-text { line-height: 1.12; }

  .nav-logo {
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 1201px) and (max-width: 1499px) {
  :root {
    --nav-logo-size: 44px;
  }

  .nav-left { padding-left: 4px; }
  .nav-right { padding-right: 4px; }
}
