:root {
  color-scheme: light;
  --ink: #333;
  --muted: #777;
  --line: #ddd;
  --link: #337ab7;
  --surface: #fff;
  --page: #f7f7f7;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.site-header, .page-layout, .site-footer { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { padding: 1rem 0 0; }
.header-row { display: flex; align-items: center; justify-content: flex-start; gap: 1.5rem; min-height: 3rem; border-bottom: 1px solid var(--line); }
.brand-row { display: flex; align-items: center; gap: .6rem; min-height: 0; }
.brand-logo img { display: block; width: auto; height: 1.15em; object-fit: contain; }
.brand-title { color: var(--muted); font-size: 1.15rem; }
.main-nav { display: flex; align-items: center; gap: 1.5rem; padding: .4rem 0; }
.contact-nav { position: relative; display: flex; align-items: center; gap: .25rem; }
.contact-menu { position: relative; }
.contact-menu > summary {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  list-style: none;
}
.contact-menu > summary::-webkit-details-marker { display: none; }
.contact-menu > summary::after { content: "▾"; }
.contact-menu[open] > summary::after { content: "▴"; }
.subnav {
  position: absolute;
  z-index: 5;
  top: calc(100% + .35rem);
  right: 0;
  display: none;
  min-width: 10rem;
  flex-direction: column;
  gap: 0;
  padding: .35rem 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: 0 3px 8px rgb(0 0 0 / 12%);
  font-size: .92rem;
}
.contact-menu[open] .subnav { display: flex; }
.subnav a { display: block; padding: .45rem .8rem; white-space: nowrap; }
.page-layout { display: block; padding-block: 1.5rem 3rem; }
body.has-sidebar .page-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: 2rem; }
#main-content { min-width: 0; }
.post-card, .post-full, .static-page { background: var(--surface); padding: 1.4rem; margin-bottom: 1.25rem; border: 1px solid #e8e8e8; border-radius: 3px; }
.archive-page { margin-bottom: 1.25rem; }
h1, h2, h3 { line-height: 1.25; }
h1 { margin-top: 0; font-size: clamp(1.7rem, 3vw, 2.2rem); }
.post-card h2 { font-size: 1.45rem; margin: 0 0 .4rem; }
.post-meta { color: var(--muted); font-size: .88rem; }
.post-content img { max-width: 100%; }
.post-content pre { overflow-x: auto; padding: 1rem; background: #f3f3f3; }
.code-block-wrapper { position: relative; margin: 1rem 0; }
.code-block-wrapper > pre, .code-block-wrapper > .highlight { margin: 0; }
.code-block-wrapper pre { padding-top: 2.5rem; }
.copy-code-button {
  position: absolute;
  z-index: 2;
  top: .4rem;
  right: .4rem;
  padding: .2rem .55rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: .8rem;
  cursor: pointer;
}
.copy-code-button:hover, .copy-code-button:focus-visible { background: #eee; }
.post-content table { border-collapse: collapse; max-width: 100%; }
.post-content th, .post-content td { border: 1px solid var(--line); padding: .4rem .6rem; }
.tag-list { font-size: .92rem; }
.pagination { display: flex; gap: .8rem; align-items: center; padding: 1rem 0; }
.pagination a { padding: .25rem .55rem; border: 1px solid var(--line); background: var(--surface); }
.pagination [aria-current="page"] { color: var(--ink); font-weight: 700; }
.post-navigation { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.post-navigation a { display: flex; flex-direction: column; gap: .2rem; max-width: 48%; }
.post-navigation a span { color: var(--muted); font-size: .88rem; }
.post-navigation-older { margin-left: auto; text-align: right; }
.blog-sidebar section { margin-bottom: 1.4rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid #e8e8e8; }
.blog-sidebar h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.blog-sidebar h3 { margin: .75rem 0 .2rem; font-size: 1rem; }
.blog-sidebar ul { margin: 0; padding-left: 1.2rem; }
.tag-cloud { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .7rem; }
.tag-cloud a { line-height: 1.35; white-space: nowrap; }
.tag-cloud a span { color: var(--muted); font-size: .72em; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.gallery-item { margin: 0; padding: .5rem; border: 1px solid var(--line); background: var(--surface); }
.gallery-item img { display: block; width: 100%; height: 150px; object-fit: cover; }
.gallery-item figcaption { padding: .5rem .15rem .1rem; font-size: .9rem; }
.gallery-lightbox {
  width: min(96vw, 1200px);
  max-width: none;
  max-height: 94vh;
  padding: 3rem .75rem 1rem;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: #171717;
}
.gallery-lightbox::backdrop { background: rgb(0 0 0 / 86%); }
.gallery-lightbox-content { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 3rem; align-items: center; gap: .75rem; }
.gallery-lightbox figure { margin: 0; text-align: center; }
.gallery-lightbox img { display: block; width: auto; max-width: 100%; max-height: 78vh; margin: 0 auto; object-fit: contain; }
.gallery-lightbox figcaption { padding-top: .5rem; color: #eee; }
.gallery-lightbox button {
  display: grid;
  min-width: 2.75rem;
  min-height: 2.75rem;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 4px;
  color: #fff;
  background: rgb(0 0 0 / 50%);
  font: inherit;
  font-size: 1.8rem;
  cursor: pointer;
}
.gallery-lightbox button:hover, .gallery-lightbox button:focus-visible { background: #333; }
.gallery-lightbox .gallery-lightbox-close { position: absolute; top: .5rem; right: .5rem; min-width: 2.25rem; min-height: 2.25rem; font-size: 1.5rem; }
.notice { border-left: 4px solid #b7791f; background: #fff8e6; padding: .8rem 1rem; }
.site-footer { border-top: 1px solid var(--line); padding: 1.2rem 0 2rem; color: var(--muted); font-size: .9rem; }
.footer-row { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: .75rem 1.5rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer nav a[aria-current] { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: .2em; }
.site-footer p { margin: 0; }

@media (max-width: 760px) {
  body.has-sidebar .page-layout { grid-template-columns: 1fr; }
  .header-row { flex-wrap: wrap; gap: .4rem 1rem; padding-bottom: .6rem; }
  .main-nav { flex-wrap: wrap; gap: .8rem 1.2rem; }
  .brand-logo img { height: 1em; }
  .brand-title { font-size: 1rem; }
  .gallery-lightbox { width: 100vw; max-height: 100dvh; padding: 3.25rem .25rem .5rem; }
  .gallery-lightbox-content { grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem; gap: .25rem; }
  .gallery-lightbox img { max-height: 76dvh; }
  .gallery-lightbox button { min-width: 2.25rem; min-height: 2.75rem; }
}
