@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap');

/* Light mode (default) */
:root {
  --font-family-base: 'IBM Plex Sans', sans-serif !important;
  --bg-primary: #f4f4f4;
  --bg-secondary: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #4d4d4d;
  --text-tertiary: #666666;
  --link-color: #1a1a1a;
  --link-hover: #000000;
  --border-color: rgba(0, 0, 0, 0.1);
  --article-bg: #ffffff;
  --header-overlay: rgba(0, 0, 0, 0.6);
}

/* Dark mode */
[data-theme='dark'] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #e4e4e4;
  --text-secondary: #b8b8b8;
  --text-tertiary: #999999;
  --link-color: #e4e4e4;
  --link-hover: #ffffff;
  --border-color: rgba(255, 255, 255, 0.1);
  --article-bg: #2d2d2d;
  --header-overlay: rgba(0, 0, 0, 0.7);
}

/* Apply theme colors */
[data-theme='dark'] body {
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

[data-theme='dark'] .bg-near-white {
  background-color: var(--bg-primary) !important;
}

[data-theme='dark'] main {
  background-color: var(--bg-primary) !important;
}

[data-theme='dark'] article {
  background-color: var(--article-bg);
  border-color: var(--border-color) !important;
}

[data-theme='dark'] .dark-gray {
  color: var(--text-primary) !important;
}

[data-theme='dark'] .mid-gray {
  color: var(--text-secondary) !important;
}

[data-theme='dark'] .link.black,
[data-theme='dark'] a.color-inherit {
  color: var(--link-color) !important;
}

[data-theme='dark'] .link.black:hover,
[data-theme='dark'] a.color-inherit:hover {
  color: var(--link-hover) !important;
}

[data-theme='dark'] .bg-light-gray {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

[data-theme='dark'] .b--moon-gray {
  border-color: var(--border-color) !important;
}

[data-theme='dark'] .bb.b--black-10 {
  border-color: var(--border-color) !important;
}

[data-theme='dark'] footer.bg-black {
  background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 50%, #0d0d0d 100%);
}

[data-theme='dark'] .cover .bg-black-60 {
  background-color: var(--header-overlay) !important;
}

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  line-height: 27px;
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.9);
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  flex-shrink: 0;
  vertical-align: middle;
  position: relative;
  top: -11px;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.9);
  transform: rotate(20deg);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* Add spacing between social icons */
.ananke-socials {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

/* Align social icons properly */
.ananke-social-link {
  margin-bottom: 0 !important;
}

/* Desktop spacing for toggle button */
@media (min-width: 60em) {
  .theme-toggle {
    width: 38px;
    height: 38px;
    line-height: 34px;
    margin-left: 0.3rem;
    top: 0;
  }

  .theme-toggle svg {
    width: 19px;
    height: 19px;
  }

  .ananke-socials {
    gap: 0.5rem;
  }
}

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

[data-theme='dark'] .theme-toggle .sun-icon {
  display: block;
}

[data-theme='dark'] .theme-toggle .moon-icon {
  display: none;
}

/* Dark mode for post cards */
[data-theme='dark'] .bg-white {
  background-color: var(--article-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .near-black,
[data-theme='dark'] h1.near-black,
[data-theme='dark'] h1.near-black a {
  color: var(--text-primary) !important;
}

[data-theme='dark'] .f6,
[data-theme='dark'] .nested-links {
  color: var(--text-secondary) !important;
}

/* Light mode post cards - add subtle definition */
.bg-white {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Fix empty article creating gray bar on homepage */
article.cf.ph3.ph5-l.pv3.pv4-l {
  display: none;
}

/* Homepage post cards - add padding/margins */
article.bb.b--black-10 {
  background-color: var(--article-bg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color) !important;
}

[data-theme='dark'] article.bb.b--black-10 {
  background-color: var(--article-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Default (phones/tablets) */
header.cover {
  background-position: center 5%;
}

/* Desktop 1024+ */
@media (min-width: 1024px) {
  header.cover {
    background-position: center 35%;
  }
}

/* 1440p-ish */
@media (min-width: 1440px) {
  header.cover {
    background-position: center 25%;
  }
}

/* 4K */
@media (min-width: 1920px) {
  header.cover {
    background-position: center 10%;
  }
}
/* 4K */
@media (min-width: 2560px) {
  header.cover {
    background-position: center 90%;
  }
}

/* override bg-black everywhere with a toaster/ toast vibe */
.bg-black {
  background: linear-gradient(180deg, #666666 0%, #4d4d4d 50%, #1a1a1a 100%);
}

/* Dark mode - burnt toast gradient for header/footer */
[data-theme='dark'] .bg-black {
  background: linear-gradient(
    180deg,
    #3d2817 0%,
    #2a1810 50%,
    #1a0f0a 100%
  ) !important;
}

[data-theme='dark'] footer.bg-black {
  background: linear-gradient(
    180deg,
    #2a1810 0%,
    #1a0f0a 50%,
    #0d0805 100%
  ) !important;
}

/* Mobile-friendly spacing for individual post pages */
@media (max-width: 60em) {
  /* Reduce top margin on mobile */
  article header.mt4 {
    margin-top: 1rem !important;
  }

  /* Better mobile padding for post content */
  .nested-copy-line-height.lh-copy.serif {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Adjust heading sizes on mobile */
  article h1.f1 {
    font-size: 2rem !important;
    line-height: 1.2 !important;
  }

  /* Better spacing for post images on mobile */
  .nested-copy-line-height img {
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    display: block;
  }

  /* Adjust paragraph spacing */
  .nested-copy-line-height p {
    margin-bottom: 1rem;
  }

  /* Make post metadata more compact */
  article header aside {
    margin-bottom: 0.5rem !important;
  }
}

/* Improve overall post content readability */
.nested-copy-line-height {
  font-size: 1.125rem;
  line-height: 1.7;
}

/* Better mobile line-height */
@media (max-width: 30em) {
  .nested-copy-line-height {
    font-size: 1rem;
    line-height: 1.6;
  }
}

/* Reduce excessive spacing in post list page hero section */
@media (max-width: 60em) {
  /* Reduce padding on the hero section container */
  header.cover .bg-black-60 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Reduce padding on navigation */
  nav.pv3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  /* Reduce spacing in the title area on post list pages */
  .pb3-m {
    padding-bottom: 1rem !important;
  }

  .pb6-l {
    padding-bottom: 1.5rem !important;
  }

  /* Compact main content top padding */
  main.pb7 {
    padding-top: 0rem !important;
  }
}
