/* Custom styles to match sahermØhamed aesthetic */
body {
  background-color: #0a0a0a;
}

.cursor-tracker {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
}

.cursor-tracker.is-visible {
  opacity: 1;
}

.cursor-tracker-axis {
  position: absolute;
  display: block;
  background: rgba(248, 250, 252, 0.05);
  will-change: transform;
  transition: transform 170ms linear;
}

.cursor-tracker-x {
  top: 0;
  left: 0;
  width: 100vw;
  height: 1px;
  transform: translate3d(0, var(--cursor-y, 0), 0);
}

.cursor-tracker-y {
  top: 0;
  left: 0;
  width: 1px;
  height: 100vh;
  transform: translate3d(var(--cursor-x, 0), 0, 0);
}

html:not(.dark) .cursor-tracker-axis {
  background: rgba(15, 23, 42, 0.09);
}

@media (pointer: coarse) {
  .cursor-tracker {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-tracker {
    transition: none;
  }
}

.site-navbar {
  background-color: rgba(10, 10, 10, 0.88);
  border-bottom: 3px solid #fafafa;
}

.reading-progress {
  position: fixed;
  top: 4rem;
  left: 0;
  z-index: 54;
  width: 100%;
  height: 3px;
  background: rgba(127, 127, 127, 0.18);
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #D90000;
  transition: width 100ms linear;
}

@media (prefers-reduced-motion: reduce) {
  .reading-progress span {
    transition: none;
  }
}

html:not(.dark) {
  color-scheme: light;
}

html:not(.dark) body {
  background-color: #f8fafc !important;
  color: #1f2937 !important;
}

html:not(.dark) header {
  background-color: rgba(255, 255, 255, 0.94) !important;
  border-color: #d1d5db !important;
}

html:not(.dark) header.site-navbar {
  background-color: rgba(255, 255, 255, 0.88) !important;
  border-bottom-color: #D90000 !important;
}

html:not(.dark) footer {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html:not(.dark) .bg-dark-900 {
  background-color: #f8fafc !important;
}

html:not(.dark) .bg-dark-800 {
  background-color: #f1f5f9 !important;
}

html:not(.dark) .bg-dark-700 {
  background-color: #fff !important;
}

html:not(.dark) .bg-dark-600 {
  background-color: #e2e8f0 !important;
}

html:not(.dark) .bg-dark-500 {
  background-color: #cbd5e1 !important;
}

html:not(.dark) [class~="hover:bg-dark-700"]:hover,
html:not(.dark) [class~="hover:bg-dark-600"]:hover {
  background-color: #e2e8f0 !important;
}

html:not(.dark) .border-dark-600,
html:not(.dark) .divide-dark-600> :not([hidden])~ :not([hidden]) {
  border-color: #cbd5e1 !important;
}

html:not(.dark) .border-dark-500 {
  border-color: #cbd5e1 !important;
}

html:not(.dark) .text-white {
  color: #172033 !important;
}

html:not(.dark) .featured-overlay-content .text-white {
  color: #f8fafc !important;
}

html:not(.dark) .text-gray-100 {
  color: #1f2937 !important;
}

html:not(.dark) .text-gray-200 {
  color: #334155 !important;
}

html:not(.dark) .text-gray-300 {
  color: #475569 !important;
}

html:not(.dark) .featured-overlay-content .text-gray-300,
html:not(.dark) .featured-overlay-content .text-gray-400 {
  color: #e2e8f0 !important;
}

html:not(.dark) .text-gray-400 {
  color: #475569 !important;
}

html:not(.dark) .text-gray-500,
html:not(.dark) .text-gray-600 {
  color: #64748b !important;
}

html:not(.dark) .bg-red-600.text-white,
html:not(.dark) .bg-red-500.text-white,
html:not(.dark) .bg-indigo-600.text-white,
html:not(.dark) .bg-indigo-500.text-white,
html:not(.dark) .badge.text-white {
  color: #fff !important;
}

html:not(.dark) .prose-custom {
  color: #334155;
}

html:not(.dark) .prose-custom h1,
html:not(.dark) .prose-custom h2,
html:not(.dark) .prose-custom h3,
html:not(.dark) .prose-custom h4 {
  color: #172033;
}

html:not(.dark) .prose-custom h2 {
  border-color: #cbd5e1;
}

html:not(.dark) .prose-custom blockquote {
  color: #475569;
}

html:not(.dark) .prose-custom :not(pre)>code {
  background: #e2e8f0;
  color: #D90000;
}

html:not(.dark) .prose-custom pre {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

html:not(.dark) .prose-custom th {
  background: #e2e8f0;
}

html:not(.dark) .prose-custom th,
html:not(.dark) .prose-custom td {
  border-color: #cbd5e1;
}

.category-menu {
  display: none;
}

details[open]>.category-menu {
  display: block;
}

summary::-webkit-details-marker {
  display: none;
}

/* Card hover effects */
.home-featured-card {
  background: #111;
}

.home-featured-content {
  background: #111;
}

html:not(.dark) .home-featured-content {
  background: #fff;
}

@media (min-width: 768px) {
  .home-featured-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(180deg, transparent 16%, rgba(5, 7, 12, 0.28) 48%, rgba(5, 7, 12, 0.94) 100%);
  }

  html:not(.dark) .home-featured-content {
    background: linear-gradient(180deg, transparent 16%, rgba(5, 7, 12, 0.28) 48%, rgba(5, 7, 12, 0.94) 100%);
  }
}

@media (max-width: 767px) {
  html:not(.dark) .home-featured-content h2.text-white {
    color: #172033 !important;
  }

  html:not(.dark) .home-featured-content p,
  html:not(.dark) .home-featured-content .text-gray-300,
  html:not(.dark) .home-featured-content .text-gray-400 {
    color: #475569 !important;
  }
}

.post-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.post-card:focus-within {
  outline: 2px solid #D90000;
  outline-offset: 3px;
}

/* Category pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  line-height: 1.25;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 7, 12, 0.72);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.confirm-modal.is-open {
  opacity: 1;
  visibility: visible;
}
.confirm-dialog {
  width: min(100%, 27rem);
  overflow: hidden;
  background: #111315;
  border: 1px solid #34383d;
  border-radius: 0.75rem;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  transform: translateY(18px) scale(0.97);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease;
}
.confirm-modal.is-open .confirm-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.confirm-dialog-accent {
  height: 3px;
  background: linear-gradient(90deg, #ef4444, #991b1b 72%, #25282c);
}
.confirm-dialog-header {
  padding: 1.4rem 1.4rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}
.confirm-dialog-symbol {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 0.65rem;
  background: rgba(127, 29, 29, 0.25);
  color: #f87171;
}
.confirm-dialog-symbol .material-icons {
  font-size: 1.4rem;
}
.confirm-dialog-heading {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
}
.confirm-dialog-heading h2 {
  margin: 0;
  color: #f9fafb;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}
.confirm-dialog-heading p {
  margin: 0.3rem 0 0;
  color: #9ca3af;
  font-size: 0.8rem;
  line-height: 1.4;
}
.confirm-dialog-dismiss {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: #9ca3af;
}
.confirm-dialog-dismiss:hover {
  background: #25282c;
  color: #f9fafb;
}
.confirm-dialog-dismiss .material-icons {
  font-size: 1.2rem;
}
.confirm-dialog-body {
  padding: 1rem 1.4rem 1.35rem 5.05rem;
  color: #d1d5db;
  font-size: 0.9rem;
  line-height: 1.65;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.4rem 1.2rem;
  border-top: 1px solid #292d31;
  background: #0d0f11;
}
.confirm-dialog .confirm-close,
.confirm-dialog .confirm-accept {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.4rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.confirm-dialog .confirm-close:focus-visible,
.confirm-dialog .confirm-accept:focus-visible,
.confirm-dialog .confirm-dialog-dismiss:focus-visible {
  outline: 2px solid #f87171;
  outline-offset: 2px;
}
.confirm-dialog .confirm-close {
  background: #1b1e21;
  border: 1px solid #3c4248;
  color: #e5e7eb;
}
.confirm-dialog .confirm-close:hover {
  background: #282d32;
  border-color: #555d65;
}
.confirm-dialog .confirm-accept {
  background: #c81e1e;
  color: #fff;
  border: 1px solid #ef4444;
}
.confirm-dialog .confirm-accept:hover {
  background: #e02424;
  border-color: #f87171;
}
.confirm-dialog .confirm-accept:hover {
  transform: translateY(-1px);
}

.certificate-image-trigger {
  cursor: zoom-in;
  transition: border-color 140ms ease, transform 140ms ease;
}
.certificate-image-trigger:hover {
  border-color: #ef4444;
  transform: scale(1.04);
}
.certificate-image-trigger:focus-visible,
.certificate-viewer-close:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 3px;
}
.certificate-viewer {
  width: min(96vw, 72rem);
  max-width: none;
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid #3a3e44;
  border-radius: 0.75rem;
  background: #0b0d10;
  color: #f3f4f6;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65);
}
.certificate-viewer::backdrop {
  background: rgba(3, 7, 12, 0.82);
  backdrop-filter: blur(5px);
}
.certificate-viewer-panel {
  display: grid;
  max-height: 92vh;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem;
}
.certificate-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.certificate-viewer-toolbar h2 {
  overflow: hidden;
  color: #f3f4f6;
  font-size: 0.95rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.certificate-viewer-close {
  flex: 0 0 auto;
  border: 1px solid #3a3e44;
  border-radius: 0.4rem;
  background: #191c20;
  padding: 0.45rem 0.7rem;
  color: #e5e7eb;
  font-size: 0.8rem;
  font-weight: 600;
}
.certificate-viewer-close:hover {
  background: #292d32;
}
.certificate-viewer img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 4.5rem);
  object-fit: contain;
}

@media (max-width: 28rem) {
  .confirm-dialog-header {
    padding: 1.1rem 1rem 0;
    gap: 0.7rem;
  }
  .confirm-dialog-body {
    padding: 0.9rem 1rem 1.1rem;
  }
  .confirm-dialog-actions {
    padding: 0.8rem 1rem 1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .confirm-modal,
  .confirm-dialog {
    transition: none;
  }
}

/* Markdown content styling */
.prose-custom {
  color: #d1d5db;
  line-height: 1.75;
}

.prose-custom h1,
.prose-custom h2,
.prose-custom h3,
.prose-custom h4 {
  color: #f3f4f6;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.75em;
}

.prose-custom h2,
.prose-custom h3,
.prose-custom h4 {
  scroll-margin-top: 6rem;
}

.prose-custom h1 {
  font-size: 1.875rem;
}

.prose-custom h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #222;
  padding-bottom: 0.3em;
}

.prose-custom h3 {
  font-size: 1.25rem;
}

.prose-custom p {
  margin-bottom: 1.25em;
}

.prose-custom a {
  color: #D90000;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose-custom a:hover {
  color: #D90000;
}

.prose-custom ul,
.prose-custom ol {
  margin-bottom: 1.25em;
  padding-left: 1.5em;
}

.prose-custom li {
  margin-bottom: 0.4em;
}

.prose-custom blockquote {
  border-left: 3px solid #D90000;
  padding-left: 1em;
  margin: 1.5em 0;
  color: #9ca3af;
  font-style: italic;
}

.prose-custom :not(pre)>code {
  background: #1a1a1a;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.875em;
  color: #ffe70a;
}

.prose-custom pre {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow-x: auto;
  margin: 0;
}

.prose-custom pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
}

.code-snippet {
  position: relative;
  margin: 1.5em 0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: transparent;
}

.code-snippet pre {
  margin: 0;
}

.code-snippet pre code.hljs {
  display: block;
  background: transparent;
  padding: 1rem 1rem 1rem 1.05rem;
  min-height: 3.5rem;
  border-radius: 0.75rem;
}

.code-copy-button {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 1;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 0.35rem;
  background: rgba(15, 23, 42, 0.75);
  color: #f3f4f6;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.25rem;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.code-copy-button:hover {
  background: rgba(30, 41, 59, 0.9);
  transform: translateY(-1px);
}

html:not(.dark) .code-copy-button {
  border-color: rgba(148, 163, 184, 0.7);
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
}

html:not(.dark) .code-copy-button:hover {
  background: rgba(226, 232, 240, 0.95);
}

@media (prefers-reduced-motion: reduce) {
  .code-copy-button {
    transition: none;
  }

  .code-copy-button:hover {
    transform: none;
  }
}

.prose-custom img {
  border-radius: 0.5rem;
  margin: 1.5em 0;
  max-width: 100%;
}

.prose-custom table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

.prose-custom th,
.prose-custom td {
  border: 1px solid #333;
  padding: 0.5em 0.75em;
  text-align: left;
}

.prose-custom th {
  background: #1a1a1a;
}

/* TOC */
.toc a {
  color: #9ca3af;
  transition: color 0.15s;
}

.toc a:hover {
  color: #D90000;
}

.toc-sidebar[hidden] {
  display: none;
}

.post-sidebar {
  align-self: start;
}

@media (min-width: 1024px) {
  .post-sidebar {
    position: sticky;
    top: 5.5rem;
    z-index: 10;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.toc-sidebar-panel {
  max-height: none;
  overflow: visible;
}

.toc-sidebar-link {
  display: block;
  border-left: 2px solid transparent;
  padding: 0.25rem 0 0.25rem 0.65rem;
  color: #9ca3af;
  line-height: 1.45;
  transition: color 140ms ease, border-color 140ms ease;
}

.toc-sidebar-subheading {
  margin-left: 0.65rem;
  font-size: 0.82rem;
}

.toc-sidebar-link:hover,
.toc-sidebar-link.is-active {
  border-left-color: #ef4444;
  color: #f87171;
}

html:not(.dark) .toc-sidebar-link {
  color: #64748b;
}

html:not(.dark) .toc-sidebar-link:hover,
html:not(.dark) .toc-sidebar-link.is-active {
  color: #b91c1c;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #111;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Admin specific */
.admin-sidebar a.active {
  background: #1a1a1a;
  color: #fff;
  border-left: 3px solid #D90000;
}

:is([class~="text-red-200"], [class~="text-red-300"], [class~="text-red-400"], [class~="text-red-500"], [class~="text-red-600"], [class~="text-red-700"], [class~="text-red-800"], [class~="text-red-900"]) {
  color: #D90000 !important;
}

:is([class~="hover:text-red-300"], [class~="hover:text-red-400"], [class~="hover:text-red-500"], [class~="hover:text-red-600"]):hover {
  color: #D90000 !important;
}

:is([class~="bg-red-500"], [class~="bg-red-600"], [class~="bg-red-700"], [class~="bg-red-900/40"], [class~="bg-red-900/50"], [class~="bg-red-950/50"], [class~="hover:bg-red-500"]:hover) {
  background-color: #D90000 !important;
}

:is([class~="border-red-400"], [class~="border-red-500"], [class~="border-red-500/60"], [class~="border-red-700"], [class~="border-red-900"], [class~="hover:border-red-400"]:hover) {
  border-color: #D90000 !important;
}

:is([class~="focus:border-red-500"]:focus) {
  border-color: #D90000 !important;
}

:is([class~="ring-red-500"], [class~="focus:ring-red-500"]:focus) {
  --tw-ring-color: #D90000 !important;
}

:is([class~="outline-red-400"], [class~="outline-red-500"], [class~="focus-visible:outline-red-400"]:focus-visible, [class~="focus-visible:outline-red-500"]:focus-visible) {
  outline-color: #D90000 !important;
}