:root {
  --bg: #050505;
  --bg-alt: #0c0c0c;
  --fg: #f5f5f5;
  --muted: #a0a0a0;
  --accent: #ffffff;
  --link-muted: #888888;
  --nav-link: #60a5fa;
  --border-subtle: #1e1e1e;

  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Theme applied on <html> so inline head script can set it before first paint */
html.theme-dark {
  --bg: #050505;
  --bg-alt: #0c0c0c;
  --fg: #f5f5f5;
  --muted: #a0a0a0;
  --link-muted: #888888;
  --nav-link: #60a5fa;
  --border-subtle: #1e1e1e;
}

html.theme-light {
  --bg: #F5E7C6;
  --bg-alt: #ffffff;
  --fg: #020617;
  --muted: #4b5563;
  --link-muted: #6b7280;
  --nav-link: #2563eb;
  --border-subtle: #e5e7eb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.page {
  min-height: 100vh;
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.avatar-wrapper {
  display: flex;
  align-items: center;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #202020, #111111);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.4s ease;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-initials {
  font-size: 20px;
  text-transform: lowercase;
  color: var(--fg);
  letter-spacing: 0.08em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  text-transform: lowercase;
}

.nav-link {
  color: var(--link-muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  font-weight: 400;
  transition: color 0.4s ease;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link-active {
  color: var(--fg);
}

.theme-toggle {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0 0;
  transition: color 0.4s ease, transform 0.15s ease;
}

.theme-toggle i {
  font-size: 18px;
}

.theme-icon-sun,
.theme-icon-moon {
  transition: opacity 0.3s ease;
}

.theme-icon-sun {
  display: none;
}

html.theme-light .theme-icon-sun {
  display: inline;
}

html.theme-light .theme-icon-moon {
  display: none;
}

html.theme-dark .theme-icon-sun {
  display: none;
}

html.theme-dark .theme-icon-moon {
  display: inline;
}

.theme-toggle:hover {
  color: var(--fg);
  transform: translateY(-1px);
}

html.theme-light .theme-toggle {
  color: #f4a743;
}

/* Command palette / navigator */
.command-palette-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.command-palette-btn:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.command-palette-btn .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.command-palette-btn .plus {
  color: var(--muted);
  font-size: 11px;
  margin: 0 2px;
  transition: color 0.4s ease;
}

.command-palette-fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 999;
  /* below palette overlay (1000) */
}

.command-palette-fab:focus-visible {
  outline: 2px solid var(--nav-link);
  outline-offset: 3px;
}

.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 15vh 16px 0;
  animation: palette-fade 0.2s ease;
}

.palette-overlay.is-open {
  display: flex;
}

@keyframes palette-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.palette-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: palette-slide 0.2s ease;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

@keyframes palette-slide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.palette-search-wrap {
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.4s ease;
}

.palette-search {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  outline: none;
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.palette-search::placeholder {
  color: var(--muted);
}

.palette-search:focus {
  border-color: var(--nav-link);
}

.palette-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 0;
}

.palette-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--font-mono);
  text-align: left;
  text-decoration: none;
  letter-spacing: 0.06em;
  color: var(--nav-link);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.4s ease;
}

.palette-item:hover,
.palette-item.is-selected {
  background: var(--bg);
  color: var(--nav-link);
}

.palette-item span {
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.palette-item span::before {
  content: "• ";
}

.palette-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color 0.4s ease, color 0.4s ease;
}

.content {
  width: 100%;
  max-width: 720px;
}

.hero-title {
  font-size: clamp(32px, 5vw, 40px);
  font-weight: 600;
  margin: 0 0 40px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.about {
  font-size: 15px;
  font-weight: var(--font-mono);
  line-height: 1.7;
  color: var(--muted);
}

.section-title {
  font-size: 14px;
  text-transform: lowercase;
  margin: 0 0 16px;
  color: var(--fg);
  letter-spacing: 0.12em;
}

.about p {
  margin: 0 0 6px;
}

.text-strong {
  color: var(--fg);
  font-weight: 600;
}

.text-italic {
  font-style: italic;
}

.footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  transition: border-color 0.4s ease;
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

.blog-loading {
  color: var(--muted);
  font-size: 14px;
}

.blog-card {
  display: flex;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.4s ease, color 0.4s ease;
}

.blog-card:last-of-type {
  border-bottom: none;
}

.blog-card-image {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  background: var(--bg-alt);
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.blog-card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.blog-card-title {
  font-size: 15px;
  color: var(--fg);
  text-decoration: none;
}

.blog-card-title:hover {
  text-decoration: underline;
}

.blog-card-meta {
  font-size: 12px;
  color: var(--muted);
}

.blog-card-excerpt {
  font-size: 13px;
  color: var(--muted);
}

.social-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.social-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
  transition: color 0.4s ease, transform 0.15s ease;
}

.social-link:hover {
  color: var(--fg);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .page {
    padding: 24px 16px 32px;
  }

  .site-header {
    margin-bottom: 32px;
  }

  .nav {
    gap: 16px;
    font-size: 13px;
  }
}