:root {
  --paper: #F4EFDF;
  --paper-deep: #E9E1C9;
  --paper-light: #FAF7EC;
  --ink: #1D2926;
  --ink-soft: #46544F;
  --jade: #2C6656;
  --jade-deep: #1F4A3E;
  --jade-mist: #A9C7B8;
  --lotus: #C9657F;
  --lotus-deep: #A24560;
  --lotus-wash: #F0D4DB;
  --gold: #B38B34;
  --gold-soft: #D8BE7E;
  --line: #D6CDB1;
  --danger: #A33A2E;

  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --measure: 62ch;
  --radius: 3px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.35), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(179,139,52,.06), transparent 45%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-top: var(--s5); padding-bottom: var(--s7); outline: none; }
img { max-width: 100%; display: block; }
a { color: var(--jade-deep); text-decoration-color: var(--gold-soft); text-underline-offset: 3px; }
a:hover { color: var(--lotus-deep); }
:focus-visible { outline: 3px solid var(--lotus); outline-offset: 3px; border-radius: 2px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: var(--s4); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s4); z-index: 100; }
.skip-link:focus { left: var(--s2); top: var(--s2); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0 0 var(--s3); letter-spacing: -0.005em; color: var(--ink); }
h1 { font-size: clamp(2.25rem, 7vw, 3.75rem); }
h2 { font-size: clamp(1.625rem, 4vw, 2.25rem); }
h3 { font-size: 1.375rem; }
p { margin: 0 0 var(--s4); max-width: var(--measure); }
.lede { font-size: 1.125rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-size: .9375rem; }
.quiet { color: var(--ink-soft); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: rgba(250,247,236,.7); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; padding-block: var(--s3); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); text-decoration: none; color: var(--ink); font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.brand em { font-weight: 500; color: var(--lotus-deep); }
.site-nav { display: flex; gap: var(--s1); }
.site-nav a { text-decoration: none; padding: var(--s2) var(--s3); font-size: .9375rem; font-weight: 500; color: var(--ink-soft); border-bottom: 2px solid transparent; min-height: 40px; display: inline-flex; align-items: center; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--jade-deep); border-bottom-color: var(--gold); }
@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: var(--s1); }
  .site-nav { width: 100%; justify-content: space-between; margin-inline: calc(var(--s3) * -1); }
  .site-nav a { padding-inline: var(--s3); }
}

.site-footer { border-top: 1px solid var(--line); padding: var(--s6) 0; text-align: center; color: var(--ink-soft); font-size: .875rem; }
.site-footer p { margin: var(--s2) auto 0; }
.divider-ink { margin: 0 auto; opacity: .8; }

/* Buttons and forms */
.btn { font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; border: 1.5px solid var(--jade-deep); background: var(--jade); color: var(--paper-light); padding: 0 var(--s5); min-height: 44px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); text-decoration: none; transition: background .15s var(--ease), transform .15s var(--ease); }
.btn:hover { background: var(--jade-deep); color: var(--paper-light); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--jade-deep); }
.btn.secondary:hover { background: var(--paper-deep); color: var(--jade-deep); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 0 var(--s4); font-size: .875rem; }

.field { display: flex; flex-direction: column; gap: var(--s1); margin-bottom: var(--s4); }
.field label, .field .label { font-weight: 600; font-size: .9375rem; }
.field .hint { font-size: .8125rem; color: var(--ink-soft); }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  font: inherit; color: var(--ink); background: var(--paper-light); border: 1.5px solid var(--line); border-radius: var(--radius); padding: var(--s3); min-height: 44px; width: 100%;
}
textarea { min-height: 140px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--jade); outline: 3px solid rgba(201,101,127,.45); outline-offset: 0; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .875rem; min-height: 1.25em; }
.check { display: flex; align-items: center; gap: var(--s3); min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--jade); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Layout bits */
.section { margin-top: var(--s7); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.section-head h2 { margin: 0; }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }

.chip { display: inline-flex; align-items: center; padding: 2px var(--s3); border: 1px solid var(--lotus); color: var(--lotus-deep); border-radius: 999px; font-size: .8125rem; font-weight: 500; text-decoration: none; background: transparent; min-height: 28px; }
a.chip:hover { background: var(--lotus-wash); color: var(--lotus-deep); }
.chip.active { background: var(--lotus-deep); color: var(--paper-light); border-color: var(--lotus-deep); }
.chip.jade { border-color: var(--jade); color: var(--jade-deep); }
.chip.gold { border-color: var(--gold); color: #7a5d1c; }

/* Entry cards */
.entry-list { display: grid; gap: var(--s6) var(--s5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.entry-card { display: flex; flex-direction: column; gap: var(--s3); }
.entry-card .thumb { display: block; aspect-ratio: 4 / 3; background: var(--paper-deep); overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); position: relative; }
.entry-card .thumb { display: grid; place-items: center; }
.entry-card .thumb img.ph { width: 96px; height: auto; object-fit: contain; opacity: .5; }
.entry-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.entry-card .thumb:hover img { transform: scale(1.03); }
.entry-card .thumb .count { position: absolute; right: var(--s2); bottom: var(--s2); background: rgba(29,41,38,.78); color: #fff; font-size: .75rem; padding: 2px var(--s2); border-radius: 999px; }
.entry-card h3 { font-size: 1.5rem; margin: 0; }
.entry-card h3 a { text-decoration: none; color: inherit; }
.entry-card h3 a:hover { color: var(--lotus-deep); }
.entry-card .meta { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; font-size: .8125rem; color: var(--ink-soft); }
.entry-card p { margin: 0; color: var(--ink-soft); font-size: .9375rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.star { color: var(--gold); }

.empty-state { border: 1.5px dashed var(--gold-soft); border-radius: var(--radius); padding: var(--s6) var(--s5); text-align: center; background: rgba(250,247,236,.6); }
.empty-state img { margin: 0 auto var(--s3); opacity: .85; }
.empty-state h3 { margin-bottom: var(--s2); }
.empty-state p { margin-inline: auto; color: var(--ink-soft); }

/* Entry page */
.entry-head { margin-bottom: var(--s5); }
.entry-head .meta { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s3); }
.prose p { font-size: 1.0625rem; line-height: 1.75; }
.gallery { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); margin: var(--s5) 0; }
.gallery.single { grid-template-columns: 1fr; }
.gallery button { padding: 0; border: 1px solid var(--line); background: var(--paper-deep); cursor: zoom-in; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.gallery.single button { aspect-ratio: auto; max-height: 70vh; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery.single img { object-fit: contain; max-height: 70vh; }
.photo-wall { columns: 2 160px; column-gap: var(--s2); }
.photo-wall a { display: block; margin-bottom: var(--s2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; break-inside: avoid; }
.photo-wall img { width: 100%; height: auto; transition: opacity .2s; }
.photo-wall a:hover img { opacity: .88; }
@media (min-width: 800px) { .photo-wall { columns: 4 180px; } }

.pager { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.pager a { max-width: 48%; }
.pager .next { margin-left: auto; text-align: right; }
.pager small { display: block; color: var(--ink-soft); }

/* Comments */
.comments { margin-top: var(--s7); max-width: 640px; }
.comment { padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.comment strong { font-family: var(--font-display); font-size: 1.25rem; }
.comment time { font-size: .8125rem; color: var(--ink-soft); margin-left: var(--s2); }
.comment p { margin: var(--s1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(20,28,25,.94); z-index: 60; display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.lightbox img { max-width: 100%; max-height: 88vh; object-fit: contain; }
.lightbox .lb-btn { position: absolute; background: rgba(244,239,223,.14); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }
.lightbox .lb-btn:hover { background: rgba(244,239,223,.3); }
.lb-close { top: var(--s4); right: var(--s4); }
.lb-prev { left: var(--s3); top: 50%; }
.lb-next { right: var(--s3); top: 50%; }

/* Toasts */
.toasts { position: fixed; left: 0; right: 0; bottom: var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s2); z-index: 80; pointer-events: none; padding-inline: var(--s4); }
.toast { background: var(--ink); color: var(--paper-light); padding: var(--s3) var(--s5); border-radius: var(--radius); font-size: .9375rem; box-shadow: 0 6px 20px rgba(29,41,38,.25); max-width: 480px; animation: toast-in .25s var(--ease); }
.toast.bad { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.loading { color: var(--ink-soft); padding: var(--s6) 0; }

/* Admin */
.admin-bar { display: flex; gap: var(--s1); flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); }
.admin-bar a, .admin-bar button { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: var(--s3) var(--s4); text-decoration: none; color: var(--ink-soft); font-weight: 500; cursor: pointer; min-height: 44px; }
.admin-bar a[aria-current="page"] { color: var(--jade-deep); border-bottom-color: var(--gold); }
.admin-bar .push { margin-left: auto; }
.panel { background: var(--paper-light); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); }
.panel + .panel { margin-top: var(--s4); }
.narrow { max-width: 560px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.preview-grid .p { position: relative; aspect-ratio: 1; background: var(--paper-deep); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.preview-grid img { width: 100%; height: 100%; object-fit: cover; }
.preview-grid .p button { position: absolute; top: 4px; right: 4px; background: rgba(29,41,38,.8); color: #fff; border: 0; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; }
.preview-grid progress { position: absolute; left: 4px; right: 4px; bottom: 4px; width: calc(100% - 8px); height: 6px; }
.list-row { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; padding: var(--s3) 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row .grow { flex: 1 1 220px; min-width: 0; }
.badge { font-size: .75rem; border: 1px solid var(--gold); color: #7a5d1c; border-radius: 999px; padding: 1px var(--s2); margin-left: var(--s2); }
.state-box { border-left: 4px solid var(--jade); background: var(--paper-deep); padding: var(--s3) var(--s4); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: var(--s4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Blog */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: center; justify-content: space-between; margin-bottom: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.filter-bar .field.jump { margin: 0; min-width: min(100%, 280px); }
.blog-day { margin-top: var(--s7); scroll-margin-top: 110px; }
.blog-day:first-of-type { margin-top: var(--s5); }
.blog-day-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-bottom: var(--s4); padding-bottom: var(--s3); border-bottom: 1px solid var(--gold-soft); }
.blog-day-head h2 { margin: 0; }
.day-empty { margin: 0; }
