/* -------------------------------------------------------------
   Design tokens — change these to re-theme the whole site
------------------------------------------------------------- */
:root {
  --navy-deep: #0a0f1f;
  --navy: #10182b;
  --navy-light: #1a2540;
  --parchment: #efe6d2;
  --parchment-dim: #b9ae91;
  --gold: #c9a961;
  --gold-bright: #e0c384;
  --ink-muted: #8b93a7;
  --border-hairline: rgba(201, 169, 97, 0.22);

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width: 1180px;
}

/* -------------------------------------------------------------
   Reset & base
------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--navy-deep);
  color: var(--parchment);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--parchment);
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ol,
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* -------------------------------------------------------------
   Shared layout helpers
------------------------------------------------------------- */
.section-heading {
  max-width: 560px;
  margin: 0 auto 3rem;
  text-align: center;
}

.section-heading__title {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  font-weight: 600;
}

.section-heading__subtitle {
  margin-top: 0.6rem;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

.button {
  display: inline-block;
  padding: 0.85rem 2rem;
  border-radius: 2px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.button--primary {
  background: var(--gold);
  color: var(--navy-deep);
}

.button--primary:hover {
  background: var(--gold-bright);
}

/* -------------------------------------------------------------
   Navbar
------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  background: rgba(10, 15, 31, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.navbar__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gold);
}

.navbar__brand-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  flex-wrap: wrap;
}

.navbar__link {
  position: relative;
  font-size: 0.92rem;
  color: var(--parchment-dim);
  transition: color 0.2s ease;
}

.navbar__link:hover {
  color: var(--gold-bright);
}

.navbar__link--soon {
  cursor: default;
  opacity: 0.55;
}

.navbar__link--soon:hover {
  color: var(--parchment-dim);
}

.navbar__badge {
  margin-left: 0.4rem;
  font-size: 0.65rem;
  font-family: var(--font-body);
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-hairline);
  border-radius: 2px;
  color: var(--gold-bright);
  vertical-align: middle;
}

/* -------------------------------------------------------------
   Hero
------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(5rem, 12vw, 8rem) clamp(1.25rem, 4vw, 3rem) clamp(4rem, 8vw, 6rem);
  background: radial-gradient(circle at 50% -10%, var(--navy-light), var(--navy-deep) 65%);
}

.hero__contours {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
}

.hero__contours path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  opacity: 0.35;
}

.hero__contours path:nth-child(even) {
  opacity: 0.18;
}

.hero__content {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hero__kicker {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  margin-bottom: 1.25rem;
}

.hero__title {
  font-size: clamp(3rem, 8vw, 5.25rem);
  font-weight: 700;
  line-height: 1.05;
}

.hero__subtitle {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.75rem);
  color: var(--parchment-dim);
  font-style: italic;
}

.hero__description {
  margin: 1.75rem auto 2.5rem;
  max-width: 540px;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

/* -------------------------------------------------------------
   Featured History
------------------------------------------------------------- */
.featured {
  padding: clamp(4rem, 8vw, 6rem) clamp(1.25rem, 4vw, 3rem);
  max-width: var(--max-width);
  margin: 0 auto;
}

.featured__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.empire-card {
  padding: 1.75rem;
  border: 1px solid var(--border-hairline);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.empire-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
}

.empire-card__era {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  border: 1px solid var(--border-hairline);
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.empire-card__name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.empire-card__region {
  color: var(--parchment-dim);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.empire-card__description {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.empire-card__link {
  font-size: 0.85rem;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
}

/* -------------------------------------------------------------
   Timeline
------------------------------------------------------------- */
.timeline {
  padding: clamp(4rem, 8vw, 6rem) clamp(1.25rem, 4vw, 3rem);
  max-width: 760px;
  margin: 0 auto;
}

.timeline__list {
  position: relative;
  padding-left: 1.75rem;
  border-left: 1px solid var(--border-hairline);
}

.timeline__item {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: -1.94rem;
  top: 0.3rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy-deep);
  border: 2px solid var(--gold);
}

.timeline__year {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-bright);
  margin-bottom: 0.3rem;
}

.timeline__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.timeline__description {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* -------------------------------------------------------------
   Footer
------------------------------------------------------------- */
.footer {
  padding: 3rem clamp(1.25rem, 4vw, 3rem) 2.5rem;
  text-align: center;
  border-top: 1px solid var(--border-hairline);
}

.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.footer__note {
  max-width: 420px;
  margin: 0 auto 1.25rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.footer__copyright {
  color: var(--parchment-dim);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------
   View switching
   Only one <section class="view"> is shown at a time — script.js
   toggles the --hidden class based on the current URL hash.
------------------------------------------------------------- */
.view--hidden {
  display: none;
}

/* -------------------------------------------------------------
   Page header
   Used at the top of Explore / Kingdoms / Rulers / Events / Places
------------------------------------------------------------- */
.page-header {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 5rem) clamp(1.25rem, 4vw, 3rem) 0;
  text-align: center;
}

.page-header__title {
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 600;
}

.page-header__subtitle {
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

/* Small inline link used next to section subtitles ("See all kingdoms") */
.text-link {
  display: inline-block;
  margin-left: 0.5rem;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.text-link:hover {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

/* When a text-link stands on its own line (e.g. under a timeline item)
   instead of following inline text, drop the left margin and add a
   little space above it instead. */
.timeline__body .text-link {
  margin-left: 0;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* Cards are now <a> elements (so they're keyboard- and click-navigable),
   so we restore block layout and remove the underline a browser would
   otherwise add to a link. */
.empire-card {
  display: block;
}

a.empire-card {
  cursor: pointer;
}

/* -------------------------------------------------------------
   Period filters (Explore view)
------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.filter-button {
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: transparent;
  color: var(--parchment-dim);
  border: 1px solid var(--border-hairline);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.filter-button:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.filter-button--active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy-deep);
  font-weight: 600;
}

/* -------------------------------------------------------------
   Detail views (kingdom detail, ruler detail)
------------------------------------------------------------- */
.detail {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem) clamp(5rem, 8vw, 6rem);
}

.back-button {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--gold);
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.back-button:hover {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

.detail__era {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--gold-bright);
  border: 1px solid var(--border-hairline);
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
  margin-bottom: 1.25rem;
}

.detail__title {
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.detail__meta {
  color: var(--parchment-dim);
  font-size: 1rem;
  margin-bottom: 1.75rem;
}

.detail__description {
  color: var(--ink-muted);
  font-size: 1.05rem;
  max-width: 640px;
  margin-bottom: 2.5rem;
}

.detail__section {
  margin-bottom: 2.25rem;
}

.detail__section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--parchment);
  margin-bottom: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-hairline);
}

.detail__list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.detail__list-item {
  color: var(--ink-muted);
  font-size: 0.98rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-hairline);
}

.detail__list-item strong {
  color: var(--parchment);
  font-weight: 600;
}

/* A ruler name inside a kingdom detail page, linking to that ruler */
a.detail__list-item {
  display: block;
  color: var(--ink-muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}

a.detail__list-item:hover {
  color: var(--gold-bright);
  border-left-color: var(--gold);
}

.detail__empty {
  color: var(--parchment-dim);
  font-size: 0.9rem;
  font-style: italic;
}

/* -------------------------------------------------------------
   Active nav link — highlights the current section
------------------------------------------------------------- */
.navbar__link--active {
  color: var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  padding-bottom: 2px;
}

/* -------------------------------------------------------------
   Responsive
------------------------------------------------------------- */
@media (max-width: 640px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar__links {
    gap: 1rem 1.25rem;
  }
}
