:root {
  --stygia-ink: #17191d;
  --stygia-charcoal: #242932;
  --stygia-ivory: #f3efe6;
  --stygia-parchment: #ebe4d6;
  --stygia-crimson: #8f2638;
  --stygia-gold: #c8a66a;
  --stygia-reader-scale: 1;
  --stygia-scroll-depth: 0;
}

body {
  background: var(--stygia-ivory);
  color: var(--stygia-ink);
  font-size: calc(1rem * var(--stygia-reader-scale));
}

.md-header,
.md-tabs {
  background: var(--stygia-charcoal);
}

.md-header__title {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.md-main {
  position: relative;
  background: transparent;
}

.stygia-landing body::before,
.stygia-reading-page body::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 0;
  background: linear-gradient(rgba(16, 18, 22, calc(var(--stygia-scroll-depth) * 0.62)), rgba(16, 18, 22, calc(var(--stygia-scroll-depth) * 0.62))), url("../hero/stygia-hero-architectural.png") center / cover no-repeat;
  filter: saturate(0.82);
  transform: none;
}

.stygia-reading-page body::before {
  opacity: 0.72;
}

.stygia-landing .stygia-hero-image {
  display: none;
}

.md-sidebar--secondary {
  display: none !important;
}

.md-content__inner {
  max-width: 76rem;
}

.md-content,
.md-sidebar {
  position: relative;
}

.md-content__inner {
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--stygia-ivory) 91%, transparent);
  border-inline: 1px solid rgba(200, 166, 106, 0.24);
}

.stygia-landing .md-content__inner {
  background: color-mix(in srgb, var(--stygia-ivory) 78%, transparent);
}

.md-sidebar {
  background: rgba(23, 25, 29, 0.86);
  backdrop-filter: blur(8px);
}

.stygia-reader-controls {
  position: fixed;
  z-index: 20;
  top: 0.7rem;
  right: 1rem;
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid rgba(200, 166, 106, 0.5);
  border-radius: 999px;
  background: rgba(23, 25, 29, 0.86);
  box-shadow: 0 0.4rem 1.5rem rgba(0, 0, 0, 0.22);
}

.stygia-reader-controls button {
  min-width: 2rem;
  border: 0;
  border-radius: 999px;
  color: var(--stygia-ivory);
  background: transparent;
  cursor: pointer;
}

.stygia-reader-controls button:hover,
.stygia-reader-controls button:focus-visible { background: var(--stygia-crimson); }

.stygia-book-nav {
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 1.5rem);
  margin: 0 auto 1.5rem;
  padding: 0.5rem;
  border-block: 1px solid rgba(200, 166, 106, 0.35);
}

.stygia-book-nav a {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  min-width: 4.3rem;
  color: var(--stygia-crimson);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.stygia-book-nav img {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  opacity: 0.72;
  object-fit: cover;
}

.stygia-book-nav .is-current img {
  width: 3.7rem;
  height: 3.7rem;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--stygia-gold);
}

[data-theme="dark"] body { background: #17191d; color: #f3efe6; }
[data-theme="dark"] .md-content__inner { background: rgba(23, 25, 29, 0.9); }
[data-theme="light"] body { background: #f3efe6; color: #17191d; }
[data-palette="crimson"] { --stygia-crimson: #b04457; --stygia-gold: #d6a779; }
}

.md-content__inner {
  max-width: 58rem;
}

.md-content h1,
.md-content h2,
.md-content h3 {
  color: var(--stygia-charcoal);
  letter-spacing: 0.015em;
}

.md-content h1 {
  border-bottom: 2px solid var(--stygia-crimson);
  padding-bottom: 0.45rem;
}

.md-content a {
  color: var(--stygia-crimson);
}

.md-typeset table:not([class]) th {
  background: var(--stygia-charcoal);
  color: var(--stygia-ivory);
}

.md-typeset table:not([class]) tr:nth-child(2n) {
  background: rgba(200, 166, 106, 0.1);
}

.md-typeset .admonition,
.md-typeset details {
  border-left-color: var(--stygia-crimson);
  background: rgba(255, 255, 255, 0.45);
}

.stygia-mark {
  display: block;
  max-width: 8rem;
  margin: 0 auto 1.5rem;
}

.stygia-hero-image {
  display: block;
  width: 100%;
  max-height: 32rem;
  margin: -1rem 0 1.5rem;
  object-fit: cover;
  opacity: 0.82;
  border: 1px solid rgba(200, 166, 106, 0.45);
}

.book-cover-image {
  display: block;
  width: min(100%, 30rem);
  max-height: 42rem;
  margin: 0 auto 2rem;
  object-fit: contain;
  border: 1px solid rgba(200, 166, 106, 0.45);
  box-shadow: 0 0.8rem 2rem rgba(23, 25, 29, 0.22);
}

.md-typeset table img {
  display: block;
  width: 8rem;
  max-width: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.stygia-draft-banner {
  border: 1px solid var(--stygia-gold);
  border-left: 0.35rem solid var(--stygia-crimson);
  background: var(--stygia-parchment);
  padding: 0.8rem 1rem;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.stygia-coming-soon-page .md-header,
.stygia-coming-soon-page .md-tabs,
.stygia-coming-soon-page .md-sidebar,
.stygia-coming-soon-page .md-footer,
.stygia-coming-soon-page .md-top,
.stygia-coming-soon-page .md-content__button {
  display: none;
}

.stygia-coming-soon-page .md-main {
  min-height: 100vh;
  background: var(--stygia-charcoal);
}

.stygia-coming-soon-page .md-content__inner {
  display: grid;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0;
  place-items: center;
}

.stygia-coming-soon-page .md-content h1 {
  color: var(--stygia-ivory);
  border-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 3.5rem);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  :root {
    --stygia-ivory: #1a1d22;
    --stygia-parchment: #292d34;
    --stygia-ink: #f3efe6;
  }
}

@media (max-width: 34rem) {
  .md-typeset table img {
    width: 5rem;
  }

  .stygia-reader-controls { top: 0.45rem; right: 0.45rem; }
  .md-content__inner { padding-inline: 0.9rem; }
}
