/* ---------- Theme ---------- */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6862;
  --line: #e7e3dc;
  --accent: #c2410c;
  --accent-soft: #fdecdf;
  --radius: 14px;
  --maxw: 960px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Georgia", "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312; --surface: #1d1c1a; --text: #ece9e4; --muted: #a29e97;
    --line: #2e2c29; --accent: #fb923c; --accent-soft: #3a2415;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141312; --surface: #1d1c1a; --text: #ece9e4; --muted: #a29e97;
  --line: #2e2c29; --accent: #fb923c; --accent-soft: #3a2415;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo {
  font-family: var(--serif); font-weight: 700; font-size: 20px; text-decoration: none;
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff;
}
.nav { display: flex; gap: 28px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-size: 15px; transition: color .15s; }
.nav a:hover { color: var(--text); }
.header-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 10px; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--line); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding-top: 120px; padding-bottom: 96px; }
.eyebrow { color: var(--accent); font-weight: 600; margin: 0 0 8px; letter-spacing: .02em; }
.hero h1 { font-family: var(--serif); font-size: clamp(44px, 8vw, 84px); letter-spacing: -.02em; }
.lead { font-size: clamp(18px, 2.2vw, 21px); color: var(--muted); max-width: 640px; margin: 20px 0 0; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: 15px; border: 1px solid var(--line); background: var(--surface);
  transition: transform .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--muted); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { border-color: var(--text); }

/* ---------- Sections ---------- */
.section { padding-top: 72px; padding-bottom: 72px; border-top: 1px solid var(--line); }
.section-title { font-family: var(--serif); font-size: clamp(30px, 4vw, 40px); margin-bottom: 36px; }
.sub-title { font-size: 20px; margin: 56px 0 20px; }
.prose p { margin: 0 0 16px; }

.about-grid { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: start; }
.avatar {
  aspect-ratio: 1; border-radius: var(--radius); overflow: hidden;
  background: repeating-linear-gradient(45deg, var(--accent-soft) 0 12px, transparent 12px 24px), var(--surface);
  border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 14px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.tags { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { background: var(--accent-soft); color: var(--accent); padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.tags.small { margin: 12px 0 16px; }
.tags.small li { font-size: 12px; padding: 2px 10px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 160px 1fr; column-gap: 24px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 14px; grid-row: span 2; padding-top: 2px; }
.timeline p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- Projects ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px -12px rgb(0 0 0 / .18); }
.card-media { aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--accent-soft), var(--line)); }
.card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-size: 19px; }
.card p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.link { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- Notes ---------- */
.posts { list-style: none; padding: 0; margin: 0; }
.posts a {
  display: grid; grid-template-columns: 160px 1fr; gap: 24px; padding: 18px 0;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.posts time { color: var(--muted); font-size: 14px; padding-top: 2px; }
.post-title { font-weight: 600; transition: color .15s; }
.posts a:hover .post-title { color: var(--accent); }

/* ---------- Contact ---------- */
.contact .lead { margin-top: 0; }
.contacts { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
.contacts a {
  display: inline-block; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-weight: 500; background: var(--surface); transition: border-color .15s, color .15s;
}
.contacts a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }

/* ---------- 404 ---------- */
.not-found { min-height: 70vh; display: grid; place-content: center; text-align: center; }
.not-found h1 { font-family: var(--serif); font-size: 96px; color: var(--accent); }
.not-found .lead { margin: 12px auto 32px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 56px 0 0; }
.stats div { border-top: 2px solid var(--accent); padding-top: 12px; }
.stats dt { font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.1; }
.stats dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Monogram ---------- */
.monogram { font-family: var(--serif); font-size: 72px; font-weight: 700; color: var(--accent); }
.prose a { color: var(--accent); text-underline-offset: 3px; }

/* ---------- Beliefs ---------- */
.beliefs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.beliefs > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.beliefs h4 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; }
.beliefs p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- Card media variants ---------- */
.card-media { display: grid; place-items: center; }
.card-media span { font-family: var(--serif); font-weight: 700; font-size: 40px; color: #fff; text-align: center; line-height: 1; letter-spacing: -.02em; }
.m1 { background: linear-gradient(135deg, #c2410c, #7c2d12); }
.m2 { background: linear-gradient(135deg, #1c1b19, #57534e); }
.m3 { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.m4 { background: linear-gradient(135deg, #78350f, #b45309); }
.m5 { background: linear-gradient(135deg, #44403c, #a8a29e); }

.more { margin: 24px 0 0; }
.contacts a.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.contacts a.primary:hover { color: #fff; opacity: .9; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 44px; }
  .stats dt { font-size: 28px; }
  .beliefs { grid-template-columns: 1fr; }
  .monogram { font-size: 52px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .menu-btn { display: grid; }
  .header-actions { margin-left: auto; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; font-size: 17px; color: var(--text); }
  .hero { padding-top: 72px; padding-bottom: 64px; }
  .section { padding-top: 56px; padding-bottom: 56px; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .avatar { width: 140px; }
  .timeline li, .posts a { grid-template-columns: 1fr; gap: 4px; }
  .timeline .when { grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
