
#updated{
    font-size: .76rem;
    color: var(--muted);
    margin: .45rem 0 0;
    text-align: right;
}

.sidenote,
.marginnote{
    float: right;
    width: var(--margin);
    /* margin-right: calc(-1 * ( (95vw - var(--content)) / 2 )); */
    margin-right: calc(-1 * ((100vi - var(--content)) / 2));
    padding-right: var(--gutter);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    margin-top: .3rem;
    margin-bottom: .6rem;
    font-size: .95rem;
    line-height: 1.35;
    color: var(--note-color);
    background: var(--note-bg);
    box-sizing: border-box;
}

.sidenote,
.marginnote{
    display: block;
    clear: right;
}

.sidenote + .sidenote,
.sidenote + .marginnote,
.marginnote + .sidenote,
.marginnote + .marginnote{
    margin-top: .4rem;
}

.footnote-sidenote::before{
    content: attr(data-fn) " ";
    font-size: 0.85em;
    vertical-align: super;
    margin-right: 0.2rem;
    opacity: 0.85;
}

body{ counter-reset: sidenote-counter; }
.sidenote-number:after{
    counter-increment: sidenote-counter;
    content: counter(sidenote-counter);
    font-size: .85em;
    vertical-align: super;
    margin-left: .15rem;
}

.margin-toggle{
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* #content .figure, */
/* #content .org-src-container, */
/* #content img.fullwidth{ */
/*     //clear: both; */
/* } */

.fullwidth{
    display: block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    height: auto;
    margin: 1.25rem 0 1.75rem;
    width: 100%;
    max-width: min(
	calc(var(--content) + var(--bleed) * 2),
	var(--fullwidth-cap),
	calc(100vw - 2 * var(--body-pad))
    );
}
.figure .fullwidth{ width: inherit; }
.figure figcaption{
    text-align: center; font-size: .95rem; color: #666; margin-top: .4rem;
}


.post-date{
    color: var(--muted);
    font-size: .86em;
    margin-left: 8px;
}

.post-tag{
    float: right;
    display: inline-block;
    background-color: var(--chip-bg);
    color: var(--chip-fg);
    border: 1px solid color-mix(in oklab, var(--border) 78%, transparent);
    border-radius: 999px;
    padding: 0.08rem 0.5rem;
    margin-left: 6px;
    font-size: 0.8em;
    line-height: 1.7;
}

.filetags {
    margin-top: .5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .3rem .4rem;
    font-size: .9rem;
    color: #666;
}
.filetags .tag {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-fg);
    border: 1px solid color-mix(in oklab, var(--border) 78%, transparent);
    line-height: 1.6;
}

.figure figcaption{ color: var(--muted); }
.org-src-container{
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
    background: var(--code-bg);
}

:not(pre) > code{
    border: 1px solid var(--border);
    background-color: var(--code-bg);
    color: var(--fg);
    border-radius: 5px;
    padding: 0.05rem 0.28rem;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--surface-soft) 82%, transparent);
    color: var(--fg);
    min-height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: 7px;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 750;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
    background-color: color-mix(in oklab, var(--accent) 12%, transparent);
    color: var(--heading);
    border-color: color-mix(in oklab, var(--accent) 42%, var(--border));
    outline: 0;
}

.web-logo {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    z-index: 1000;

    width: 10%;

    padding: .25rem;
    border-radius: 6px;

    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}



.sidenote .mn-fig,
.marginnote .mn-fig{
    margin: 0;
}
.sidenote .mn-img,
.marginnote .mn-img{
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border, #d7d7d7);
    border-radius: 6px;
    background: var(--bg);
}
.sidenote .mn-fig figcaption,
.marginnote .mn-fig figcaption{
    margin-top: .35rem;
    font-size: .85rem;
    color: var(--muted, #666);
    line-height: 1.35;
}


.sidenote img {
    margin-top: 0.35rem;
    display: block;
}

.countdown-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1em 0;
  font-family: system-ui, sans-serif;
  font-size: 1.2rem;
  color: var(--fg, #222);
  background: var(--bg-alt, transparent);
  text-align: center;
}

time.countdown {
  font-weight: 600;
  color: var(--accent, #2a7fff);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0.25em 0.6em;
  border-radius: 0.5em;
  background: color-mix(in srgb, var(--accent, #2a7fff) 10%, transparent);
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
  transition: color 0.3s ease, background 0.3s ease;
}

time.countdown.expired {
  color: #999;
  background: none;
  font-weight: 500;
  text-decoration: line-through;
}

/* SEARCH */
#search-input {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font-body);
  font-weight: 450;
  background-color: var(--surface);
  color: var(--fg);
}

/* Button styling */
#search-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  background: color-mix(in oklab, var(--surface-soft) 82%, transparent);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}

/* Focus state */
#search-input:focus,
#search-btn:focus-visible {
  outline: 0;
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 16%, transparent);
}
@media (max-width: 700px) {
  #search-input {
    display: none;
  }

  #search-btn {
    font-size: 1rem;
  }
}
#search-results {
  position: absolute;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-color, #fff);
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  display: none;
  z-index: 9999;
}
.search-result {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.search-result:hover {
  background: var(--accent-bg, #f2f6ff);
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.search-result-preview {
  font-size: 0.75rem;
  color: #666;
}
#search-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10000;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.search-modal-content {
  position: relative;
  max-width: 700px;
  margin: 10vh auto;
  padding: 1.2rem;
  background: var(--bg-color, #fff);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-height: 70vh;
  overflow-y: auto;
}

.search-modal-result {
  padding: 0.8rem;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.search-modal-result:hover {
  background: var(--accent-bg, #f2f6ff);
}

.search-modal-title {
  font-weight: 600;
}

.search-modal-preview {
  font-size: 0.85rem;
  color: #666;
}
mark {
  background: rgba(255, 230, 150, 0.8);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 3px;
}
.search-result {
  cursor: pointer;
  padding: 0.5em 0.75em;
}

.search-result.active {
  background: rgba(0, 0, 0, 0.08);
}

.search-result.active mark {
  background: rgba(255, 230, 150, 0.9);
}


/* Table of contents */
#table-of-contents{
  float: left;
  width: var(--margin);
  /* margin-left: calc(-1 * ( (95vw - var(--content)) / 2 )); */
  margin-left: calc(-1 * ((100vi - var(--content)) / 2));
  padding-left: var(--gutter);
  box-sizing: border-box;

  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6rem);
  overflow: auto;

  font-size: .95rem;
  border-right: 1px solid var(--border, #d7d7d7);
  padding-top: .25rem;
}

#table-of-contents > h2{
  margin: 0 0 .5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--muted, #666);
}

#text-table-of-contents ul{
  list-style: none;
  margin: 0;
  padding-left: 0;
}
#text-table-of-contents li{
  margin: .25rem 0;
}
#text-table-of-contents a{
  text-decoration: none;
}
#text-table-of-contents a:hover{
  text-decoration: underline;
}

#text-table-of-contents ul ul { margin-left: .75rem; opacity: .9; }

h2[id], h3[id], h4[id] { scroll-margin-top: 6.5rem; }

#text-table-of-contents a.is-active{
    /* font-weight: 700; */
    text-decoration: underline;
    background-color: var(--active-toc);
    /* border: 1px solid var(--border, #ccc); */
}
