/* =========================================
   Custom Fonts
========================================= */
@font-face {
  font-family: 'Toolkit';
  src: url('/fonts/toolkit.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Grotesk';
  src: url('/fonts/overusedgrotesk.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/* =========================================
   Global / Body Styles
========================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html body {
  min-height: 100vh;
}

body {
  background: url("/images/castle.png"), linear-gradient(to bottom, #1678b2, #64d2ff) repeat-x;
  background-repeat: repeat-x;
  background-position: bottom;
  color: #ffffff;
  font-family: 'Grotesk', "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  padding-bottom: 200px;
  font-size: 18px;
}

/* Links */
a {
  color: #ffd600;
  text-decoration: underline;
  transition: color 0.2s, text-shadow 0.2s;
}
a:hover {
  color: #fffa80;
  text-shadow: 0 0 5px rgba(255,255,255,0.8);
}

/* Global button */
button, .btn {
  display: inline-block;
  background-color: #28c0ff;
  color: #ffffff;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  font-size: 18px;
  font-family: 'Toolkit';
  text-decoration: none;
}
button:hover, .btn:hover {
  background-color: #00b5ff;
  color: #ffffff;
  text-decoration: none;
  text-shadow: none;
}

.btn-gold {
  background-color: #ffd600;
  color: #1a1a1a;
}
.btn-gold:hover {
  background-color: #fffa80;
  color: #1a1a1a;
}

/* =========================================
   Header (Fixed Nav)
========================================= */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-image: url("/images/tac.png");
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  padding: 2px 0;
  display: flex;
  align-items: center;
  background-repeat: repeat;
  animation: scrollBg 240s linear infinite;
}

@keyframes scrollBg {
  0% { background-position: 0 0; }
  100% { background-position: 100% 1000%; }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.logo-line {
  display: flex;
  align-items: center;
  gap: 5px;
}
.logo-line img {
  max-height: 50px;
}
.logo-line span {
  font-size: 14px;
  opacity: 0.7;
}

/* =========================================
   Navigation
========================================= */
.header-nav {
  display: flex;
  position: static;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.header-nav a {
  display: inline-block;
  color: #ffd600;
  text-decoration: none;
  padding: 4px 16px;
  border-radius: 4px;
  transition: background-color 0.3s, color 0.3s;
}
.header-nav a:hover {
  background-color: #ffd600;
  color: #333;
  text-shadow: none;
}
.header-nav a.active {
  background-color: rgba(255, 214, 0, 0.2);
}

/* =========================================
   Page Wrapper
========================================= */
.page-wrapper {
  margin-top: 60px;
  padding: 20px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: 640px auto;
  grid-gap: 20px;
  grid-template-areas: "main purchase";
  align-items: start;
  justify-items: stretch;
}

.page-wrapper.no-sidebar {
  display: block;
  max-width: 800px;
}

.main-content {
  grid-area: main;
}

/* =========================================
   Purchase Box
========================================= */
.purchase-box {
  background-image: url("/images/rect.png");
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  margin-bottom: 0;
  max-width: 300px;
  font-size: 16px;
  grid-area: purchase;
  position: sticky;
  top: 80px;
}

.purchase-box ul {
  list-style: disc inside;
  margin: 0;
  padding: 0;
  margin-bottom: 10px;
}
.purchase-box li {
  margin-bottom: 0;
}
.purchase-box img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}
.purchase-box h3 {
  text-align: center;
  margin: auto;
}
.support-price {
  display: block;
  text-align: center;
  color: #ffd600;
  font-size: 1.8em;
  line-height: 1.5em;
}

/* =========================================
   Support Subscriptions
========================================= */
.support-subscriptions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
}
.subscription-box {
  background-color: #1678b2;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  box-sizing: border-box;
  flex: 1 1 100%;
  line-height: 1em;
}
.subscription-box ul {
  list-style: disc inside;
  margin: 0;
  padding: 0;
  margin-bottom: 10px;
}

/* =========================================
   Typography
========================================= */
h1, h2, h3, h4 {
  color: #ffffff;
  margin: 0.5em 0;
  line-height: 1.3;
  font-family: 'Toolkit', Helvetica, Arial, sans-serif;
}
h1 { font-size: 3em; }
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.2em; }

p, li {
  color: #ffffff;
  margin-bottom: 1em;
  line-height: 1.4;
}

/* Hero & Sections */
.hero {
  margin-bottom: 40px;
  text-align: left;
}
.hero img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: 20px;
}
.section {
  margin-bottom: 40px;
}

hr {
  border: none;
  border-top: 1px solid #ffd600;
}

/* Code */
code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 214, 0, 0.2);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}

th, td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 214, 0, 0.3);
}

th {
  font-weight: bold;
  border-bottom: 2px solid #ffd600;
  font-family: 'Toolkit';
}

/* =========================================
   Feature Cards
========================================= */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 30px 0;
}

.feature-card {
  background-image: url("/images/rect.png");
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.feature-card h3 {
  margin-top: 0;
  font-size: 1.3em;
  color: #ffd600;
}

.feature-card p {
  font-size: 0.95em;
  line-height: 1.4;
}

/* =========================================
   Architecture Diagram
========================================= */
.arch-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 214, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

/* =========================================
   Footer
========================================= */
.footer-bar {
  text-align: center;
  padding: 20px 0;
  font-size: 14px;
}

/* =========================================
   Changelog
========================================= */
.changelog-entry {
  margin-bottom: 1.5rem;
}
.changelog-header {
  display: flex;
  align-items: baseline;
  font-weight: bold;
  margin-bottom: 0.5rem;
  gap: 10px;
}
.changelog-header .dashed-line {
  flex: 1;
  border: none;
  border-top: 2px dashed #ffd600;
  margin: 0;
}
.changelog-header .date {
  color: #ffd600;
  font-size: 0.9em;
}

/* =========================================
   Blog
========================================= */
.blog-list {
  margin-top: 2em;
}

.blog-entry {
  margin-bottom: 2em;
  padding-bottom: 1.5em;
  border-bottom: 1px solid rgba(255, 214, 0, 0.2);
}

.blog-entry:last-child {
  border-bottom: none;
}

.blog-header {
  display: flex;
  align-items: baseline;
  gap: 15px;
  flex-wrap: wrap;
}

.blog-header h2 {
  margin: 0;
  font-size: 1.4em;
  border-bottom: none;
  padding-bottom: 0;
}

.blog-date {
  color: rgba(255, 214, 0, 0.7);
  font-size: 0.9em;
  white-space: nowrap;
}

.blog-post-header {
  margin-bottom: 1.5em;
}

.blog-post-header h1 {
  margin-bottom: 0.1em;
}

.blog-back {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid rgba(255, 214, 0, 0.2);
}

/* =========================================
   Docs Layout
========================================= */
.docs-wrapper {
  margin-top: 60px;
  padding: 20px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  gap: 30px;
}

.docs-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.docs-sidebar h3 {
  font-size: 1em;
  margin-bottom: 0.5em;
  color: #ffd600;
}

.docs-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1em 0;
}

.docs-sidebar li {
  margin-bottom: 0;
}

.docs-sidebar a {
  display: block;
  padding: 3px 0;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.15s;
}

.docs-sidebar a:hover {
  color: #ffd600;
  text-shadow: none;
}

.docs-sidebar a.active {
  color: #ffd600;
  font-weight: bold;
}

.docs-sidebar .nav-section-title {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 214, 0, 0.6);
  margin-top: 1em;
  margin-bottom: 0.25em;
}

.docs-body {
  flex: 1;
  min-width: 0;
}

.docs-body h1 {
  font-size: 2.2em;
  margin-bottom: 0.5em;
}

.docs-body h2 {
  font-size: 1.5em;
  margin-top: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid rgba(255, 214, 0, 0.3);
}

.docs-body h3 {
  font-size: 1.2em;
  margin-top: 1.5em;
}

.docs-body img {
  max-width: 100%;
  height: auto;
}

/* =========================================
   Hamburger Menu (Hidden on Desktop)
========================================= */
#menu-toggle,
.hamburger {
  display: none;
}
#menu-toggle:checked ~ .header-nav {
  display: flex;
}

/* =========================================
   Mobile Overrides (max-width: 899px)
========================================= */
@media (max-width: 899px) {
  .page-wrapper {
    display: block;
  }

  .purchase-box {
    margin: 0 auto 20px;
    position: static;
  }

  .hero-image {
    display: none;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  /* Hamburger nav */
  .header-nav {
    display: none;
    flex-direction: column;
    padding: 10px;
    position: absolute;
    right: 20px;
    top: 60px;
    background-image: url("/images/rect.png");
    border-radius: 8px;
  }
  #menu-toggle {
    display: none;
  }
  .hamburger {
    display: inline-block;
    cursor: pointer;
    width: 30px;
    height: 24px;
    margin-left: 10px;
  }
  .hamburger span {
    display: block;
    height: 3px;
    margin-bottom: 5px;
    background: #ffd600;
    transition: 0.3s ease;
  }

  /* Docs sidebar */
  .docs-wrapper {
    flex-direction: column;
  }
  .docs-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-bottom: 1px solid rgba(255, 214, 0, 0.3);
    padding-bottom: 15px;
    margin-bottom: 15px;
  }
}
