:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2a2622;
  --muted: #7a7168;
  --accent: #c8553d;
  --border: #e8e0d5;
  --radius: 14px;
  --max: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1815;
    --surface: #26221e;
    --text: #f1ebe3;
    --muted: #a39a8f;
    --accent: #ee866c;
    --border: #3a342d;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 Georgia, "Iowan Old Style", "Times New Roman", serif;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

header.site { border-bottom: 1px solid var(--border); }
header.site .wrap {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 18px;
}
.brand {
  font: 700 1.3rem -apple-system, "Segoe UI", sans-serif;
  color: var(--text); text-decoration: none; letter-spacing: -0.02em;
}
.brand b { color: var(--accent); font-weight: 700; }
nav { display: flex; flex-wrap: wrap; gap: 6px 20px; font: 500 0.95rem -apple-system, "Segoe UI", sans-serif; }
nav a { color: var(--muted); text-decoration: none; padding-bottom: 2px; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); border-bottom: 2px solid var(--accent); }

main { padding: 48px 0 72px; }
h1, h2, h3 { font-family: -apple-system, "Segoe UI", sans-serif; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 12px; }
.lede { color: var(--muted); font-size: 1.15rem; max-width: 640px; margin: 0 0 36px; }

.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tile {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.tile .pic {
  aspect-ratio: 4 / 3; position: relative; display: grid; place-items: center;
  font-size: 3.4rem; background: linear-gradient(135deg, var(--c1), var(--c2));
}
.tile .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .body { padding: 16px 18px 20px; }
.tile h3 { margin: 0 0 4px; font-size: 1.1rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.tag {
  display: inline-block; margin-top: 10px; font: 600 0.72rem -apple-system, sans-serif;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent);
}

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 56px 0 18px; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head a { font: 500 0.95rem -apple-system, sans-serif; }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 20px 0; border-bottom: 1px solid var(--border); }
.post-list h3 { margin: 0 0 4px; font-size: 1.25rem; }
.post-list h3 a { color: var(--text); text-decoration: none; }
.post-list h3 a:hover { color: var(--accent); }
.meta { color: var(--muted); font: 0.85rem -apple-system, sans-serif; }

article.post { max-width: 680px; }
article.post h2 { margin-top: 2em; }

.about { display: grid; gap: 36px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) { .about { grid-template-columns: 280px 1fr; } }
.portrait {
  aspect-ratio: 1; border-radius: var(--radius); display: grid; place-items: center;
  font-size: 5rem; background: linear-gradient(135deg, #f2b79f, #c8553d); overflow: hidden; position: relative;
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

footer.site { border-top: 1px solid var(--border); color: var(--muted); font: 0.88rem -apple-system, sans-serif; }
footer.site .wrap { padding-top: 24px; padding-bottom: 32px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .logo { height: 36px; width: auto; }
@media (prefers-color-scheme: dark) {
  .brand .logo { background: #fff; border-radius: 10px; padding: 3px 5px; }
}

/* Article content */
article.post img { border-radius: 10px; margin: 20px 0; }
article.post img.cover { width: 100%; max-height: 420px; object-fit: cover; margin: 0 0 24px; }
article.post pre { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow-x: auto; font-size: 0.9rem; }
article.post code { background: var(--surface); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; }
article.post pre code { padding: 0; background: none; }
article.post blockquote { border-left: 4px solid var(--accent); margin: 1.2em 0; padding: 2px 18px; color: var(--muted); }

/* Contact form */
.contact-form { max-width: 560px; font-family: -apple-system, "Segoe UI", sans-serif; }
.contact-form label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 16px; }
.contact-form input:not([type=hidden]), .contact-form textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: 1rem -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.contact-form textarea { resize: vertical; }
.contact-form .hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 10px 20px; font: 600 0.95rem -apple-system, sans-serif; cursor: pointer; text-decoration: none; }
.notice { border-radius: 8px; padding: 10px 14px; font: 0.95rem -apple-system, sans-serif; max-width: 560px; }
.notice.ok { background: #e6f4e6; color: #1d4d1d; }
.notice.err { background: #fbe4e1; color: #7a1f16; }

/* Latest-posts carousel */
.carousel { position: relative; }
.track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: var(--radius);
  outline-offset: 3px;
}
.track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; scroll-snap-align: start; display: grid; grid-template-columns: 1fr; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
@media (min-width: 760px) { .slide { grid-template-columns: 1.1fr 1fr; min-height: 320px; } }
.slide-pic { position: relative; display: grid; place-items: center; min-height: 220px; font-size: 4.5rem; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.slide-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
.slide-body { padding: 28px 30px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.slide-body h3 { margin: 0; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.slide-body p { margin: 0; color: var(--muted); }
.slide:hover h3 { color: var(--accent); }
.controls { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.nav {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.nav:hover { border-color: var(--accent); color: var(--accent); }
.dots { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: var(--border); cursor: pointer; }
.dot.on { background: var(--accent); transform: scale(1.25); }
