@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0b0d10;
  --bg-raised: #14171c;
  --bg-card: #181b21;
  --border: #2a2e36;
  --gold: #d8b45f;
  --gold-bright: #f0cf7c;
  --text: #cdd2da;
  --text-dim: #8890a0;
  --link: #7fb4d9;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 1200px 600px at 50% -10%, #1c1f26 0%, var(--bg) 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  line-height: 1.7;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 0.9em 2em;
  display: flex;
  align-items: center;
  gap: 2em;
  flex-wrap: wrap;
}

.header-social {
  display: flex;
  gap: 0.9em;
  margin-left: auto;
}

.header-social a {
  color: var(--text-dim);
  display: flex;
  transition: color 0.15s ease;
}

.header-social a:hover {
  color: var(--gold-bright);
}

header h1 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  font-size: 1.25em;
  text-shadow: 0 0 18px rgba(240, 207, 124, 0.25);
}

header h1 a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.brand-mark {
  height: 1.6em;
  width: auto;
  filter: drop-shadow(0 0 6px rgba(240, 207, 124, 0.3));
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1.4em;
}

nav a {
  position: relative;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92em;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding-bottom: 0.2em;
  transition: color 0.15s ease;
}

nav a:hover {
  color: var(--gold-bright);
}

nav a.active {
  color: var(--gold-bright);
}

nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35em;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 3em 2em 4em;
}

.hero {
  text-align: center;
  padding: 3.5em 1em 3em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5em;
}

.hero h2 {
  font-family: 'Cinzel', serif;
  font-size: 2.2em;
  font-weight: 700;
  color: var(--gold-bright);
  margin: 0 0 0.4em;
  text-shadow: 0 0 30px rgba(240, 207, 124, 0.18);
}

.hero p.tagline {
  color: var(--text-dim);
  font-size: 1.1em;
  max-width: 34em;
  margin: 0 auto 1.6em;
}

.hero .divider {
  width: 5em;
  height: 3px;
  margin: 1.4em auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 2px;
}

.hero-photo {
  background-image:
    linear-gradient(180deg, rgba(11,13,16,0.78) 0%, rgba(11,13,16,0.82) 45%, var(--bg) 100%),
    url('/static/images/hero.jpg');
  background-size: cover;
  background-position: center 80%;
  background-attachment: fixed;
  border-bottom: none;
  padding: 6em 1.5em 4.5em;
}

@media (max-width: 900px) {
  .hero-photo {
    /* background-attachment: fixed is unreliable/janky on mobile browsers */
    background-attachment: scroll;
  }
}

.hero-inner {
  max-width: 40em;
  margin: 0 auto;
}

.hero-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 1.15em;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--gold);
  margin: -0.3em 0 1.2em;
}

.hero-photo .tagline {
  color: #d8dce3;
}

.illustration {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 1.5em 0;
  display: block;
}

.illustration + em {
  display: block;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85em;
  margin-top: -1em;
}

.card-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1em;
  margin-top: 2em;
}

.card-links a {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2em 1.3em;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.card-links a:hover {
  border-color: var(--gold);
  background: var(--bg-raised);
  transform: translateY(-2px);
}

.card-links strong {
  display: block;
  font-family: 'Cinzel', serif;
  color: var(--gold-bright);
  font-size: 1.05em;
  margin-bottom: 0.3em;
}

.card-links span {
  color: var(--text-dim);
  font-size: 0.9em;
}

h1, h2, h3, h4 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}

main > h1:first-child {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5em;
}

h2 {
  margin-top: 1.8em;
  font-size: 1.4em;
}

a {
  color: var(--link);
}

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

table {
  border-collapse: collapse;
  margin: 1.2em 0;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 0.55em 1em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-weight: 500;
  background: var(--bg-raised);
  font-size: 0.85em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(216, 180, 95, 0.05);
}

code, pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: "SF Mono", Consolas, Monaco, monospace;
}

pre {
  padding: 1em;
  overflow-x: auto;
}

code {
  padding: 0.15em 0.45em;
  font-size: 0.9em;
}

pre code {
  border: none;
  padding: 0;
  background: none;
}

blockquote {
  border-left: 3px solid var(--gold);
  margin: 1.2em 0;
  padding: 0.3em 0 0.3em 1.2em;
  color: var(--text-dim);
  font-style: italic;
}

ul, ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.4em;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  background: rgba(216, 180, 95, 0.1);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.6em 1.5em;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--gold-bright);
  text-decoration: none;
  margin-bottom: 1.5em;
  box-shadow: 0 0 24px rgba(216, 180, 95, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-banner:hover {
  color: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(216, 180, 95, 0.28);
}

.status-banner::before {
  content: "";
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: #6fd97f;
  box-shadow: 0 0 8px #6fd97f, 0 0 16px rgba(111, 217, 127, 0.6);
  animation: status-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

.status-banner-idle {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text-dim);
  box-shadow: none;
}

.status-banner-idle::before {
  background: var(--text-dim);
  box-shadow: none;
  animation: none;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.82); }
}

footer {
  text-align: center;
  color: var(--text-dim);
  padding: 3em 2em;
  font-size: 0.85em;
  border-top: 1px solid var(--border);
  margin-top: 2em;
}

footer p {
  margin: 0.4em 0;
}

.footer-social a {
  color: var(--text-dim);
  font-weight: 600;
}

.footer-social a:hover {
  color: var(--gold-bright);
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8em;
    padding: 1em 1.3em;
  }
  main {
    padding: 2em 1.3em 3em;
  }
  .hero h2 {
    font-size: 1.7em;
  }
}

/* Specification page: TOC sidebar + content */

main:has(.spec-layout) {
  max-width: 1150px;
}

.spec-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5em;
  align-items: start;
}

.toc {
  position: sticky;
  top: 5.5em;
  max-height: calc(100vh - 7em);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding-right: 0.5em;
  border-right: 1px solid var(--border);
}

.toc a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85em;
  line-height: 1.4;
  padding: 0.3em 0.6em;
  border-radius: 5px;
  border-left: 2px solid transparent;
}

.toc a.toc-h3 {
  padding-left: 1.4em;
  font-size: 0.8em;
}

.toc a:hover {
  color: var(--text);
  background: var(--bg-card);
}

.toc a.active {
  color: var(--gold-bright);
  background: rgba(216, 180, 95, 0.1);
  border-left-color: var(--gold);
  font-weight: 600;
}

.spec-content {
  min-width: 0;
}

.spec-content h2, .spec-content h3 {
  scroll-margin-top: 5.5em;
}

@media (max-width: 900px) {
  .spec-layout {
    display: block;
  }
  .toc {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1em;
    margin-bottom: 2em;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .toc a.toc-h3 {
    padding-left: 0.6em;
  }
}
