@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono/JetBrainsMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

html {
  font-size: 18px;
}

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #d7dee8;
  --text: rgb(36, 38, 43);
  --muted: #5c6b82;
  --nav-link: rgb(36, 38, 43);
  --nav-link-hover: rgb(36, 38, 43);
  --link: #c9533b;
  --link-hover: #b24731;
  --focus-ring: #e4a293;
  --tag-bg: #eef3fc;
  /*--code-bg: #f0f4fb;*/
  --code-bg: #f2f2f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "ZurichBT", "Helvetica Neue", sans-serif;
  color: var(--text);
  /*background: linear-gradient(180deg, #f4f8ff 0%, #f7f9fc 28%, #f7f9fc 100%);*/
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

#navbar:not(.navbar--hero) .nav-left a {
  color: var(--nav-link);
}

#navbar:not(.navbar--hero) .nav-left a:hover,
#navbar:not(.navbar--hero) .nav-left a:focus-visible {
  color: var(--nav-link-hover);
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

#search-form {
  margin: 0;
}

#search-input {
  width: 18rem;
  max-width: 50vw;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle__icon {
  width: 1.5rem;
  height: 1.5rem;
  display: none;
}

html[data-theme-mode="light"] .theme-toggle__icon--light {
  display: block;
}

html[data-theme-mode="dark"] .theme-toggle__icon--dark {
  display: block;
}

html[data-theme-mode="system"] .theme-toggle__icon--system {
  display: block;
}

html:not([data-theme-mode]) .theme-toggle__icon--system {
  display: block;
}

.home-hero {
  width: 100%;
  min-height: clamp(18rem, 36vw, 28rem);
  margin-bottom: 1.6rem;
  overflow: hidden;
  background-image: linear-gradient(180deg, rgba(19, 29, 41, 0.44) 0%, rgba(19, 29, 41, 0.18) 38%, rgba(19, 29, 41, 0.46) 100%), var(--home-hero-image);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

.home-hero__overlay {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: clamp(18rem, 36vw, 28rem);
  padding: 1.15rem 1.2rem 1.35rem;
}

.home-hero__copy {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1rem;
}

.home-hero__title {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 0.95;
  text-align: center;
  text-shadow: 0 0.2rem 1.4rem rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0;
  color: #ffffff;
  text-decoration: none;
  font-size: clamp(2.5rem, 5.25vw, 5.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  text-shadow: 0 0.2rem 1.4rem rgba(0, 0, 0, 0.35);
}

.brand:hover,
.brand:focus-visible {
  color: #ffffff;
  text-decoration: none;
}

.brand-main {
  font-weight: 800;
}

.brand-domain {
  margin-left: 0.04em;
  font-weight: 500;
  opacity: 0.82;
}

#navbar.navbar--hero {
  position: relative;
  top: auto;
  padding: 0;
  border-bottom: 0;
  background: none;
  backdrop-filter: none;
}

#navbar.navbar--hero .nav-left,
#navbar.navbar--hero .nav-right {
  gap: 0.75rem;
  flex-wrap: wrap;
}

#navbar.navbar--hero .nav-left a {
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-shadow: 0 0.08rem 0.5rem rgba(0, 0, 0, 0.24);
}

#navbar.navbar--hero .nav-left a:hover,
#navbar.navbar--hero .nav-left a:focus-visible {
  color: #ffffff;
  text-decoration: underline;
}

#navbar.navbar--hero #search-input {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#navbar.navbar--hero #search-input::placeholder {
  color: rgba(255, 255, 255, 0.84);
}

#navbar.navbar--hero .theme-toggle {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#navbar.navbar--hero .theme-toggle:hover,
#navbar.navbar--hero .theme-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

#content {
  width: min(800px, calc(100% - 2rem));
  margin: 1.6rem auto 2.4rem;
}

#content.page-home {
  margin-top: 0;
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.post-card,
.post,
.archive-list {
  background: var(--surface);
  /*border: 1px solid var(--border);*/
  /*border-radius: 0.9rem;*/
  padding: 1rem 1.1rem 2rem 1.1rem;
}

.post-title {
  margin: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-card a {
  color: var(--text);
}

.post-card a:hover,
.post-card a:focus-visible {
  color: var(--link-hover);
  text-decoration: none;
}

.post-date {
  margin: 0.35rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-meta-item {
  white-space: nowrap;
}

.post-meta-separator {
  color: inherit;
}

.post-meta-icon {
  width: 1em;
  height: 1em;
  margin-right: 0.3rem;
  color: currentColor;
  display: inline-block;
  vertical-align: -0.125em;
}

.post-card-body {
  margin-top: 0.8rem;
}

.post-card-body--with-cover {
  display: grid;
  grid-template-columns: minmax(180px, 30%) minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
}

.cover-link {
  display: block;
  width: 100%;
}

.post-cover {
  width: 100%;
  height: auto;
  /*border-radius: 0.65rem;*/
  /*border: 1px solid var(--border);*/
  display: block;
}

.teaser {
  margin: 0;
  color: var(--text);
  text-align: justify;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.teaser-more {
  margin-left: 0.2rem;
  white-space: nowrap;
  font-weight: 700;
}

.teaser-tags {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.post-card .teaser-tags a,
.post-tags a {
  color: var(--link);
}

.post-card .teaser-tags a:hover,
.post-card .teaser-tags a:focus-visible,
.post-tags a:hover,
.post-tags a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.post-content {
  margin-top: 1rem;
}

.post-content p {
  text-align: justify;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-content p a {
  color: var(--link);
}

.post-content ul li p,
.post-content ol li p {
  margin: 9px 0;
}

.post-content :not(pre) > code {
  font-size: 0.95em;
  background-color: #f2f2f2;
  padding: 0.08rem 0.3rem;
  border-radius: 0.25rem;
}

.post-content pre,
.post-content pre code,
pre[class*="language-"],
pre[class*="language-"] > code {
  font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace !important;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.55rem;
}

.post-content img.lightbox-trigger {
  cursor: zoom-in;
}

.post-content img.lightbox-trigger:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 4px;
}

#image-lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

#image-lightbox::backdrop {
  background: rgba(16, 18, 24, 0.82);
  backdrop-filter: blur(4px);
}

.image-lightbox-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#image-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(96vw, 1400px);
  max-height: 90vh;
  border-radius: 0.65rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.22);
}

#image-lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgba(36, 38, 43, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #20242a;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

#image-lightbox-close:hover,
#image-lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 1);
}

#image-lightbox-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.post-content pre {
  overflow: auto;
  padding: 0.75rem;
  border-radius: 0.55rem;
  background: var(--code-bg);
}

.post-content pre[class*="language-"] {
  position: relative;
  padding-top: 2.1rem;
}

.code-copy-button {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 0px solid #b8b8b8;
  border-radius: 0.35rem;
  background-color: #dcdcdc00;
  color: #20242a;
  font-size: 1rem;
  line-height: 0;
  padding: 0;
  cursor: pointer;
}

.code-copy-button svg {
  width: 1em;
  height: 1em;
}

.code-copy-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.post-footer {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9em;
  line-height: 1.5;
}

.post-author {
  color: inherit;
}

.post-footer-separator {
  color: var(--muted);
}

.post-tags {
  display: inline;
}

.tag {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--link);
  font-size: inherit;
}

.archive-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.archive-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.35rem 0;
}

.archive-list .post-date {
  margin: 0;
  flex: 0 0 auto;
}

.archive-list > h1 {
  margin: 0 0 2.4rem;
  padding-bottom: 1.3rem;
  border-bottom: 1px solid var(--border);
  font-size: 2em;
  line-height: 1.05;
}

.archive-group + .archive-group {
  margin-top: 3rem;
}

.archive-group-heading {
  margin: 0 0 1.35rem;
  font-size: 1.5em;
  font-weight: 400;
  line-height: 1.1;
}

.archive-group-posts {
  margin: 0 0 0 1.9rem;
  padding-left: 1.1rem;
  list-style: disc;
}

.archive-group-posts li {
  display: list-item;
  padding: 0.3rem 0;
}

.archive-group-posts a {
  color: var(--link);
}

.archive-item-day,
.archive-item-separator {
  color: var(--text);
}

#search-results ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#search-results li {
  margin: 0.65rem 0;
  padding: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}

@media (max-width: 760px) {
  #navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-right {
    width: 100%;
  }

  #search-input {
    width: min(22rem, calc(100vw - 7rem));
  }

  .post-card-body--with-cover {
    grid-template-columns: 1fr;
  }

  .home-hero {
    margin-bottom: 1.2rem;
  }

  .home-hero__overlay {
    padding: 0.95rem 0.95rem 1.15rem;
  }

  .home-hero__copy {
    padding: 0.35rem;
  }

  #navbar.navbar--hero {
    gap: 0.85rem;
  }

  #navbar.navbar--hero .nav-left {
    width: 100%;
  }

  #content.page-home {
    margin-top: 0;
  }

  #navbar.navbar--hero .nav-right {
    gap: 0.65rem;
    align-items: stretch;
  }

  #navbar.navbar--hero #search-form {
    flex: 1 1 auto;
    width: 100%;
  }

  #navbar.navbar--hero #search-input {
    width: 100%;
    max-width: none;
  }
}
