/* Warm reading theme overrides inspired by cegar_reading_notes.html. */
:root {
  --warm-bg-start: #f7f3ea;
  --warm-bg-end: #efe7db;
  --warm-paper: #fffdf8;
  --warm-paper-soft: #fff9ef;
  --warm-ink: #25211d;
  --warm-heading: #2b221b;
  --warm-muted: #6d6258;
  --warm-line: #e5d8c8;
  --warm-line-strong: #dfceb9;
  --warm-shadow: rgba(89, 68, 42, .12);
  --warm-blue: #007bff;
}

html {
  background: var(--warm-bg-end);
}

body {
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 247, 232, .95) 0, rgba(255, 253, 248, .55) 28rem, transparent 48rem),
    linear-gradient(135deg, var(--warm-bg-start) 0%, var(--warm-bg-end) 100%);
  color: var(--warm-ink);
}

footer {
  background: transparent;
}

.clustrmaps-block,
.clustrmaps {
  background: transparent;
}

.clustrmaps iframe,
.clustrmaps img,
.clustrmaps canvas,
.clustrmaps svg {
  background-color: transparent;
}

.menu {
  background: rgba(255, 253, 248, .78);
  box-shadow: 0 10px 36px rgba(89, 68, 42, .10);
  backdrop-filter: blur(14px);
}

.menu a,
.pagination a,
.article-meta a {
  color: #3b332b;
}

.menu a:hover,
.menu .active,
.summary::first-letter,
.footer a:hover,
.terms a:hover,
.bg-number {
  background: var(--warm-blue);
  color: #fff;
}

.footer,
.footer a,
.article-meta .date,
.article-meta .author,
.image-caption,
.table-figure figcaption,
.tikz-caption {
  color: var(--warm-muted);
}

.single main,
.single .appendix {
  background: transparent;
  box-shadow: none;
}

.single main {
  padding: 0;
}

#TOC.side {
  background: transparent;
  box-shadow: none;
}

.single .appendix .side {
  background: transparent;
}

.single .article .side,
.single .article .side.footnotes,
.single .article .temp-sidenote {
  background: transparent;
}

.single .article .side.footnotes {
  color: var(--warm-muted);
}

.single .article .side.footnotes .bg-number {
  background: var(--warm-blue);
  color: #fff;
}

.single .appendix > div {
  background: rgba(255, 249, 239, .38);
  border-radius: 18px;
  padding: 1rem;
}

.single .article-meta {
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  padding: clamp(2rem, 6vw, 3rem);
  border: 1px solid var(--warm-line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 15% 15%, #fff7e8 0, #fffdf8 35%, #fbf7ef 100%);
  box-shadow: 0 24px 80px var(--warm-shadow);
  color: var(--warm-heading);
}

.single .article-meta::before {
  content: "";
  position: absolute;
  inset: -35% -10% auto auto;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 237, 194, .85) 0, rgba(255, 237, 194, .28) 42%, transparent 70%);
  pointer-events: none;
}

.single .article-meta > * {
  position: relative;
}

.single .article-meta h1 {
  margin: .35rem 0 .9rem;
}

.single .article-meta .title {
  color: var(--warm-heading);
  font-size: clamp(2rem, 6vw, 2.7rem);
  line-height: 1.15;
}

.single .article-meta h3 {
  margin: .4rem 0;
}

.single .article-meta .terms {
  margin: 1.2rem 0 0;
}

.list .article-list.home-announcement {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--warm-line);
  border-radius: 10px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 247, 232, .95) 0, rgba(255, 253, 248, .68) 38%, rgba(251, 247, 239, .92) 100%);
  box-shadow: 0 18px 56px rgba(89, 68, 42, .10);
}

.list .article-list.home-announcement::before {
  content: "";
  position: absolute;
  inset: -46% -16% auto auto;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 237, 194, .74) 0, rgba(255, 237, 194, .24) 44%, transparent 72%);
  pointer-events: none;
}

.list .article-list.home-announcement > div {
  position: relative;
  z-index: 1;
  color: var(--warm-muted);
}

.list .article-list.home-announcement p {
  margin: 0;
}

.list .article-list.post-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.15rem, 3vw, 1.45rem);
  border: 1px solid var(--warm-line);
  border-radius: 24px;
  background:
    radial-gradient(circle at var(--card-glow-position, 16% 14%), rgba(255, 247, 232, .95) 0, rgba(255, 253, 248, .72) 38%, rgba(251, 247, 239, .92) 100%);
  box-shadow: 0 18px 56px rgba(89, 68, 42, .10);
  color: var(--warm-ink);
}

.list .article-list.post-card::before {
  content: "";
  position: absolute;
  inset: var(--card-glow-inset, -42% -22% auto auto);
  width: 17rem;
  height: 17rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 237, 194, .76) 0, rgba(255, 237, 194, .24) 44%, transparent 72%);
  pointer-events: none;
}

.list .article-list.post-card > table {
  position: relative;
  z-index: 1;
}

.list .post-card h1 {
  margin: .28rem 0 .7rem;
  border-bottom: 1px solid var(--warm-line);
}

.list .post-card h1 a {
  color: var(--warm-heading);
}

.list .post-card h1 a:hover,
.list .post-card .more {
  color: var(--warm-blue);
}

.list .post-card .categories a {
  border: 1px solid var(--warm-line-strong);
  background: rgba(255, 249, 239, .76);
  color: #5e4938;
}

.list .post-card td > div:not(.summary):not(.categories) {
  color: var(--warm-muted);
}

.list .post-card .summary {
  color: var(--warm-ink);
}

.list .post-card .more {
  display: inline-block;
  margin-top: .35rem;
  font-weight: 600;
}

.list .post-card .spacer-right {
  border-right-color: var(--warm-line-strong);
}

.list .post-card .side-title h1 {
  border: 0;
}

.list .post-card .side-title h1 a {
  color: var(--warm-muted);
}

.terms a {
  border-color: var(--warm-line-strong);
  background: rgba(255, 249, 239, .72);
  color: #5e4938;
}

.single .article {
  font-size: 1.02rem;
  line-height: 1.72;
}

.single .article h1,
.single .article h2,
.single .article h3 {
  color: var(--warm-heading);
}

.single .article h2 {
  border-bottom-color: var(--warm-line);
}

.single .article code:not(pre code) {
  background: #f5eadc;
  border-radius: 6px;
  color: #2c2723;
  padding: 2px 6px;
}

.codebox,
.alert,
.callout,
.image-wrap,
.table-figure table {
  background-color: var(--warm-paper);
  border-color: var(--warm-line);
}

.tikz-source,
.tikz-figure svg {
  background: transparent;
}

.article tbody tr:nth-child(odd),
blockquote {
  background: rgba(255, 249, 239, .62);
}

table {
  border-color: #8d7966;
}

table thead th {
  border-bottom-color: var(--warm-line-strong);
}

@media (max-width: 800px) {
  .single .article-meta {
    border-radius: 22px;
    padding: 1.6rem 1.35rem;
  }

  body:not(.pagesjs) #TOC,
  #TOC {
    position: relative;
    border: 0;
    border-radius: 0;
    padding: 1.1rem 0;
    margin: 1.6rem 0 2rem;
  }

  body:not(.pagesjs) #TOC::before,
  body:not(.pagesjs) #TOC::after,
  #TOC::before,
  #TOC::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background:
      linear-gradient(
        to right,
        transparent,
        rgba(183, 131, 76, .28) 12%,
        rgba(123, 79, 44, .42) 50%,
        rgba(183, 131, 76, .28) 88%,
        transparent
      );
  }

  body:not(.pagesjs) #TOC::before,
  #TOC::before {
    top: 0;
  }

  body:not(.pagesjs) #TOC::after,
  #TOC::after {
    bottom: 0;
  }
}

@media (min-width: 1264.02px) {
  #TOC.side {
    position: sticky;
  }

  .single .article .note-ref:hover + .side {
    background-color: rgba(255, 249, 239, .88);
    border: 1px solid var(--warm-line);
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(89, 68, 42, .10);
  }

  .single .article .side.side-left.overlaps-toc:not(#TOC) {
    background-color: rgba(255, 249, 239, .25);
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(89, 68, 42, .10);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
  }

  #TOC.side::after {
    content: "";
    position: absolute;
    top: .2rem;
    right: -.45rem;
    width: 1px;
    height: calc(100% - .4rem);
    background:
      linear-gradient(
        to bottom,
        transparent,
        rgba(183, 131, 76, .28) 12%,
        rgba(123, 79, 44, .42) 50%,
        rgba(183, 131, 76, .28) 88%,
        transparent
      );
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 14% 8%, rgba(255, 247, 232, .95) 0, rgba(255, 253, 248, .55) 28rem, transparent 48rem),
      linear-gradient(135deg, var(--warm-bg-start) 0%, var(--warm-bg-end) 100%);
    color: var(--warm-ink);
    filter: none;
  }

  img {
    filter: none;
  }

  .article-list,
  .codebox,
  .image-wrap {
    box-shadow: 0 10px 30px rgba(89, 68, 42, .10);
  }
}
