/* Site theme. Loaded after main.css and overrides it.
   Palette and type follow https://yasmin.ie, light and dark. */

:root {
  --bg:     #fdfdfc;
  --fg:     #1a1a19;
  --muted:  #63625d;
  --faint:  #8a8983;
  --accent: #9d1e3c;
  --rule:   #e4e2dc;
  --chip:   #f2f0ea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #131211;
    --fg:     #ecebe8;
    --muted:  #a3a19b;
    --faint:  #7d7b75;
    --accent: #e8798f;
    --rule:   #2b2926;
    --chip:   #1f1d1b;
  }
}

/* ---------- base ---------- */

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a, a:link, a:active, a:visited { color: var(--accent); text-decoration: none; }
a:hover { color: var(--fg); text-decoration: underline; }

h1, h2, h3, h4, h5 {
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h1 { font-size: 32px; letter-spacing: -0.02em; margin-bottom: 16px; }
h2 { font-size: 24px; margin-top: 32px; }
h3 { font-size: 19.2px; margin-top: 28px; }

hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.main-layout { background: transparent; }

/* ---------- header ---------- */

/* header, text and footer share one frame, so both margins are equal */
.site-wrap {
  max-width: 788px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}

.site-header .site-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.brand { display: flex; flex-direction: column; line-height: 1.25; }

.author-name, .author-name:link, .author-name:visited {
  color: var(--fg);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.author-name:hover { color: var(--accent); text-decoration: none; }

.tagline { color: var(--muted); font-size: 14px; }

.menu { display: flex; align-items: center; gap: 22px; }

.nav-links {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.nav-links a, .nav-links a:link { color: var(--fg); }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.search { position: relative; width: 170px; }

input#js-search__input,
.form-control {
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: none;
  font-family: inherit;
  font-size: 14px;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: none;
  outline: none;
}

.form-control::placeholder { color: var(--faint); }

.search__results {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  width: 420px;
  max-width: 90vw;
  max-height: 60vh;
  height: auto;
  margin: 6px 0 0;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg);
  font-size: 15px;
}

.search__results:empty { display: none; }

.search__results > li { border-top: 1px solid var(--rule); }
.search__results > li:first-child { border-top: 0; }
.search__results > li > a { padding: 8px 12px; }

.search__result-date {
  position: static;
  float: right;
  margin-left: 12px;
  color: var(--faint);
  font-size: 12px;
}

/* menu toggle, shown only on narrow screens */
.menu-toggle, .menu-button { display: none; }

/* ---------- footer ---------- */

.site-footer {
  height: auto;
  margin: 36px 0 48px;
  padding: 0;
  border-top: 0;
  color: var(--faint);
  font-size: 13.6px;
}

.site-footer .site-wrap::before {
  content: "";
  display: block;
  margin-bottom: 18px;
  border-top: 1px solid var(--rule);
}

.site-footer p { margin: 6px 0; }

.site-footer .social { margin: 0 0 8px; }
.social ul { margin: 0; padding: 0; list-style: none; }
.social ul li { display: inline-block; margin: 0 14px 0 0; }
.social li a { color: var(--muted); font-size: 18px; }
.social li a:hover { color: var(--accent); text-decoration: none; }

/* ---------- post list ---------- */

.section-label {
  margin: 0 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--faint);
  font-size: 12.8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.posts h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 8px;
  font-size: 21.6px;
}

.posts lord-icon {
  width: 44px !important;
  height: 44px !important;
  flex: none;
}

.posts p { color: var(--muted); }

.posts hr { margin: 28px 0; }

/* the footer draws the closing rule */
.posts hr:last-child { display: none; }

/* ---------- posts ---------- */

.post-title { font-size: 33.6px; line-height: 1.15; }

span.time, span.categories {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.content, .post-content { color: var(--fg); }

.content img, .post-content img { border-radius: 4px; }

code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--chip);
  color: var(--fg);
  font-size: 0.88em;
}

div.content pre, .post-content pre {
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: #ecebe8;
  background: #1e1d1b;
}

/* comments, lighter for contrast on the dark block */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cp,
.highlight .cs, .highlight .ch, .highlight .cpf { color: #9a9686; }

pre {
  overflow-x: auto;
  word-break: normal;
  word-wrap: normal;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
}

blockquote {
  margin: 20px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-size: inherit;
}

table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
  font-size: 15.2px;
}

th, td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th { color: var(--faint); font-size: 12.8px; letter-spacing: 0.06em; text-transform: uppercase; }

.panel-body {
  margin-top: 40px;
  padding: 24px 0 0;
  border-top: 1px solid var(--rule);
}

.panel-body h4 { margin-top: 0; }
.panel-body ul { margin-bottom: 0; }

.pagination > li > a,
.pagination > li > span {
  border-color: var(--rule);
  background: var(--bg);
  color: var(--accent);
}

.pagination > .active > a,
.pagination > .active > a:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.pagination > .disabled > span { color: var(--faint); background: var(--bg); border-color: var(--rule); }

/* icons drawn for a light background */
@media (prefers-color-scheme: dark) {
  .posts lord-icon { filter: invert(1) hue-rotate(180deg); }
  .content img, .post-content img { background: #fff; }
}

/* ---------- layout ---------- */

.main-layout { padding-top: 40px; }

/* narrow screens, brand and a menu button, links below */
@media (max-width: 767px) {
  body { font-size: 17px; }

  .site-header { padding: 16px 0; }

  .menu-toggle {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
  }

  .menu-button {
    display: block;
    margin-left: auto;
    padding: 5.6px 14.4px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14.4px;
    line-height: 1.4;
    cursor: pointer;
  }

  .menu-toggle:focus-visible + .menu-button { outline: 2px solid var(--accent); outline-offset: 2px; }
  .menu-toggle:checked + .menu-button { border-color: var(--accent); color: var(--accent); }

  .menu { display: none; flex-direction: column; align-items: stretch; width: 100%; gap: 14px; }
  .menu-toggle:checked ~ .menu { display: flex; }

  .nav-links { flex-direction: column; gap: 8px; }
  .search { width: 100%; }
  .search__results { width: 100%; max-width: none; }

  .main-layout { padding-top: 24px; }

  h1, .post-title { font-size: 28px; }
}

/* ---------- image viewer ---------- */

.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

dialog.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
}

dialog.lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.lightbox::backdrop { background: transparent; }

dialog.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  background: #fff;
}

/* collapsible blocks, such as BibTeX entries */
details { margin: 8px 0 24px; }

details > summary {
  display: list-item;
  cursor: pointer;
  color: var(--accent);
}

details > summary:hover { color: var(--fg); }

/* ---------- copy button ---------- */

div.highlighter-rouge { position: relative; }

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #ecebe8;
  font-size: 14px;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}

div.highlighter-rouge:hover .copy-button,
.copy-button:focus-visible { opacity: 1; }

.copy-button:hover { background: rgba(255, 255, 255, 0.16); }
.copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
