/* ---------- Tokens ---------- */
:root {
  --bg: #F5F1EA;
  --bg-soft: #EFEADF;
  --bg-sunken: #EAE3D5;
  --ink: #141413;
  --ink-muted: #6B655A;
  --ink-faint: #A39B8B;
  --rule: #D9D2C4;
  --rule-soft: #E4DECF;
  --accent: #C4653E;
  --accent-soft: #E2A07A;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", "Source Serif Pro", "EB Garamond", Georgia, "Times New Roman", serif;

  --sidebar-w: 248px;
  --content-max: 680px;

  --t-fast: 120ms ease;
  --t-med: 220ms cubic-bezier(.2,.6,.2,1);
}

html[data-theme="dark"] {
  --bg: #0E0E0C;
  --bg-soft: #17160F;
  --bg-sunken: #1F1D14;
  --ink: #F0EBE1;
  --ink-muted: #9B9384;
  --ink-faint: #5A5547;
  --rule: #2A2820;
  --rule-soft: #201E18;
  --accent: #C4653E;
  --accent-soft: #B5744F;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color var(--t-fast), color var(--t-fast);
}
a:hover { color: var(--accent); border-bottom-color: var(--accent); }

em, i, .accent {
  font-style: italic;
  font-family: var(--serif);
  color: var(--accent);
  font-weight: 400;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}
h1 { font-size: 28px; margin: 0 0 24px; }
h2 { font-size: 22px; margin: 48px 0 16px; }
h3 { font-size: 17px; margin: 28px 0 8px; font-family: var(--sans); font-weight: 500; letter-spacing: 0; }

p { margin: 0 0 18px; text-wrap: pretty; max-width: 62ch; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 40px 0;
}

code {
  font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-sunken);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ---------- Layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px 22px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
  padding: 0 6px;
  text-decoration: none;
  border: 0;
  color: var(--ink);
}
.brand__mark {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.brand__name {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand__name em { color: var(--accent); }

.nav-group { margin-bottom: 22px; }
.nav-group__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  padding: 0 8px 8px;
  font-weight: 500;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav a {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 5px;
  border: 0;
  font-size: 13.5px;
  color: var(--ink-muted);
  position: relative;
  overflow: hidden;
  transition: color var(--t-fast);
}
.nav a .nav__icon {
  width: 14px;
  height: 14px;
  opacity: 0.85;
  transition: opacity var(--t-fast), color var(--t-fast);
}
.nav a .nav__label { position: relative; z-index: 1; }
.nav a .nav__key {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  position: relative;
  z-index: 1;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--rule-soft);
  background: transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.nav a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  transition: transform var(--t-med);
  z-index: 0;
  border-radius: 5px;
}
.nav a > * { position: relative; z-index: 1; }
.nav a:hover { color: #fff; }
.nav a:hover::before { transform: translateX(0); }
.nav a:hover .nav__key { color: #fff; border-color: rgba(255,255,255,0.35); }
.nav a:hover .nav__icon { color: #fff; opacity: 1; }

.nav a.is-active {
  color: var(--ink);
  background: var(--bg-sunken);
}
.nav a.is-active .nav__icon { color: var(--accent); opacity: 1; }

.nav__ext {
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: 2px;
}

.sidebar__spacer { flex: 1; }

.theme {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg-soft);
  margin-top: 10px;
}
.theme button {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-muted);
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background var(--t-fast), color var(--t-fast);
}
.theme button svg { width: 12px; height: 12px; }
.theme button:hover { color: var(--ink); }
.theme button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule);
}

.sidebar__foot {
  margin-top: 14px;
  font-size: 11px;
  color: var(--ink-faint);
  padding: 0 8px;
  line-height: 1.5;
}

/* ---------- Main ---------- */
.main {
  padding: 72px 80px 120px;
  min-width: 0;
}
.content {
  max-width: var(--content-max);
  margin-inline: auto;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin-bottom: 18px;
  font-weight: 500;
}

.lede {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 32px;
  max-width: 60ch;
}
.lede em { font-size: 1em; }

/* ---------- Feed / list items ---------- */
.feed { margin-top: 24px; }
.feed__group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 32px 0 10px;
  font-weight: 500;
}

.item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 22px;
  padding: 18px 0;
  border-top: 1px solid var(--rule-soft);
  align-items: baseline;
  border-bottom: 0;
}
.item:last-child { border-bottom: 1px solid var(--rule-soft); }
.item__date {
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item__body { min-width: 0; }
.item__title {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 4px;
  border: 0;
  display: inline-block;
}
.item__desc {
  font-size: 13.5px;
  color: var(--ink-muted);
  line-height: 1.55;
  margin: 0;
}
.item__tags {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 500;
}
.tag--accent { color: var(--accent); }
.tag__dot {
  display: inline-block;
  width: 4px; height: 4px;
  background: var(--ink-faint);
  border-radius: 50%;
  margin: 0 6px 2px;
  vertical-align: middle;
}

.item--project {
  grid-template-columns: 110px 72px 1fr;
}
.item__thumb {
  width: 72px;
  height: 54px;
  border-radius: 3px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule-soft);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-faint);
  font-size: 20px;
  overflow: hidden;
  position: relative;
}
.item__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 45%, rgba(196,101,62,0.08) 50%, transparent 55%);
}

a.item {
  text-decoration: none;
  color: inherit;
  transition: background var(--t-fast);
}
a.item:hover { background: var(--bg-soft); }
a.item:hover .item__title { color: var(--accent); }

/* ---------- About page prose ---------- */
.prose p + p { margin-top: 0; }
.prose h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule-soft);
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Newsletter form ---------- */
.form {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  max-width: 440px;
}
.form input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: 4px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.form button {
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.form button:hover { background: var(--accent); }
.form__hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 10px;
}
.form__success {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
  margin-top: 14px;
  font-size: 15px;
}

/* ---------- Tools page ---------- */
.tools-group { margin-bottom: 40px; }
.tools-group h3 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 14px;
  font-weight: 500;
}
.tool-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  padding: 10px 0;
  border-top: 1px solid var(--rule-soft);
  align-items: baseline;
  font-size: 14px;
}
.tool-row:last-child { border-bottom: 1px solid var(--rule-soft); }
.tool-row__name {
  font-family: var(--serif);
  font-size: 15px;
}
.tool-row__note { color: var(--ink-muted); font-size: 13.5px; line-height: 1.55; }

/* ---------- Reading list ---------- */
.book {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--rule-soft);
  align-items: baseline;
}
.book:last-child { border-bottom: 1px solid var(--rule-soft); }
.book__title { font-family: var(--serif); font-size: 16px; }
.book__author { color: var(--ink-muted); font-size: 13px; }
.book__note { font-size: 13px; color: var(--ink-muted); margin-top: 4px; line-height: 1.55; max-width: 56ch; }
.book__status {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.book__status--now { color: var(--accent); }

/* ---------- Now page ---------- */
.now-block {
  padding: 20px 0;
  border-top: 1px solid var(--rule-soft);
}
.now-block:first-of-type { border-top: 0; padding-top: 0; }
.now-block h3 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 10px;
  font-weight: 500;
}
.now-block ul { margin: 0; padding-left: 18px; }
.now-block li { margin-bottom: 6px; color: var(--ink); font-size: 14.5px; }
.now-block li span { color: var(--ink-muted); }

.now-stamp {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 40px;
  font-style: italic;
  font-family: var(--serif);
}

/* ---------- Footer meta ---------- */
.page-foot {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.page-foot a { border: 0; color: var(--ink-faint); }
.page-foot a:hover { color: var(--accent); }

/* ---------- CTA link ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 1px;
}
.cta::after {
  content: "→";
  transition: transform var(--t-fast);
}
.cta:hover::after { transform: translateX(3px); }

/* ---------- Page transitions ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.content { animation: fadeUp 380ms cubic-bezier(.2,.6,.2,1) both; }

/* ---------- Portrait (About) ---------- */
.portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  float: right;
  margin: 4px 0 14px 24px;
  border: 1px solid var(--rule);
  background: var(--bg-sunken);
}

/* ---------- Shop ---------- */
.shop-group { margin-bottom: 44px; }
.shop-group > h3 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 12px;
  font-weight: 500;
}
.shop-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--rule-soft);
  align-items: baseline;
}
.shop-row:last-child { border-bottom: 1px solid var(--rule-soft); }
.shop-row__title {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}
.shop-row__note {
  color: var(--ink-muted);
  font-size: 13.5px;
  line-height: 1.55;
  margin: 4px 0 8px;
  max-width: 56ch;
}
.shop-row__buy {
  font-size: 12.5px;
  color: var(--accent);
  border-bottom: 1px solid var(--accent-soft);
  padding-bottom: 1px;
}
.shop-row__price {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.shop-row__price--free {
  color: var(--accent);
  font-style: italic;
}

/* ---------- Available-for block ---------- */
.avail {
  margin: 28px 0 8px;
  padding: 20px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
}
.avail h3 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 10px;
  font-weight: 500;
}
.avail ul { margin: 0; padding-left: 16px; }
.avail li { margin: 2px 0; font-size: 14px; }

.contact-lines {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.8;
  margin-top: 18px;
}
.contact-lines strong {
  font-family: var(--sans);
  color: var(--ink-faint);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: inline-block;
  width: 110px;
}

/* ---------- Mobile bar + responsive ---------- */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  align-items: center;
  gap: 12px;
}
.mobile-bar__brand {
  font-family: var(--serif);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-bar__brand em { color: var(--accent); }
.mobile-bar .brand__mark {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 12px;
}
.mobile-menu-btn {
  width: 44px; height: 44px;
  border: 1px solid var(--rule);
  background: var(--bg-soft);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}
.mobile-menu-btn svg { width: 20px; height: 20px; }
.sidebar__close {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  border: 1px solid var(--rule);
  background: var(--bg-soft);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
body.menu-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .mobile-bar { display: flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 86%;
    max-width: 340px;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 220ms cubic-bezier(.2,.6,.2,1);
    box-shadow: 0 0 40px rgba(0,0,0,0.18);
    border-right: 1px solid var(--rule);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close { display: grid; place-items: center; }
  .main { padding: 24px 22px 80px; }
  .item { grid-template-columns: 86px 1fr; gap: 14px; }
  .item--project { grid-template-columns: 86px 1fr; }
  .item--project .item__thumb { display: none; }
  .nav a { padding: 10px 10px; font-size: 14px; } /* 44px tall tap target */
  .theme button { padding: 10px 6px; }
  body.menu-open::before {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 30;
  }
}
