/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap');

:root {
  --primary-color: #0072CE;
  --primary-dark: #005BA1;
  --primary-light: #4AA5FF;
  --accent-color: #FF5E00;
  --text-color: #333333;
  --text-light: #666666;
  --background-color: #FFFFFF;
  --background-alt: #F9FAFC;
  --border-color: #E5E8ED;
  --code-bg: #F5F7FA;
  --code-color: #2D3748;
  --heading-color: #1A202C;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --transition: all 0.3s ease;
  --radius: 8px;
  
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'Fira Code', 'Roboto Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Dark mode variables */
.dark-mode {
  --primary-color: #5c89b6;
  --primary-dark: #3B83D1;
  --primary-light: #7DC1FF;
  --accent-color: #FF7B29;
  --text-color: #E2E8F0;
  --text-light: #A0AEC0;
  --background-color: #1A202C;
  --background-alt: #2D3748;
  --border-color: #4A5568;
  --code-bg: #2D3748;
  --code-color: #F7FAFC;
  --heading-color: #F7FAFC;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Base Styles */
* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--background-alt);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--background-alt);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 20px;
  border: 2px solid var(--background-alt);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--heading-color);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.5px;
  text-align: center;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}

h1.biglogo {
  font-size: 4rem;
  font-weight: 700;
  margin-top: 0.5em;
  margin-bottom: 0.6em;
  letter-spacing: -1px;
}

h2 {
  font-size: 1.75rem;
  letter-spacing: -0.3px;
  margin-top: 2.5em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

h4 {
  font-size: 1.1rem;
}

p, li {
  line-height: 1.7;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Layout Components */
.topbar {
  background-color: var(--background-color);
  height: 4rem;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 12;
  border-bottom: 1px solid var(--border-color);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: var(--shadow);
}

.topbar .logobox {
  width: 2.5rem;
  height: 2.5rem;
  background-size: 2.5rem 2.5rem;
  background-image: url(jspm.png);
  background-repeat: no-repeat;
  margin-right: 0.75rem;
}

.topbar a {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.topbar h1.logo {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--heading-color);
  margin: 0;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.topbar ul.toplinks {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.topbar ul.toplinks li a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem 0;
  position: relative;
}

.topbar ul.toplinks li:not(.github) a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.topbar ul.toplinks li:not(.github) a:hover:after, 
.topbar ul.toplinks li:not(.github) a.active:after {
  width: 100%;
}

.topbar ul.toplinks li.github a {
  background-image: url(github.png);
  width: 1.5rem;
  height: 1.5rem;
  background-size: 1.5rem 1.5rem;
  opacity: 0.8;
}

.topbar ul.toplinks li.github a:hover {
  opacity: 1;
}

.sidebar {
  background-color: var(--background-alt);
  width: 280px;
  position: fixed;
  top: 4rem;
  left: 0;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  bottom: 0;
}

.sidebar .toc {
  position: relative;
  padding: 1.5rem 0;
  min-height: calc(100% - 4rem);
}

.sidebar .toc ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.sidebar .toc ul.sections > li {
  margin: 0 1.5rem 2rem;
}

.sidebar .toc ul.sections > li > a {
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--primary-color);
  display: block;
  margin: 0 0 1rem 0;
}

.sidebar .toc ul li {
  display: block;
}

.sidebar .toc ul.sections > li > ul > li {
  padding: 0.5rem 0;
}

.sidebar .toc ul.sections > li > ul > li > ul > li {
  padding: 0.5rem 0 0.5rem 1rem;
}

.sidebar .toc ul li a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.95rem;
  transition: var(--transition);
  display: block;
}

.sidebar .toc ul li a:hover {
  color: var(--primary-color);
}

.sidebar .toc ul a.active {
  color: var(--primary-color);
  font-weight: 500;
}

.sidebar .toc ul ul a.active {
  position: relative;
}

.sidebar .toc ul ul a.active::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--primary-color);
}

.content-container {
  position: fixed;
  top: 4rem;
  left: 280px;
  overflow: auto;
  width: calc(100% - 280px);
  height: calc(100% - 4rem);
  transition: var(--transition);
  padding: 0 1rem;
}

.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Logo styling */
.content .logobox {
  background-image: url(jspm.png);
  background-repeat: no-repeat;
  background-size: 180px;
  background-position: center;
  width: 180px;
  height: 180px;
  margin: 1rem auto;
}

/* Call to action buttons */
.cta {
  display: inline-block;
  text-align: center;
  padding: 0.75rem 2rem;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 1rem;
}

.cta:hover {
  color: white;
  background-color: var(--primary-color);
  text-decoration: none;
}

.cta:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

.cta.highlighted {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.cta.highlighted:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Button styles */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background-color: var(--background-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

button:hover, .button:hover {
  background-color: var(--primary-light);
  color: white;
  border-color: var(--primary-light);
}

button:focus, .button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.2);
}

/* Form inputs */
input, textarea, select {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 114, 206, 0.2);
}

/* Code blocks */
.content code {
  font-family: var(--font-mono);
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.2em 0.4em;
  border-radius: var(--radius);
  font-size: 0.9em;
}

.content pre {
  background-color: var(--code-bg);
  padding: 1.25rem;
  margin: 2rem 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.75rem;
  color: var(--code-color);
  display: block;
}

/* Code snippet copy button */
.content button.copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--background-color);
  border: 0px solid var(--border-color);
  border-radius: var(--radius);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  background-image: url(clipboard.png);
  background-size: 1rem;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 2;
}

.dark-mode .content button.copy {
  background-color: var(--background-alt);
  border-color: var(--primary-light);
  filter: brightness(1.5);
}

.content pre {
  position: relative;
}

.content pre:hover button.copy {
  opacity: 0.7;
}

.content button.copy:hover {
  opacity: 1 !important;
}

.dark-mode .content button.copy:hover {
  background-color: var(--primary-dark);
}

/* Create wrapper for code blocks to handle scrolling positioning */
.content pre {
  overflow: visible;
  padding-top: 2.5rem;
}

.content pre code {
  display: block;
  overflow-x: auto;
  margin-top: -1.25rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  max-height: 600px;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid var(--primary-light);
  background-color: var(--background-alt);
  margin: 2rem 0;
  padding: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Mobile menu button */
.mobile-menu {
  display: none;
}

/* Next/Previous Navigation */
.content .nextprev {
  margin-top: 4rem;
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content .nextprev a {
  display: inline-block;
  color: var(--text-color);
  font-size: 1rem;
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

.content .nextprev a:hover {
  color: var(--primary-color);
}

.content .nextprev .next {
  margin-left: auto;
}

.content .nextprev .prev {
  margin-right: auto;
}

.content .nextprev .edit-container {
  flex-grow: 0;
  display: flex;
  justify-content: center;
  flex-basis: 100px;
}

.content .nextprev a.edit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.content .nextprev a.edit:before {
  content: '';
  display: inline-block;
  width: 1rem;
  height: 1rem;
  background-image: url(/pencil.png);
  background-size: contain;
  background-repeat: no-repeat;
}

/* Date styling */
span.date {
  font-size: 0.85rem;
  color: var(--text-light);
  display: inline-block;
  margin-bottom: 1rem;
}

/* Blog links */
.blog-link {
  font-size: 0.9em;
  margin-bottom: 0.5rem;
}

.blog-link a {
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
}

.blog-link a:hover {
  color: var(--primary-color);
}

/* Sponsor logos */
.sponsors {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 2rem 0;
}

.sponsor-tier {
  margin-top: 2rem;
  text-align: center;
}

.sponsor-tier-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dark mode toggle */
.theme-toggle {
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: var(--transition);
  margin-right: 1rem;
}

body:not(.dark-mode) .theme-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z' fill='rgba(75,75,75,1)'/%3E%3C/svg%3E");
}

body.dark-mode .theme-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z' fill='rgba(225,225,225,0.9)'/%3E%3C/svg%3E");
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table th {
  background-color: var(--background-alt);
  color: var(--heading-color);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
}

table td {
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
}

/* Syntax highlighting improvements */
code .comment, .cm-s-default .cm-comment, code .comment .keyword, code .comment .string {
  color: #6B7280;
  font-style: italic;
}

code .string, .cm-s-default .cm-string, .cm-s-default .cm-string-2, code .string .comment {
  color: #D97706;
}

code .keyword, .cm-s-default .cm-keyword {
  color: #7C3AED;
  font-weight: 500;
}

/* Dark mode syntax highlighting */
.dark-mode code .comment, .dark-mode .cm-s-default .cm-comment, 
.dark-mode code .comment .keyword, .dark-mode code .comment .string {
  color: #9CA3AF;
  font-style: italic;
}

.dark-mode code .string, .dark-mode .cm-s-default .cm-string, 
.dark-mode .cm-s-default .cm-string-2, .dark-mode code .string .comment {
  color: #F59E0B;
}

.dark-mode code .keyword, .dark-mode .cm-s-default .cm-keyword {
  color: #A78BFA;
  font-weight: 500;
}

/* Fade-in animations removed */

/* Responsive styles */
@media screen and (max-width: 1100px) {
  .content {
    max-width: 700px;
  }
}

@media screen and (max-width: 900px) {
  .topbar {
    padding: 0 1rem;
  }
  
  .content {
    max-width: none;
    padding: 2rem 1rem;
  }
}

@media screen and (max-width: 768px) {
  .topbar ul.toplinks {
    display: none;
  }
  
  .mobile-menu {
    display: block;
    background-image: url(/hamburger.png);
    background-size: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    opacity: 0.8;
    cursor: pointer;
  }
  
  .mobile-menu:hover {
    opacity: 1;
  }
  
  .dark-mode .mobile-menu {
    filter: saturate(0) invert(1) contrast(0.3);
    opacity: 0.9;
  }
  
  .dark-mode .mobile-menu:hover {
    opacity: 1;
  }
  
  .sidebar {
    width: 100%;
    left: -100%;
    transition: all 0.3s ease;
    z-index: 10;
    background-color: var(--background-color);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .content-container {
    left: 0;
    width: 100%;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h1.biglogo {
    font-size: 3rem;
  }
}

@media screen and (max-width: 480px) {
  .topbar {
    height: 3.5rem;
    padding: 0 0.75rem;
  }
  
  .content-container {
    top: 3.5rem;
    height: calc(100% - 3.5rem);
  }
  
  .content {
    padding: 1.5rem 0.75rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h1.biglogo {
    font-size: 2.5rem;
  }
  
  .cta {
    display: block;
    margin-bottom: 1rem;
  }
}

/* Hero section */
.hero-section {
  padding: 2rem 1rem 4rem;
  text-align: center;
  margin-bottom: 2rem;
}

.hero-description {
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--text-light);
  margin: 0 auto 2.5rem;
  max-width: 90%;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-description br {
    display: none;
  }
}

/* Feature cards */
.features-container {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 3rem 0;
}

@media (max-width: 900px) {
  .features-container {
    flex-direction: column;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    align-items: center;
  }
}

.feature-card {
  background-color: var(--background-alt);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  flex: 1;
  max-width: 350px;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.feature-card h3 {
  margin-top: 0;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.feature-card p {
  margin-bottom: 0;
  color: var(--text-color);
}

/* Sponsor section */
.sponsor-section {
  margin-top: 4rem;
}

.sponsor-tier {
  margin-bottom: 3rem;
}

.sponsor-tier-title {
  text-align: center;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sponsors {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 3rem;
}

.sponsors a {
  transition: var(--transition);
  opacity: 0.9;
}

.sponsors a:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* Improve logo visibility in dark mode */
/* For CacheFly - just increase brightness */
.dark-mode .sponsor-tier:nth-of-type(2) .sponsors img {
  filter: brightness(1.1);
}

/* For Bronze and other sponsors - convert to white */
.dark-mode .sponsor-tier:nth-of-type(3) .sponsors img,
.dark-mode .sponsor-tier:nth-of-type(1) .sponsors svg {
  filter: saturate(0) invert(1) contrast(0.3);
}

.dark-mode .topbar ul.toplinks li.github a {
  filter: saturate(0) invert(1) contrast(0.3);
  opacity: 0.9;
}

.dark-mode .topbar ul.toplinks li.github a:hover {
  opacity: 1;
}
