/* ========================================================
   Variables
======================================================== */
:root {
  --font-cn-sans: "Sarasa UI SC", "Source Han Sans SC", "Noto Sans SC";
  --font-cn-serif: "Noto Serif SC", "Source Han Serif SC";
  --font-system: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, var(--font-cn-sans), sans-serif;
  --font-serif: "Lyon Text Web", Garamond, Baskerville, "New York", var(--font-cn-serif), ui-serif, serif;
  --font-mono: ui-monospace, "SF Mono", "Roboto Mono", Consolas, Arimo, "Liberation Mono", "Source Code Pro", var(--font-cn-sans), monospace;
  /* --color-accent: rgb(67,90,135);
  --color-bg: rgb(236, 239, 243);
  --color-text: rgb(34, 45, 68);
  --color-elevated: rgb(217, 222, 231); */
  --color-accent: #9C6644;
  --color-bg: #F0E5DB;
  --color-text: #5B3D29;
  --color-elevated: #E6CCB2;
}

/* ========================================================
   Reset & Base Document Styles
======================================================== */
html {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  font-size: 18.5px;
  line-height: 1.6;
}

body {
  margin: 8px;
}

::selection {
  background: var(--color-accent);
  color: var(--color-bg);
}

hr {
  border: 0;
  border-top: 2px dotted var(--color-accent);
  margin: 1em 0;
}

blockquote {
  border-left: 2px solid var(--color-accent);
  color: var(--color-accent);
  margin: 0;
  padding-left: 1em;
}

dd {
  padding: 0.5em 0;
}

/* ========================================================
   Typography
======================================================== */
[lang="zh"] {
  font-size: 0.9em;
}

[class="meta date"] {
  font-style: italic;
}

/* Headings (common baseline) */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 1em;
  color: var(--color-accent);
  font-weight: normal;
}

h1 {
  font-size: 1.25em;
}

h2 {
  font-size: 1.2em;
}

h3,
h4,
h5,
h6 {
  font-size: 1em;
}

/* Headings - Specifics & Prefixes */
h1.tags::before {
  content: "# ";
  color: var(--color-accent);
}

/* Article & Title */
.title h1,
article .title {
  margin-bottom: 0;
}

article .title {
  margin-bottom: 1em;
}

/* Section Markers */
/* main h2::before    { content: ">> ";      font-size: smaller; }
main h3::before    { content: ">>> ";     font-size: smaller; }
h4::before         { content: ">>>> ";    font-size: smaller; }
h5::before         { content: ">>>>> ";   font-size: smaller; }
h6::before         { content: ">>>>>> ";  font-size: smaller; } */

/* Suppress h4 prefix in figcaption context */
figcaption>h4::before {
  content: none;
}

/* ========================================================
   Links
======================================================== */
a {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid var(--color-accent);
}

/* a:hover {
  background: var(--color-accent);
  color: var(--color-bg);
} */
body header a,
main h1 a,
.page-item a,
a.readmore,
a.footnote-ref,
a.footnote-backref,
nav a,
a.heading-anchor {
  color: var(--color-accent);
  border: none;
}

a.footnote-ref,
a.footnote-backref {
  font-weight: initial;
}

/* ========================================================
   Lists
======================================================== */
ul {
  list-style: none;
  padding-left: 2ch;
}

ul li {
  position: relative;
  padding-left: 1em;
}

ul>li::before {
  content: "•";
  color: var(--color-accent);
  font-weight: bold;
  position: absolute;
  left: 0;
  top: 0;
}

ul.pagination,
ul.tags {
  padding-left: 0;
}

li.page-item {
  display: inline;
  margin-right: 0.1em;
}

li.page-item::before {
  content: none;
}

.tags li::before {
  content: "# ";
}

/* ========================================================
   Code and Pre
======================================================== */
pre,
code {
  font-family: var(--font-mono);
  background: var(--color-elevated);
  font-size: 0.8em;
}

code {
  padding: 0.1em 0.2em;
}

pre {
  padding: 1em;
  overflow-x: auto;
  line-height: 1.4;
}

pre code {
  background: none;
  color: inherit;
  font-size: 100%;
  padding: 0;
}

/* Inline lang="zh" exception */
code [lang="zh"],
pre [lang="zh"] {
  font-size: 1em;
}

/* Syntax Highlighting */
.highlight,
.highlight pre code[class*="language-"] {
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* ========================================================
   Tables
======================================================== */
table {
  border-spacing: 0;
  border-collapse: collapse;
  font-size: smaller;
}

th,
td {
  padding: 0.5em;
}

th {
  border-width: 3px 0 1px 0;
  border-style: solid;
  border-color: var(--color-accent);
  font-weight: bold;
  color: var(--color-accent);
  text-align: start;
}

tr {
  border-width: 0 0 1px 0;
  border-style: solid;
  border-color: var(--color-accent);
}

/* ========================================================
   Components & Layout Blocks
======================================================== */
.content {
  margin: 0 auto 4em auto;
  max-width: 800px;
  padding: 0 1ch;
  word-wrap: break-word;
}

footer {
  margin-top: 1em;
  color: var(--color-accent);
  font-size: smaller;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  margin: 1em 0;
}

header .main {
  font-size: 1.5em;
  letter-spacing: 0.05em;
  font-weight: 300;
  font-variant: small-caps;
}

.nav-menu a {
  font-variant: small-caps;
}

.site-description {
  display: flex;
  justify-content: space-between;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 0.75rem;
  padding: 0;
}

.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--color-accent);
  min-width: 90px;
  z-index: 1;
  list-style: none;
  padding: 0;
}

.dropdown-content li {
  padding: 8px 8px;
}

.dropdown-content li a {
  color: var(--color-bg);
  text-decoration: none;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* --------------------------------------------------------
   Posts, Tags, Navigation
--------------------------------------------------------- */
.posts .post a,
.tags a,
.tags a:hover,
a.readmore {
  border-bottom: none;
  /* Remove border for tag/links (override) */
}

/* Post meta */
/* .post-tags {
  border-top: 2px dotted var(--color-accent);
} */

/* Draft */
.draft-label {
  color: var(--color-accent);
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: 6px;
  background: var(--color-elevated);
}

/* ========================================================
   Callouts & Notices
======================================================== */
.callout {
  background: var(--color-accent);
  color: var(--color-bg);
  padding: 1em;
}

.callout p {
  margin: 0;
}

.callout a {
  border-bottom: 3px solid var(--color-bg);
}

.callout a:hover,
.callout a:focus {
  background: var(--color-bg);
  color: var(--color-accent);
}

.warning {
  font-style: italic;
  font-size: smaller;
  color: var(--color-accent);
}

mark {
  background: var(--color-accent);
  color: var(--color-bg);
}

mark::selection {
  background: var(--color-bg);
  color: var(--color-accent);
}

mark a {
  border-bottom: 3px solid var(--color-bg);
}

mark a:hover,
mark a:focus {
  background: var(--color-bg);
  color: var(--color-accent);
}

/* Table of Contents */
.toc {
  font-size: 0.8em;
  color: var(--color-accent);
}

.toc a {
  border: none;
}

/* ========================================================
   Figures & Images
======================================================== */
img,
figure {
  display: inline-block;
  margin: 0;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

figure img {
  max-height: 500px;
}

figcaption,
figcaption>* {
  font-size: smaller;
  font-weight: bold;
  color: var(--color-accent);
}

figure h4 {
  margin: 0 0 1em 0;
}

a:has(img) {
  border: none;
}

/* SVG icon sizing */
svg {
  max-height: 16px;
}

/* ========================================================
  Notes
======================================================== */

.note-content img {
  max-height: min(25vh, 300px);
  max-width: 240px;
}

.note-timestamp a {
  color: var(--color-accent);
  border: none;
}

.note-timestamp a:hover {
  background: none;
  border-bottom: 2px solid var(--color-accent);
}

/* ========================================================
  Gallery
======================================================== */

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

.gallery-tile {
  display: block;
  position: relative;
  overflow: hidden;
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
}

.date-tile {
  aspect-ratio: 3 / 4;
  background: var(--color-accent);
  color: var(--color-bg);
  text-decoration: none;
}

.date-tile-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  row-gap: .2rem;
  padding: 0.5rem;
}
