@font-face {
  font-family: "Libre Baskerville";
  src: url("/fonts/libre-baskerville/LibreBaskerville-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Libre Baskerville";
  src: url("/fonts/libre-baskerville/LibreBaskerville-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ng-bg: #0f1115;
  --ng-surface: #151922;
  --ng-surface-alt: #121620;
  --ng-border: #2b3240;
  --ng-text: #e6e8ee;
  --ng-muted: #a1a8b5;
  --ng-link: #8fb3ff;
  --ng-link-hover: #b8ccff;
  --ng-focus: #4c6fff;
  --ng-focus-rgb: 76, 111, 255;
  --ng-code-bg: #1b2030;
}

html[data-theme="light"] {
  color-scheme: light;
  --ng-bg: #f5f2ec;
  --ng-surface: #ffffff;
  --ng-surface-alt: #ece7df;
  --ng-border: #d6d2c9;
  --ng-text: #1d1b17;
  --ng-muted: #6f6b62;
  --ng-link: #1b4fce;
  --ng-link-hover: #163fa6;
  --ng-focus: #1b4fce;
  --ng-focus-rgb: 27, 79, 206;
  --ng-code-bg: #ebe6dc;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  background: var(--ng-bg);
  color: var(--ng-text);
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  min-height: 100vh;
  padding-top: 70px;
  padding-bottom: 80px;
}

footer.footer {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  z-index: 1030;
}

@media (min-width: 1200px) {
  .container {
    max-width: 960px;
  }
}

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

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

.navbar,
.footer,
.card {
  background: var(--ng-surface) !important;
  color: var(--ng-text);
  border-color: var(--ng-border) !important;
}

.navbar {
  --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28230, 232, 238, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  --bs-navbar-toggler-border-color: rgba(230, 232, 238, 0.35);
}

.navbar .nav-link,
.navbar .navbar-brand {
  color: var(--ng-text) !important;
}

.navbar .nav-link:hover,
.navbar .navbar-brand:hover {
  color: var(--ng-link-hover) !important;
}

.text-muted {
  color: var(--ng-muted) !important;
}

.blog-preview {
  background: var(--ng-surface-alt);
  border-color: var(--ng-border);
  color: var(--ng-text);
}

.form-control,
.form-select {
  background-color: var(--ng-surface-alt);
  color: var(--ng-text);
  border-color: var(--ng-border);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--ng-surface-alt);
  color: var(--ng-text);
  border-color: var(--ng-focus);
  box-shadow: 0 0 0 0.2rem rgba(var(--ng-focus-rgb), 0.2);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.blog-editor {
  display: grid;
  gap: 1rem;
}

.blog-markdown {
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.blog-markdown.blog-markdown-drop {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.blog-preview {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 220px;
  background: var(--ng-surface-alt);
  border-color: var(--ng-border);
  color: var(--ng-text);
}

body .blog-preview {
  background: var(--ng-surface-alt);
  border-color: var(--ng-border);
  color: var(--ng-text);
}

.blog-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.blog-size-label {
  margin-bottom: 0;
}

.blog-size-select {
  width: auto;
  min-width: 140px;
}

.blog-post-body pre {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--ng-code-bg);
}

.blog-post-body code {
  background: var(--ng-code-bg);
  padding: 0.1rem 0.3rem;
  border-radius: 0.25rem;
}

.blog-post-body img,
.blog-preview img {
  max-width: 100%;
  height: auto;
}

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

.landing-hero {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--ng-border);
}

.gallery-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.gallery-card {
  background: var(--ng-surface);
  border: 1px solid var(--ng-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.gallery-image {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--ng-border);
  display: block;
}

.gallery-caption {
  margin-top: 0.5rem;
  color: var(--ng-muted);
}

.gallery-dropzone {
  border: 1px dashed var(--ng-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--ng-surface-alt);
}

.gallery-dropzone-active {
  border-color: var(--ng-focus);
  box-shadow: 0 0 0 0.2rem rgba(var(--ng-focus-rgb), 0.2);
}

.gallery-lightbox-image {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--ng-border);
}

.gallery-lightbox-caption {
  margin-top: 0.75rem;
  color: var(--ng-muted);
  text-align: center;
}

.gallery-caption-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.footer-social {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ng-border);
  border-radius: 999px;
  color: var(--ng-text);
  background: var(--ng-surface);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.footer-social-link:hover {
  border-color: var(--ng-focus);
  transform: translateY(-2px);
  color: var(--ng-text);
}

.footer-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.footer-custom-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.social-icon-preview {
  width: 48px;
  height: 48px;
  display: block;
}

.footer-icon-fetlife {
  color: #d94a4a;
}

.site-logo {
  height: 36px;
  max-width: 160px;
  object-fit: contain;
}

.site-logo-preview {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
}

.card h2.h6,
.card h3.h6 {
  font-size: 1rem;
}

.modal-content {
  background: var(--ng-surface);
  color: var(--ng-text);
  border-color: var(--ng-border);
}

.modal-header,
.modal-footer {
  background: var(--ng-surface);
  border-color: var(--ng-border);
}

.modal-body {
  background: var(--ng-surface);
}

.modal-header .btn-close {
  filter: invert(1) grayscale(100%);
  opacity: 0.75;
}

.modal-header .btn-close:hover {
  opacity: 1;
}

html[data-theme="light"] .modal-header .btn-close {
  filter: none;
  opacity: 0.6;
}

html[data-theme="light"] .modal-header .btn-close:hover {
  opacity: 0.9;
}

html[data-theme="light"] .navbar {
  --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2829, 27, 23, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  --bs-navbar-toggler-border-color: rgba(29, 27, 23, 0.25);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--ng-border);
  border-radius: 999px;
  background: var(--ng-surface-alt);
  color: var(--ng-text);
  padding: 0.35rem;
  width: 36px;
  height: 36px;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1.2;
  position: relative;
}

.theme-toggle:hover {
  border-color: var(--ng-focus);
  color: var(--ng-text);
}

.theme-toggle-slot {
  display: flex;
  align-items: center;
  margin-left: 0.5rem;
}

@media (min-width: 576px) {
  .theme-toggle-slot {
    width: auto;
    margin-left: 0.75rem;
  }
}

.theme-toggle .theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.theme-toggle .theme-icon-light {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-icon-light {
  display: flex;
}

.theme-toggle[aria-pressed="true"] .theme-icon-dark {
  display: none;
}

@media (max-width: 575.98px) {
  .navbar-collapse .navbar-nav:last-of-type {
    position: relative;
    padding-right: 3rem;
  }

  .navbar-collapse .navbar-nav:last-of-type .theme-toggle-slot {
    position: absolute;
    right: 0.75rem;
    top: 0;
    height: 100%;
    margin: 0;
  }

  .navbar-collapse .navbar-nav:last-of-type .nav-link,
  .navbar-collapse .navbar-nav:last-of-type .btn {
    padding-right: 3rem;
  }
}

@media (min-width: 992px) {
  .blog-editor {
    grid-template-columns: 1fr 1fr;
  }

  .blog-editor > .mb-3:nth-of-type(1),
  .blog-editor > .mb-3:nth-of-type(2) {
    grid-column: 1 / 2;
  }

  .blog-editor > .mb-3:nth-of-type(3) {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
  }

  .blog-editor > .d-flex {
    grid-column: 1 / 3;
  }
}
