/* ------------------------------------------------------------------ */
/* tokens — soft, low-contrast, slightly cool palette                  */
/* ------------------------------------------------------------------ */
:root {
  --bg: #f8f8f6;
  --bg-2: #eeeeeb;
  --panel: #ffffff;
  --text: #2f3439;
  --text-soft: #5f666d;
  --text-faint: #98a0a7;
  --line: #e4e5e1;
  --line-soft: #ecedea;
  --accent: #3e7e85;
  --accent-soft: #e1ecec;
  --accent-ink: #2d6168;
  --accent-2: #8a7fc7;      /* external link mark */
  --sidebar-w: 292px;
  --content-w: 760px;
  --font-head: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background:
    radial-gradient(1000px 600px at 10% 0%, #fdfdfc 0%, transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-soft); }

.muted { color: var(--text-faint); }

/* ------------------------------------------------------------------ */
/* sidebar                                                             */
/* ------------------------------------------------------------------ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 40px 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--line-soft);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--text);
  text-decoration: none;
}
.profile:hover { text-decoration: none; color: var(--text); }

.avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03), 0 8px 24px rgba(47, 52, 57, 0.08);
}

.profile-name {
  margin-top: 16px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.profile-tagline {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 4px;
  letter-spacing: 0.01em;
}

/* search */
.search { position: relative; }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 8px 36px 8px 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#searchInput::placeholder { color: var(--text-faint); }
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#searchInput::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-kbd {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 6px;
  line-height: 18px;
  background: var(--bg);
  pointer-events: none;
}
#searchInput:focus ~ .search-kbd { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(47, 52, 57, 0.10);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 20;
  padding: 6px;
}

.search-result {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  text-decoration: none;
}
.search-result:hover, .search-result.active { background: var(--accent-soft); text-decoration: none; color: var(--text); }
.search-result .sr-title { font-weight: 500; }
.search-result .sr-sub { color: var(--text-soft); font-size: 12.5px; }
.search-result mark { background: #f4ecc8; color: inherit; padding: 0 1px; border-radius: 2px; }
.search-empty { padding: 10px; color: var(--text-faint); font-size: 13.5px; }

/* nav tree */
.nav { font-size: 14.5px; line-height: 1.35; }

.nav-item,
.nav-folder-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover, .nav-folder-head:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }

.nav-item { padding-left: 30px; }
.nav-children { padding-left: 16px; }
.nav-children .nav-item { padding-left: 22px; }
.nav-children .nav-folder-head { padding-left: 6px; }

.nav-folder-head { font-weight: 500; color: var(--text); }
.nav-folder-head .chev {
  flex: 0 0 auto;
  width: 14px;
  margin-top: 4px;
  color: var(--text-faint);
  transition: transform 0.15s ease;
  display: inline-flex;
  justify-content: center;
}
.nav-folder.open > .nav-folder-head .chev { transform: rotate(90deg); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--line-soft);
}
.sidebar-footer a { color: var(--text-faint); }
.sidebar-footer a:hover { color: var(--accent-ink); }

/* ------------------------------------------------------------------ */
/* main content                                                        */
/* ------------------------------------------------------------------ */
.main {
  margin-left: var(--sidebar-w);
  padding: 56px 48px 56px 72px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  max-width: var(--content-w);
  width: 100%;
  flex: 1;
}

.content h1, .content h2, .content h3, .content h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.015em;
  margin: 1.8em 0 0.6em;
  scroll-margin-top: 24px;
}
.content h1 { font-size: 40px; margin-top: 0; letter-spacing: -0.02em; }
.content h2 { font-size: 26px; padding-top: 0.2em; }
.content h3 { font-size: 20px; }
.content h4 { font-size: 17px; }
.content h1 + p, .content h1 + .lede { margin-top: 0.4em; }

.content p { margin: 0 0 1.2em; }
.content ul, .content ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.content li { margin: 0.3em 0; }
.content li::marker { color: var(--text-faint); }
.content li > input[type="checkbox"] { margin-right: 6px; accent-color: var(--accent); }
.content strong { font-weight: 600; color: var(--text); }

.content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.6em 0;
}

.content blockquote {
  margin: 1.4em 0;
  padding: 0.6em 1.2em;
  border-left: 3px solid var(--accent-soft);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
  font-size: 0.96em;
}
.content blockquote p:last-child { margin-bottom: 0; }

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}

.content code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  background: var(--bg-2);
  padding: 0.12em 0.4em;
  border-radius: 5px;
  color: var(--text);
}
.content pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1.5em;
  font-size: 13.5px;
  line-height: 1.6;
}
.content pre code { background: none; padding: 0; font-size: inherit; }

.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 1.5em;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}
.content th, .content td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.content th { font-weight: 500; color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; border-bottom-color: var(--line); }
.content tr:last-child td { border-bottom: 0; }
.content td:first-child { color: var(--text); font-weight: 500; }

.content a.external::after {
  content: "↗";
  font-size: 0.68em;
  margin-left: 2px;
  vertical-align: super;
  color: var(--accent-2);
}

.broken-link { color: var(--text-faint); border-bottom: 1px dashed var(--line); }

/* ---- reusable blocks used from markdown via raw HTML ---- */

/* these lists are layout, not prose: undo the generic list indent/marker */
.content ul.tags, .content ul.cards, .content ul.socials { padding-left: 0; list-style: none; }
.content ul.tags li, .content ul.cards li, .content ul.socials li { margin: 0; }
.content img.intro-art { border: 0; border-radius: 12px; }

/* page subtitle straight under the H1 */
.lede {
  font-size: 19px;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0 0 1.4em;
}

/* small grey meta line (role · place · dates) */
.meta-line {
  color: var(--text-faint);
  font-size: 14px;
  margin: -0.4em 0 1.6em;
  letter-spacing: 0.01em;
}

/* home hero: text + illustration */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: center;
  margin-bottom: 1em;
}
.intro-art {
  width: 100%;
  display: block;
  border-radius: 12px;
}

/* skill / tag chips */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1.6em; padding: 0; list-style: none; }
.tag {
  font-size: 12.5px;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-soft);
  letter-spacing: -0.01em;
}

/* labelled, two-column definition table without table chrome */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0 0 1.6em; font-size: 15.5px; }
.facts dt { color: var(--text-faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 4px; }
.facts dd { margin: 0; }

/* card links for sections */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 12px;
  margin: 0 0 1.8em;
  padding: 0;
  list-style: none;
}
.cards li { display: flex; }
.cards a {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.cards a:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(47, 52, 57, 0.06); transform: translateY(-1px); text-decoration: none; }
.cards a.external::after { content: none; }
.cards .card-title { font-family: var(--font-head); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; line-height: 1.3; }
.cards .card-sub {
  color: var(--text-soft);
  font-size: 13.5px;
  margin-top: 4px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* social / contact links row */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1em 0 1.2em;
  padding: 0;
  list-style: none;
}
.socials li { margin: 0; }
.socials a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}
.socials a:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.socials a.external::after { content: none; }
.socials svg { width: 16px; height: 16px; fill: var(--text-soft); }
.socials a:hover svg { fill: var(--accent-ink); }

.error-box {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-soft);
}

.page-footer {
  max-width: var(--content-w);
  margin-top: 64px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ------------------------------------------------------------------ */
/* mobile                                                              */
/* ------------------------------------------------------------------ */
.menu-btn { display: none; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    position: fixed;
    top: 14px;
    left: 14px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    z-index: 40;
    cursor: pointer;
    padding: 0 11px;
  }
  .menu-btn span { height: 2px; background: var(--text); border-radius: 2px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    background: var(--bg);
    z-index: 35;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
    padding-top: 70px;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(30, 34, 38, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 30;
  }
  body.sidebar-open .backdrop { opacity: 1; pointer-events: auto; }

  .main { margin-left: 0; padding: 76px 22px 40px; }
  body { font-size: 16.5px; }
  .content h1 { font-size: 32px; }
  .content h2 { font-size: 23px; }
  .content h3 { font-size: 19px; }
  .lede { font-size: 17px; }
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .intro-art { max-width: 360px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
}
