:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6862;
  --line: #e4e1da;
  --accent: #e8502e;
  --accent-soft: #fdebe5;
  --personal: #2f6fde;
  --personal-soft: #e6eefc;
  --add: #e3f6e6;
  --del: #fbe6e6;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #1f1e1c;
    --text: #ecebe8;
    --muted: #9b978f;
    --line: #34322e;
    --accent: #ff7a59;
    --accent-soft: #3a231c;
    --personal: #7aa6ff;
    --personal-soft: #1d2a44;
    --add: #1d3322;
    --del: #3b1f1f;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
code, pre { font-family: var(--mono); font-size: 0.9em; }
h1 { font-size: 1.7rem; margin: 0 0 0.4rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.lead { color: var(--muted); max-width: 46rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.8rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 7px; background: var(--accent); color: #fff; font-size: 0.75rem; letter-spacing: 0.02em; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; font-size: 0.92rem; }
.topbar nav a { text-decoration: none; color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.who { color: var(--muted); border-left: 1px solid var(--line); padding-left: 1.1rem; }
main { max-width: 72rem; margin: 0 auto; padding: 1.8rem 1.5rem 4rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crumbs { margin: 0; color: var(--muted); font-size: 0.85rem; }
.desc { color: var(--muted); margin: 0; max-width: 46rem; }
.search input { width: min(26rem, 100%); }

input[type=text], input[type=email], input[type=password], input[type=search] {
  font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.75rem;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.button, input[type=submit].button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 0.55rem 1rem; background: var(--accent); color: #fff; cursor: pointer; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--accent); }
form.button_to { display: inline; }
.stack { display: grid; gap: 0.45rem; }
.stack .button { margin-top: 0.6rem; justify-self: start; }
.inline { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.check { display: flex; gap: 0.4rem; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card h2:first-child { margin-top: 0; }
.card.narrow { max-width: 24rem; margin: 3rem auto; }
.card.highlight { border-color: var(--accent); background: var(--accent-soft); }
.flash { padding: 0.6rem 0.9rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.flash.alert { border-color: var(--accent); }
.empty { color: var(--muted); padding: 2rem 0; }

.skill-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0.75rem; }
.skill-list a { display: grid; gap: 0.25rem; height: 100%; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; transition: border-color 0.15s; }
.skill-list a:hover { border-color: var(--accent); }
.skill-list .meta { font-size: 0.78rem; color: var(--muted); }
.skill-list .desc { font-size: 0.88rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.badge { display: inline-block; vertical-align: middle; font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-left: 0.4rem; }
.badge-personal { background: var(--personal-soft); color: var(--personal); }

.facts { display: flex; gap: 1.5rem; margin: 0; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; font-size: 1.1rem; }

.columns { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1rem; align-items: start; }
.columns.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 800px) { .columns, .columns.even { grid-template-columns: minmax(0, 1fr); } }

.prose { overflow-wrap: anywhere; }
.prose h1 { font-size: 1.35rem; }
.prose table { border-collapse: collapse; }
.prose th, .prose td, table td, table th { border-bottom: 1px solid var(--line); padding: 0.35rem 0.6rem 0.35rem 0; text-align: left; }
.prose pre, .snippet { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.85rem; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
table { border-collapse: collapse; width: 100%; margin-top: 1rem; font-size: 0.9rem; }
tr.revoked { color: var(--muted); text-decoration: line-through; }

.files, .history { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.history li { display: grid; padding-left: 0.6rem; border-left: 2px solid var(--line); }
.history li.current { border-left-color: var(--accent); }

.diff { font-family: var(--mono); font-size: 0.82rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 1rem; }
.diff ul { list-style: none; margin: 0; padding: 0; }
.diff li { padding: 0 0.6rem; white-space: pre-wrap; min-height: 1.3em; }
.diff li.ins { background: var(--add); }
.diff li.del { background: var(--del); }
.diff li.diff-comment, .diff li.diff-block-info { color: var(--muted); }
.diff strong { font-weight: 700; }
.diff ins, .diff del { text-decoration: none; }
