:root {
  color-scheme: light;
  --background: #fff7ef;
  --surface: #fffdf9;
  --surface-raised: #f9e8da;
  --text: #281814;
  --muted: #72554b;
  --line: #e5c8b9;
  --accent: #a6381d;
  --accent-ink: #fffaf5;
  --accent-gradient: linear-gradient(135deg, #b94720, #8f211c);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: #1d1715;
    --surface: #291d1a;
    --surface-raised: #35231e;
    --text: #fff2e8;
    --muted: #d4aea0;
    --line: #634238;
    --accent: #f07958;
    --accent-ink: #28120d;
    --accent-gradient-rust: #d0654a;
    --accent-gradient-coral: #f07958;
    --accent-gradient: linear-gradient(
      135deg,
      var(--accent-gradient-rust),
      var(--accent-gradient-coral)
    );
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #fff7ef;
  --surface: #fffdf9;
  --surface-raised: #f9e8da;
  --text: #281814;
  --muted: #72554b;
  --line: #e5c8b9;
  --accent: #a6381d;
  --accent-ink: #fffaf5;
  --accent-gradient: linear-gradient(135deg, #b94720, #8f211c);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1d1715;
  --surface: #291d1a;
  --surface-raised: #35231e;
  --text: #fff2e8;
  --muted: #d4aea0;
  --line: #634238;
  --accent: #f07958;
  --accent-ink: #28120d;
  --accent-gradient-rust: #d0654a;
  --accent-gradient-coral: #f07958;
  --accent-gradient: linear-gradient(
    135deg,
    var(--accent-gradient-rust),
    var(--accent-gradient-coral)
  );
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.16em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--surface);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header__inner,
.site-header__content,
.tag-bar,
.site-footer {
  padding-right: max(1.25rem, calc((100% - 72rem) / 2));
  padding-left: max(1.25rem, calc((100% - 72rem) / 2));
}

.site-header {
  padding-top: 1.25rem;
  border-top: 0.35rem solid transparent;
  border-image: var(--accent-gradient) 1;
  background: var(--surface);
}

.site-header__top {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.site-header__top nav,
.site-header__content,
.site-footer,
.tag-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
}

.site-header__top nav {
  flex-wrap: wrap;
  margin-left: auto;
}

.site-title {
  color: var(--text);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.5rem, 1rem + 1.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  text-decoration: none;
}

.site-header nav a,
.tag-bar a,
.site-footer a {
  font-size: 0.94rem;
}

.atom-feed-link {
  display: inline-flex;
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  color: #e3702d;
  text-decoration: none;
}

.atom-feed-link svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.4;
}

.atom-feed-link circle {
  fill: currentColor;
  stroke: none;
}

.site-header__tags {
  display: flex;
  flex-wrap: wrap;
  max-width: none;
  margin: 0.85rem 0 0.45rem;
  align-items: center;
  gap: 0.35rem;
}

.site-header__tag {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
}

.site-header__tag:hover,
.site-header__tag:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.site-header__tag span {
  color: var(--muted);
  font-size: 0.72em;
}

.site-header__tag:hover span,
.site-header__tag:focus-visible span {
  color: currentColor;
}

.site-header__more-tags {
  border: 0;
  text-decoration: none;
}

.site-header form {
  display: flex;
  width: min(100%, 35rem);
  align-items: center;
  gap: 0.4rem;
}

.site-header form input[type="search"] {
  flex: 1;
  width: 100%;
}

.site-header__content-band {
  margin-top: 1rem;
  background: var(--accent-gradient);
}

.site-header__content {
  min-height: 2.5rem;
  flex-wrap: wrap;
}

.site-header__content a {
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
}

.site-header__content a:hover,
.site-header__content a:focus-visible {
  text-decoration: underline;
}

.site-header form label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

input[type="search"] {
  width: min(13rem, 38vw);
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  background: var(--background);
  color: var(--text);
}

button {
  padding: 0.42rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 0.2rem;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  filter: brightness(1.06);
}

.tag-bar {
  flex-wrap: wrap;
  min-height: 2.75rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.tag-bar a {
  color: var(--text);
}

.tag-bar a:first-child {
  color: var(--accent);
  font-weight: 700;
}

#main-content {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 3vw, 3rem);
  padding-top: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

h1,
h2,
h3 {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
}

h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.8rem);
}

h3 {
  font-size: 1.2rem;
}

p,
ul,
ol {
  max-width: 70ch;
}

time,
.post-list p,
.post-detail header p {
  color: var(--muted);
  font-size: 0.94rem;
}

.home-layout,
.archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.25fr) minmax(15rem, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.archive-calendar {
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.archive-calendar__breadcrumb {
  margin-top: 0;
  font-weight: 650;
}

.archive-calendar table {
  width: 100%;
  border: 1px solid var(--line);
  border-collapse: collapse;
  text-align: center;
}

.archive-calendar th,
.archive-calendar td {
  padding: 0.3rem;
  border: 1px solid var(--line);
}

.archive-calendar td a {
  display: block;
  text-decoration: none;
}

.content-kind,
.type-counts {
  color: var(--muted);
  font-size: 0.94rem;
}

.post-list,
.home-layout aside ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list > li {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}

.post-list > li:last-child {
  border-bottom: 1px solid var(--line);
}

.post-list h2 {
  margin-bottom: 0.25rem;
}

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

.post-list p {
  margin: 0.35rem 0 0;
}

.home-layout aside {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-top: 0.3rem solid transparent;
  border-image: var(--accent-gradient) 1;
  background: var(--surface);
}

.home-layout aside li + li {
  margin-top: 0.85rem;
}

.post-detail,
.page-detail {
  max-width: 70ch;
}

.post-detail header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.prose {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.08rem;
}

.prose img,
.public-photo {
  display: block;
  max-width: 100%;
  height: auto;
}

.photo-detail figure {
  margin: 0;
}

.photo-detail figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
}

.prose pre,
.prose code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--surface-raised);
}

.preview-notice {
  max-width: 70ch;
  padding: 0.75rem 1rem;
  border-left: 0.3rem solid var(--accent);
  background: var(--surface-raised);
}

.markdown-preview {
  max-width: 70ch;
  margin-top: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.site-footer {
  flex-wrap: wrap;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.site-footer [data-theme-toggle] {
  display: inline-grid;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  place-items: center;
  background: transparent;
  color: var(--text);
}

.site-footer [data-theme-toggle] svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  opacity: 0.6;
}

@media (max-width: 42rem) {
  .site-header__top {
    flex-wrap: wrap;
    align-items: center;
  }

  .site-title {
    order: 1;
    flex: 1 1 calc(100% - 3rem);
  }

  .atom-feed-link {
    order: 2;
    margin-left: auto;
  }

  .site-header__top nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .site-header form,
  .site-header input[type="search"] {
    width: 100%;
  }

  .home-layout,
  .archive-layout {
    grid-template-columns: 1fr;
  }

  .site-footer [data-theme-toggle] {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms !important;
  }
}

.prose img, .mixed-item img, .photo-grid img, .public-photo { height: auto; max-width: 100%; }
.content-with-sidebar > main {
  min-width: 0;
}
.content-with-sidebar { display: grid; gap: 3rem; grid-template-columns: minmax(0, 1fr) 15rem; }
.post-meta { color: var(--muted); font-size: 0.9rem; }
.post-meta p { margin-bottom: 1rem; }
.post-meta-tags { display: inline-flex; flex-wrap: wrap; gap: .35rem; vertical-align: middle; }
.post-meta-tag { display: inline-flex; gap: .2rem; padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-raised); color: var(--accent); text-decoration: none; }
.post-meta-tag:hover, .post-meta-tag:focus-visible { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.post-meta-tag-count { color: var(--muted); }
.post-meta-tag:hover .post-meta-tag-count, .post-meta-tag:focus-visible .post-meta-tag-count { color: currentColor; }
.archive-calendar table { border-collapse: collapse; width: 100%; }
.archive-calendar th, .archive-calendar td { padding: .3rem; text-align: center; }
.tag-cloud { align-items: baseline; display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.tag-size-1 { font-size: .85rem; } .tag-size-2 { font-size: 1rem; } .tag-size-3 { font-size: 1.15rem; }
.tag-size-4 { font-size: 1.3rem; } .tag-size-5 { font-size: 1.5rem; }
.markdown-image-button { margin: 0 0 .5rem; }
@media (max-width: 760px) { .content-with-sidebar { grid-template-columns: 1fr; } }

.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.search-form {
  max-width: 42rem;
  margin-bottom: 1rem;
}

.search-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.search-form__controls {
  display: flex;
  gap: 0.5rem;
}

.search-form__controls input[type="search"] {
  width: 100%;
}

.selected-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}

.search-count,
.search-empty {
  color: var(--muted);
}

.search-facets {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-top: 0.3rem solid transparent;
  border-image: var(--accent-gradient) 1;
  background: var(--surface);
}

.search-facets h2 {
  margin-bottom: 0.75rem;
}

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

.search-facets li + li {
  margin-top: 0.4rem;
}

.search-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .search-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 30rem) {
  .search-form__controls {
    align-items: stretch;
    flex-direction: column;
  }
}
