:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --bar: #f1efeb;
  --hover: #f6f4f0;
  --fg: #1c1917;
  --muted: #57534e;
  --subtle: #8f8882;
  --border: #e4e1dc;
  --border-strong: #d3cfc8;
  --green: #15803d;
  --blue: #2563eb;
  --amber: #b45309;
  --glow-1: rgba(37, 99, 235, 0.10);
  --glow-2: rgba(245, 158, 11, 0.10);
  --dot: rgba(28, 25, 23, 0.08);
  --shadow: 0 1px 2px rgba(28,25,23,0.04), 0 10px 30px -12px rgba(28,25,23,0.14);
  --radius: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0a09;
    --surface: #131110;
    --bar: #1a1715;
    --hover: #1c1917;
    --fg: #ece8e3;
    --muted: #a8a29e;
    --subtle: #6f6964;
    --border: #262220;
    --border-strong: #3a3532;
    --green: #4ade80;
    --blue: #60a5fa;
    --amber: #fbbf24;
    --glow-1: rgba(96, 165, 250, 0.14);
    --glow-2: rgba(251, 191, 36, 0.07);
    --dot: rgba(236, 232, 227, 0.06);
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 16px 40px -16px rgba(0,0,0,0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0a09;
  --surface: #131110;
  --bar: #1a1715;
  --hover: #1c1917;
  --fg: #ece8e3;
  --muted: #a8a29e;
  --subtle: #6f6964;
  --border: #262220;
  --border-strong: #3a3532;
  --green: #4ade80;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --glow-1: rgba(96, 165, 250, 0.14);
  --glow-2: rgba(251, 191, 36, 0.07);
  --dot: rgba(236, 232, 227, 0.06);
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 16px 40px -16px rgba(0,0,0,0.7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(48rem 26rem at 20% -10rem, var(--glow-1), transparent 70%),
    radial-gradient(40rem 24rem at 90% -8rem, var(--glow-2), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 70%);
          mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
::selection { background: color-mix(in srgb, var(--blue) 25%, transparent); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding-inline: 16px;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
}
.topbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.brand .tilde { color: var(--blue); }
.brand .caret { color: var(--green); }
.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.tabs a:hover { color: var(--fg); background: var(--hover); }
.tabs a span { color: var(--subtle); }
.theme-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (max-width: 640px) {
  .tabs { display: none; }
  .theme-toggle { margin-left: auto; }
}

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  padding-block: 32px 24px;
}
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-12 { grid-column: span 12; }
@media (max-width: 820px) {
  .grid > * { grid-column: span 12; }
}

/* ---- Window ---- */
.win {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 76px;
}
.win-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--border);
}
.light { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.light.r { background: #ff5f57; }
.light.y { background: #febc2e; }
.light.g { background: #28c840; }
.win-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  margin-right: 47px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-body {
  flex: 1;
  padding: 20px 22px 22px;
}

/* ---- Terminal lines ---- */
.cmd {
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--fg);
  margin: 0 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd + .cmd, .out + .cmd { margin-top: 18px; }
.prompt { color: var(--green); }
.prompt b { color: var(--blue); font-weight: 500; }
.comment { color: var(--subtle); }
.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: -0.2em;
  background: var(--blue);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* sequenced typing (JS only) */
.js .win.pending .seq { visibility: hidden; }
.seq.shown-out { animation: fade 0.35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Hero ---- */
.hero .win-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 30px;
}
.name {
  font-family: var(--mono);
  font-size: clamp(2.1rem, 5.6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.05;
  margin: 4px 0 6px;
  text-wrap: balance;
  background: linear-gradient(100deg, var(--fg) 40%, color-mix(in srgb, var(--fg) 55%, var(--blue)));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}
.roles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.roles li {
  padding-left: 1.6em;
  text-indent: -1.6em;
  font-size: 1.05rem;
  font-weight: 500;
}
.roles li::before {
  content: "→";
  display: inline-block;
  width: 1.6em;
  text-indent: 0;
  font-family: var(--mono);
  color: var(--amber);
}
.roles .at {
  margin-left: 6px;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--subtle);
}

/* ---- Photo ---- */
.photo .win-body {
  position: relative;
  padding: 0;
  min-height: 300px;
  overflow: hidden;
  background: var(--bar);
}
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% 50%;
  transform: scale(1.06);
  display: block;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.photo:hover img { transform: scale(1.1); }
.photo .caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}
@media (max-width: 820px) {
  .photo .win-body { min-height: 0; aspect-ratio: 4 / 3; }
}

/* ---- About ---- */
.md-h {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 8px;
}
.md-h span { color: var(--amber); }
.about-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}

/* ---- Links (ls) ---- */
.ls-total {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--subtle);
  margin: 0 0 6px;
}
.ls { display: flex; flex-direction: column; margin-inline: -10px; }
.ls-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg);
  text-decoration: none;
  transition: background 0.15s ease;
}
.ls-row:hover { background: var(--hover); }
.ls-perm { color: var(--subtle); }
.ls-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--blue);
}
.ls-name svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.15s ease;
}
.ls-row:hover .ls-name svg { color: var(--brand, var(--blue)); }
.ls-target {
  color: var(--subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ls-target::before { content: "→ "; }
.ls-arrow {
  color: var(--subtle);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ls-row:hover .ls-arrow { opacity: 1; transform: none; color: var(--fg); }
@media (max-width: 440px) {
  .ls-perm { display: none; }
  .ls-row { grid-template-columns: auto minmax(0, 1fr) auto; }
}

/* ---- Experience (git log) ---- */
.commits { display: flex; flex-direction: column; }
.commit {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 14px;
}
.graph { position: relative; }
.graph::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--blue), var(--amber));
  opacity: 0.4;
}
.commit:first-child .graph::before { top: 24px; }
.commit:last-child .graph::before { bottom: calc(100% - 24px); }
.node {
  position: absolute;
  left: 3px;
  top: 18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--blue);
}
.commit:first-child .node {
  border-color: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent);
}
.commit-main {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-block: 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.commit-main:hover { background: var(--hover); border-color: var(--border); }
.commit-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bar);
}
.commit-info { flex: 1; min-width: 200px; }
@media (max-width: 560px) {
  .commit-icon { display: none; }
}
.commit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  margin-bottom: 2px;
}
.hash { color: var(--amber); }
.ref {
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
  background: color-mix(in srgb, var(--green) 10%, transparent);
  padding: 0 7px;
  border-radius: 999px;
}
.commit-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}
.commit-org {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
}
.commit-date {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---- Contact ---- */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}
.contact-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--subtle);
  margin: 0 0 4px;
}
.contact-email {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 3.6vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  text-decoration: none;
  word-break: break-all;
  background-image: linear-gradient(var(--blue), var(--blue));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}
.contact-email:hover { background-size: 100% 2px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--hover); }
.btn.primary {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.btn.primary:hover { background: color-mix(in srgb, var(--fg) 85%, var(--bg)); }

/* ---- Status bar ---- */
.statusbar {
  display: flex;
  align-items: stretch;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--bar);
  color: var(--muted);
}
.statusbar > * { padding: 6px 12px; white-space: nowrap; }
.sb-mode {
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.sb-branch { border-right: 1px solid var(--border); }
.sb-fill {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-right { border-left: 1px solid var(--border); }
@media (max-width: 560px) {
  .sb-hide { display: none; }
}

/* ---- Reveal ---- */
.js .reveal { opacity: 0; transform: translateY(16px); }
.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

