:root {
  --lightBlue: #3d72d7;
  --midBlue: #2855b8;
  --topNavBackground: linear-gradient(#fff, #f4f5f5);
  --topNavBorder: #d0d0d0;
  --topNavShadow: #efefef;
  --searchBorder: #eee;
  color-scheme: light;
}

/* Basic Reset */
* {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  color: #333;
  background: #fff;
}

/* Basic Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  line-height: 1.2;
  font-weight: bold;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin: 1rem 0;
}

/* Links */
a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

ul {
  list-style: disc;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
}

/* Code */
pre, code {
  font-family: monospace;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 0.75rem; /* Big code is overwhelming :( */
}

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

th, td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

/* Forms */
input, button, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* Atkinson Hyperlegible for paragraphs and quotes */
p:not(.dark-hero *),
blockquote:not(.dark-hero *) {
  font-family: 'Atkinson Hyperlegible', sans-serif;
}

/* Blockquote padding */
blockquote {
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Bold code elements */
code {
  /*font-weight: bold;*/ /* Bold code is even more overwhelming :( */
  color: unset;
}

/* Link color - match htmx logo */
a {
  color: var(--midBlue);
}

/* Alert banner */
aside[role="alert"] {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  padding: 1em 1.5em;
  margin: 2em 0;
  border-radius: 4px;
}

aside[role="alert"] strong {
  color: #856404;
}

/* Under construction banner */
.under-construction {
  background: #ffff00;
  border: 8px solid;
  border-image: repeating-linear-gradient(
    45deg,
    #000,
    #000 10px,
    #ffcc00 10px,
    #ffcc00 20px
  ) 8;
  padding: 10px;
  margin-bottom: 1.5rem;
  text-align: center;
  font-family: 'Comic Sans MS', cursive, sans-serif;
}

.under-construction strong {
  color: #000;
}

/* Migration note callout */
.migration-note {
  background: #e7f3ff;
  border: 1px solid #3d72d7;
  border-left: 4px solid #3d72d7;
  padding: 0;
  margin: 2em 0;
  border-radius: 4px;
}

.migration-note summary {
  padding: 1em 1.5em;
  cursor: pointer;
  font-weight: bold;
  color: #1e4e8c;
  user-select: none;
}

.migration-note summary:hover {
  background: #d6e9ff;
}

.migration-note[open] summary {
  border-bottom: 1px solid #3d72d7;
}

.migration-note > *:not(summary) {
  padding: 0 2em;
  line-height: 1.6;
  color: #1a1a1a;
}

.migration-note > *:first-of-type:not(summary) {
  padding-top: 1.25em;
}

.migration-note > *:last-child {
  padding-bottom: 1.5em;
}

.migration-note p {
  margin: 0.75em 0;
}

.migration-note ul, .migration-note ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.migration-note li {
  margin: 0.25em 0;
}

.migration-note strong {
  color: #1e4e8c;
}

.migration-note code {
  background: #d6e9ff;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.migration-note pre {
  background: #d6e9ff;
  border: 1px solid #3d72d7;
  padding: 0.75em;
  margin: 0.75em 0;
  border-radius: 4px;
}

.migration-note pre code {
  background: none;
  padding: 0;
}

/* Dark hero section */
.dark-hero {
  background: url(/img/topo.svg), linear-gradient(#1f1f1f, #2d2d2d);
  background-blend-mode: soft-light;
  height: 240px;
  line-height: 240px;
  text-align: center;
  vertical-align: center;
  color: whitesmoke;
  margin-bottom: 2em;
  box-shadow:
    inset 0px 11px 8px -10px #262626,
    inset 0px -11px 8px -10px #262626;
  border-bottom: 1px solid var(--topNavBorder);
}

.dark-hero .main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  line-height: normal;
}

.dark-hero * {
  opacity: 0;
  transition: all 500ms ease-in;
}

.dark-hero sub {
  display: block;
  position: relative;
  top: 40px;
  left: 150px;
}

.dark-hero.appear * {
  opacity: 1;
}

.dark-hero.appear sub {
  top: 0px;
}

.dark-hero .logo {
  font-size: 100px;
}

.dark-hero .blue {
  color: var(--lightBlue);
}

/* Utilities */
.full-width {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.dark-visible {
  display: none;
}

.hide {
  display: none;
}

.no-mobile {
  display: initial;
}

/* Navigation */
header.site-header {
  background-image: var(--topNavBackground);
  box-shadow: 0px 4px 15px 0px var(--topNavShadow);
  border-bottom: 1px solid var(--topNavBorder);
  width: 100%;
  padding: 0;
  margin: 0;
}

nav {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
}

nav ul {
  display: flex;
  align-items: center;
  margin: 0;
}

nav > ul:first-child {
  flex-shrink: 0;
}

nav > ul:nth-child(2) {
  flex-grow: 1;
  justify-content: flex-end;
}

nav li {
  padding: 0 0.75rem;
}

nav > ul:first-child li {
  padding: 0 0.5rem;
}

nav a:not(.logo) {
  font-weight: bold;
  font-size: 1.1rem;
}

nav form {
  margin-bottom: 0 !important;
  padding-bottom: 0;
}

nav [role=search] {
  margin-bottom: 0 !important;
}

.logo {
  color: inherit;
  text-decoration: none;
  font-size: 28px;
  font-weight: bold;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  margin-right: 0.5rem;
}

.logo b {
  font-weight: inherit;
  color: var(--midBlue);
}

.github-stars {
  display: inline-flex;
  align-items: center;
}

.github-stars span {
  display: inline-flex;
  align-items: center;
}

.search-box {
  width: 10rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--searchBorder);
  border-radius: 6px;
  outline: 0;
  box-shadow: none;
  font-size: 1rem;
}

.search-box::placeholder {
  text-align: left;
}

/* Content container */
.content {
  max-width: 1024px;
  margin: 0 auto;
  padding: 1em;
}

/* Lists - reduce spacing between items */
ul li,
ol li {
  margin-bottom: 0.1rem;
}

/* Anchor links */
.zola-anchor {
  color: inherit;
}

.zola-anchor:hover::after {
  content: " #";
}

/* Contents details styling */
#contents {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5em 1em;
  background: #f9f9f9;
}

#contents summary {
  cursor: pointer;
  user-select: none;
  margin: -0.5em -1em;
  padding: 0.5em 1em;
  border-radius: 6px 6px 0 0;
  font-weight: bold;
}

#contents summary:hover {
  background: #f0f0f0;
}

#contents[open] summary {
  margin-bottom: 0.5em;
  border-bottom: 1px solid #ddd;
}

/* Hamburger menu */
.hamburger {
  display: none;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  padding: 0.4rem;
  margin-left: auto;
  transition: background 0.2s, border-color 0.2s;
  width: 40px;
  height: 40px;
}

.hamburger:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.hamburger svg {
  fill: #333;
  display: block;
  transition: transform 0.2s;
}

.hamburger.flip svg {
  transform: rotate(180deg);
}

/* Mobile styles */
@media (max-width: 45rem) {
  .no-mobile {
    display: none !important;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
  }

  nav > ul:first-child {
    margin: 0;
    padding: 0;
  }

  .hamburger {
    display: block;
  }

  nav ul#nav-menu {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid var(--topNavBorder);
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    flex-direction: column;
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-in-out;
  }

  nav ul#nav-menu.show {
    max-height: 500px;
  }

  nav ul#nav-menu li {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #eee;
  }
}

/* Desktop styles */
@media (min-width: 45em) {
  .github-stars {
    width: 98px;
  }
}
