/* ==========================
   RESET & ROOT VARIABLES
   ========================== */
* {
  box-sizing: border-box;
}
:root {
  --bg: #ffffff;
  --bgl: #fcfcfc;
  --bgd: #212121;
  --h: #2c2fe8;
  --hd: #e98974;
  --t: #404040;
  --tm: #808080;
  --tl: #f2f2f2;
  --td: #bababa;
  --dat: #b4b4b4;
  --blue: #0057b8;
  --blue-light: #cdecff;
  --yellow: #ffd700;
  --green: #008001;
  --green2: #00ffbf;

  --background-color: #fefefe;
  --main-text-color: #333;
  --dim-text-color: #888;
  --dimmer-text-color: #bababa;
  --dimmest-text-color: #ddd;
  --link-color: #000;
  --theme: #00935d;
  --code: rgba(13, 172, 114, 0.2);
  --star-size: 16px;
  --star-color: transparent;
  --star-background: var(--yellow);
}
.dark {
  --background-color: #222;
  --main-text-color: #ccc;
  --dim-text-color: #666;
  --dimmer-text-color: #444;
  --dimmest-text-color: #333;
  --link-color: #fff;
}
html {
  color-scheme: light dark;
}

/* ==========================
   LAYOUT & TYPOGRAPHY
   ========================== */
body {
  font: 15px/1.6 "Arial-sans-serif", system-ui, sans-serif, apple color emoji, segoe ui emoji, segoe ui symbol, Noto Color Emoji;
  color: var(--main-text-color);
  background: var(--background-color);
  max-width: 54ch;
  margin: 5rem auto;
}
main {}
article {
  margin-bottom: 10rem;
}
time {
  font-size: small;
  color: var(--dat);
}
header {
  
}
.post__header {
  margin-bottom: 0.5em!important;
}
#theme-toggle {
  padding: 0 0.5em;
  font-size: 1.25em;
}


/* ==========================
   HEADERS
   ========================== */
h1, h2, h3, h4, h5 {
  color: var(--link-color);
}
h1 {
  font-size: 1.1rem;
}
header h1 {
  margin: 0;
  flex: 1;
}
header h1:before {
  content: ' / ';
}
h2 {
  font-size: 1.05rem;
}
h3 {
  font-size: 1rem;
}
h4 {
  font-size: 0.9rem;
}
section.year h3 {
  display: inline-block;
  margin-right: 0.5em;
}
header {
  margin-bottom: 4rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
header:hover .g {
  visibility: visible;
}

/* ==========================
   NAVIGATION
   ========================== */
.pagination {
  display: flex;
  justify-content: center;
  margin: 3.5em;
  padding: 0;
}

.pagination ul {
  list-style: none;
  display: flex;
  gap: 0.5em;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.page-item {
  display: inline-block;
}

.page-link {
  display: inline-block;
  padding: 0.4em 0.8em;
  text-decoration: none;
  color: #0077cc;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  transition: background 0.2s ease;
}

.page-link:hover {
  background-color: #f0f0f0;
}

.page-item.active .page-link {
  background-color: #0077cc;
  color: white;
  pointer-events: none;
  cursor: default;
}

/* ==========================
   LINKS
   ========================== */
a, a:visited {
  color: var(--link-color);
}
a:hover {
  color: var(--theme);
}
.entrylist a:visited {
  color: var(--dim-text-color);
}
a#theme-toggle, a.header-link {
  display: inline-block;
  text-decoration: none;
  flex: 0;
}
body a#theme-toggle:after {
  content: '🌙';
}
body.dark a#theme-toggle:after {
  content: '☀';
}
.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 1.0rem;
  background: none;
  border: none;
  cursor: pointer;
}

a#scroll-top {
  margin-left: auto;
  height: 24px;
  width: 24px;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  background: var(--link-color);
  color: var(--background-color);
  text-decoration: none;
}

/* ==========================
   DRAFT LABEL
   ========================== */
.draft-label {
  color: var(--green);
  font-style: italic;
  font-size: small;
}

/* ==========================
   UTILITY CLASSES & ELEMENTS
   ========================== */
.last-generated {
  display: inline-block;
  margin-left: 1rem;
  font-family: monospace;
  font-size: 0.75rem;
  line-height: initial;
}
.icons {
  margin-top: 2rem;
  display: flex;
  align-items: center;
}
.icons a {
  height: 24px;
}
.g {
  visibility: hidden;
  color: var(--dim-text-color);
}

/* ==========================
   ENTRY LISTS & TAGS
   ========================== */
.entrylist {
  list-style-type: none;
  padding-left: 0;
  color: var(--dim-text-color);
}
.entrylist .description {
  color: var(--dimmer-text-color);
}
.entrylist li {
  position: relative;
}
.entrylist li:not(:last-child) {
  margin-bottom: 0.5rem;
}
li[data-tags]:before {
  color: var(--background-color);
  display: inline-block;
  position: absolute;
  left: -1rem;
  content: '●';
}
li[data-tags*='important']:before {
  color: var(--link-color);
}

/* ==========================
   TEXT ELEMENTS
   ========================== */
img {
  max-width: 100%;
  border-radius: 0.2rem;
}
blockquote {
  border-left: 2px solid;
  padding: 0.5rem 1rem;
  margin: 2rem 0;
}
code {
  color: var(--theme);
  font-family: ui-monospace, monospace;
}
pre {
  background: var(--code);
  border-radius: 0.3rem;
  margin: 0.5rem 0;
  padding: 0.5rem;
  overflow: auto;
}
pre > code {
  background: none;
  border: none;
  padding: 0;
}
:not(pre) > code {
  background: var(--code);
  padding: 0.1rem 0.25rem;
  border-radius: 0.25rem;
}
ul li, ol li {
  margin-top: 0.5rem;
}

/* ==========================
   ADMONITIONS
   ========================== */
.admonition {
  border: 2px solid var(--main-text-color);
  border-radius: 4px;
}
.admonition p {
  padding: 0 1rem;
}
p.admonition-title {
  font-weight: bold;
  border-bottom: 2px solid;
  border-color: inherit;
  padding-bottom: 1rem;
}
.admonition.important .admonition-title:before {
  content: "⚠️";
  padding-right: 1ch;
}

/* ==========================
   TABLES
   ========================== */
table {
  position: relative;
  border-collapse: collapse;
  width: max(80rem, 100%);
  table-layout: fixed;
  border: 2px solid var(--main-text-color);
  border-radius: 4px;
  overflow-x: auto;
}
thead {
  position: sticky;
  top: 0;
}
thead::after {
  content: '';
  display: block;
  border-block-end: 2px solid var(--main-text-color);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
tbody tr:first-child td {
  border-block-start: 0;
}
tfoot {
  border-block: 2px solid var(--main-text-color);
}
th, td {
  border: 1px solid var(--dimmest-text-color);
  vertical-align: baseline;
}
thead th {
  vertical-align: bottom;
  background: var(--background-color);
}
td {
  padding: 1em;
}

/* ==========================
   GALLERY (GRID)
   ========================== */
.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 500px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.gallery:has(> .gallery__item:only-child) {
  grid-template-columns: 1fr !important;
}
.gallery:has(> .gallery__item:only-child) .gallery__item img {
  height: 240px;
}
.gallery__item {
  margin: 0;
}
.gallery img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}

/* ==========================
   STARS RATING
   ========================== */
.stars {
  --percent: calc(var(--rating) / 5.1 * 100%);
  display: inline-block;
  font-style: normal;
  font-size: var(--star-size);
  line-height: 1;
}
.stars::before {
  content: '★★★★★';
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--star-background) var(--percent), var(--star-color) var(--percent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================
   LIGHTBOX
   ========================== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.lightbox-content {
  max-width: 90%;
  max-height: 90%;
}
.close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
}

/* ==========================
   PROGRESS BAR
   ========================== */
.ProgressBar {
  display: inline-block;
  margin: 2px;
  height: 6pt;
  width: 90pt;
  background: #a7a7a7;
  position: relative;
  overflow: hidden;
  padding: 2px;
}
.ProgressBar::before {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress);
  background-color: #eeeeec;
}

/* ==========================
   EXPANDO
   ========================== */
div.expando ul {
  display: block;
  margin: 0;
  padding: 0;
}
div.expando ul li {
  display: inline;
}
div.expando ul li + li {
  margin-left: 0.25rem;
}
div.expando li > ul {
  display: none;
}
div.expando li > ul.expanded {
  display: inline;
}

/* ==========================
   MISC
   ========================== */
aside {
  font-size: 0.85rem;
  color: var(--dim-text-color);
}

/* ==========================
   ANIMATIONS
   ========================== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.5rem); }
}
@keyframes fade {
  from { opacity: 1; }
  to { opacity: 0.3; }
}

/* ==========================
   RESPONSIVE
   ========================== */
@media screen and (max-width: 600px) {
  body {
    margin: 1rem;
  }
  th, td {
    padding: 0.5rem;
  }
  .gallery img {
    height: 100px;
  }
}