/* ============================================================
   azimjon.com — clean developer aesthetic
   ============================================================ */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-serif: "Source Serif 4", Charter, "Iowan Old Style", "Apple Garamond", Georgia, serif;

  --max-w: 760px;
  --max-w-wide: 1080px;
  --header-h: 64px;
  --radius: 6px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- THEMES ---- */
:root,
[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-elev: #111113;
  --surface: #141417;
  --border: #1f1f23;
  --border-strong: #2a2a30;
  --text: #e5e5e7;
  --text-muted: #a0a0a8;
  --text-subtle: #6b6b73;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --accent-strong: #22c55e;
  --selection: rgba(74, 222, 128, 0.25);
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 8px 24px rgba(0,0,0,0.4);
  --grid-line: rgba(255, 255, 255, 0.025);
}

[data-theme="light"] {
  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --border: #e5e5e3;
  --border-strong: #d4d4d2;
  --text: #18181b;
  --text-muted: #525258;
  --text-subtle: #8a8a90;
  --accent: #16a34a;
  --accent-soft: rgba(22, 163, 74, 0.10);
  --accent-strong: #15803d;
  --selection: rgba(22, 163, 74, 0.18);
  --shadow: 0 1px 0 rgba(0,0,0,0.02), 0 8px 24px rgba(0,0,0,0.06);
  --grid-line: rgba(0, 0, 0, 0.035);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--selection); color: var(--text); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.15s var(--ease), opacity 0.15s var(--ease); }
ul, ol { padding: 0; margin: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
}
h1 { font-size: 2rem; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1rem; }

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.88em;
}
blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

/* ---- LAYOUT ---- */
.container {
  width: 100%;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 24px;
}
.container--narrow { max-width: var(--max-w); }
main { padding-top: var(--header-h); }
section { padding: 64px 0; }
section:first-of-type { padding-top: 80px; }

@media (max-width: 640px) {
  .container { padding: 0 18px; }
  section { padding: 48px 0; }
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.3rem; }
}

/* ---- HEADER ---- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand__prompt {
  color: var(--accent);
  font-weight: 600;
}
.brand__cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1.1s step-end infinite;
  vertical-align: middle;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 4px;
  position: relative;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a.is-active { color: var(--accent); }
.site-nav a.is-active::before { content: "/"; color: var(--text-subtle); margin-right: 1px; }

.theme-toggle {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  color: var(--text-muted);
  margin-left: 4px;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.burger {
  display: none;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  margin-left: 4px;
}
.burger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--text);
  position: relative;
}
.burger span::before, .burger span::after {
  content: ""; position: absolute; left: 0;
  width: 16px; height: 1.5px; background: var(--text);
  transition: transform 0.2s var(--ease);
}
.burger span::before { top: -5px; }
.burger span::after { top: 5px; }

@media (max-width: 720px) {
  .site-nav { display: none; }
  .burger { display: inline-flex; }
  .site-header.is-open .site-nav {
    display: flex;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    padding: 12px 18px 18px;
    gap: 2px;
  }
  .site-header.is-open .site-nav a { padding: 10px 12px; }
}

/* ---- HOME ---- */
.hero {
  padding-top: 120px;
  padding-bottom: 80px;
}
.hero__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  margin-bottom: 20px;
}
.hero__meta .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.hero__title {
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  letter-spacing: -0.035em;
  margin-bottom: 8px;
}
.hero__role {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.hero__role .accent { color: var(--accent); }
.hero__lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 56ch;
  margin: 0 0 32px;
}

.hero__actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 36px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #07140c;
}
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #07140c; opacity: 0.95; }
.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(2px); }

.socials {
  display: flex; align-items: center; gap: 14px;
}
.socials a {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.socials svg { width: 16px; height: 16px; }

/* terminal block */
.terminal {
  margin-top: 56px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.terminal__bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.terminal__bar i {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
  display: inline-block;
}
.terminal__bar .label {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
}
.terminal__body {
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text-muted);
}
.terminal__body .line { display: block; }
.terminal__body .prompt { color: var(--accent); user-select: none; }
.terminal__body .out { color: var(--text); }
.terminal__body .key { color: var(--text-subtle); }

/* ---- PAGE TITLE ---- */
.page-title {
  padding-top: 100px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.page-title__kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 8px;
}
.page-title__kicker::before { content: "~/"; color: var(--accent); }
.page-title h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  letter-spacing: -0.025em;
}
.page-title__sub {
  margin-top: 10px;
  color: var(--text-muted);
  max-width: 60ch;
}

/* ---- BLOG LIST ---- */
.archive {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.archive__year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  letter-spacing: 0.04em;
  padding: 28px 0 8px;
  position: sticky;
  top: var(--header-h);
  background: var(--bg);
  z-index: 2;
  display: flex; align-items: center; gap: 10px;
}
.archive__year::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.archive__year:first-child { padding-top: 0; }

.archive__list { display: flex; flex-direction: column; }
.archive__item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: baseline;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: padding 0.2s var(--ease);
}
.archive__item:last-child { border-bottom: none; }
.archive__item .date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
  white-space: nowrap;
}
.archive__item .title {
  font-size: 1.02rem;
  color: var(--text);
  line-height: 1.45;
  font-weight: 500;
}
.archive__item .arrow {
  font-family: var(--font-mono);
  color: var(--text-subtle);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s var(--ease);
}
.archive__item:hover { padding-left: 8px; }
.archive__item:hover .title { color: var(--accent); }
.archive__item:hover .arrow { opacity: 1; transform: translateX(0); color: var(--accent); }

@media (max-width: 640px) {
  .archive__item {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px 0;
  }
  .archive__item:hover { padding-left: 0; }
  .archive__item .arrow { display: none; }
}

/* ---- ARTICLE ---- */
.progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}
.progress-bar .bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.05s linear;
}

.article {
  max-width: var(--max-w);
  margin: 0 auto;
}
.article__header {
  padding-top: 80px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.article__kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 16px;
}
.article__kicker::before { content: "~/blog/"; color: var(--accent); }
.article__title {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.article__meta {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
}
.article__meta .badge {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.edit-article {
  margin-left: auto;
  color: var(--text-subtle);
  font-size: 0.78rem;
}
.edit-article:hover { color: var(--accent); }

.article__body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
}
.article__body > * + * { margin-top: 1.1em; }
.article__body h2 { font-size: 1.5rem; margin-top: 2.2em; margin-bottom: 0.4em; }
.article__body h3 { font-size: 1.2rem; margin-top: 1.8em; margin-bottom: 0.4em; }
.article__body p { margin: 0 0 1.1em; color: var(--text); }
.article__body a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.article__body a:hover { border-bottom-color: var(--accent); }
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 1em 0; }
.article__body ul li { list-style: disc; margin-bottom: 0.4em; }
.article__body ol li { list-style: decimal; margin-bottom: 0.4em; }
.article__body img { border-radius: var(--radius); margin: 1.5em auto; border: 1px solid var(--border); }
.article__body figure { margin: 2em 0; text-align: center; }
.article__body figcaption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 8px;
}
.article__body .figure_wrapper { display: block; }
.article__body iframe { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: var(--radius); }

/* article navigation */
.article-nav {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}
.article-nav a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 4px;
}
.article-nav a:hover { color: var(--accent); background: var(--surface); }
.article-nav .prev { text-align: left; }
.article-nav .next { text-align: right; }
@media (max-width: 640px) {
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .next, .article-nav .prev { text-align: left; }
}

/* ---- NEWSLETTER ---- */
.subscribe {
  margin: 56px 0 0;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.subscribe::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px circle at 0% 0%, var(--accent-soft), transparent 50%);
  pointer-events: none;
}
.subscribe h6 {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}
.subscribe h6::before { content: "$ subscribe — "; color: var(--text-subtle); }
.subscribe p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  position: relative;
}
.subscribe a { color: var(--accent); border-bottom: 1px dashed currentColor; }
.subscribe a:hover { border-bottom-style: solid; }

/* ---- TALKS ---- */
.talks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.talk-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.talk-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.talk-card__media {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.talk-card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.talk-card:hover .talk-card__media img { transform: scale(1.04); }
.talk-card__body { padding: 16px 18px 18px; }
.talk-card__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 6px;
}
.talk-card__title {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}
.talk-card:hover .talk-card__title { color: var(--accent); }

/* ---- ABOUT ---- */
.prose {
  max-width: var(--max-w);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.75;
}
.prose p { color: var(--text); margin-bottom: 1.2em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose figure { margin: 2.2em 0; text-align: center; }
.prose figure img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 0 auto;
}
.prose figcaption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 10px;
}
.prose .figure_wrapper { display: block; }

/* ---- CV ---- */
.cv { max-width: var(--max-w); margin: 0 auto; }
.cv-section { margin-bottom: 48px; }
.cv-section__title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: 0.02em;
}
.cv-section__title::before { content: "##"; color: var(--text-subtle); }

.cv-entry { padding: 14px 0; border-bottom: 1px dashed var(--border); }
.cv-entry:last-child { border-bottom: none; }
.cv-entry__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.cv-entry__role {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
}
.cv-entry__org { color: var(--text-muted); font-weight: 500; }
.cv-entry__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-subtle);
  white-space: nowrap;
}
.cv-entry ul {
  padding-left: 1.2em;
  margin: 8px 0 0;
  color: var(--text-muted);
}
.cv-entry ul li {
  list-style: "—  ";
  margin-bottom: 6px;
  padding-left: 4px;
  line-height: 1.6;
}

/* ---- FOOTER ---- */
.site-footer {
  margin-top: 96px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
}
.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer__links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---- UTIL ---- */
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
