/* ─── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Themes ─────────────────────────────────────────────────── */
:root {
  --bg-base: #ece8e0;
  --bg: #f0ece5;
  --bg-2: rgba(255, 255, 252, 0.55);
  --bg-elevated: rgba(255, 255, 253, 0.82);
  --border: rgba(60, 55, 48, 0.12);
  --border-subtle: rgba(60, 55, 48, 0.07);
  --text: #2a2722;
  --text-dim: #6f6a62;
  --text-head: #141210;
  --accent: #3d5afe;
  --accent-soft: rgba(61, 90, 254, 0.12);
  --accent-2: #0d9488;
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --max-w: 920px;
  --gutter: 2rem;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(30, 26, 20, 0.05), 0 4px 12px rgba(30, 26, 20, 0.04);
  --shadow-md: 0 2px 6px rgba(30, 26, 20, 0.06), 0 10px 28px rgba(30, 26, 20, 0.07);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-base: #0a0c10;
  --bg: #101218;
  --bg-2: rgba(255, 255, 255, 0.04);
  --bg-elevated: rgba(24, 28, 36, 0.88);
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --text: #d8dce4;
  --text-dim: #848b9a;
  --text-head: #f2f4f8;
  --accent: #6b8cff;
  --accent-soft: rgba(107, 140, 255, 0.14);
  --accent-2: #4ec9a8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 14px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* ─── Base ───────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  background: var(--bg-base);
}

body {
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: color 0.35s var(--ease);
}

/* Full-viewport background theme */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 130% 90% at 50% -25%, rgba(99, 120, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 90% 70% at 100% 40%, rgba(13, 148, 136, 0.09), transparent 50%),
    radial-gradient(ellipse 80% 65% at 0% 75%, rgba(99, 120, 255, 0.08), transparent 50%),
    linear-gradient(180deg, #f2eee6 0%, var(--bg-base) 45%, #e6e2da 100%);
  transition: background-color 0.4s var(--ease), opacity 0.4s var(--ease);
}

html[data-theme="dark"] .site-bg {
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 130% 85% at 50% -20%, rgba(80, 110, 220, 0.16), transparent 55%),
    radial-gradient(ellipse 85% 65% at 100% 55%, rgba(60, 180, 160, 0.08), transparent 50%),
    radial-gradient(ellipse 75% 60% at 0% 25%, rgba(80, 110, 220, 0.1), transparent 50%),
    linear-gradient(180deg, #12151c 0%, var(--bg-base) 50%, #080a0e 100%);
}

.site-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--accent-soft);
  color: var(--text-head);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Theme Toggle ───────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.theme-toggle:hover {
  color: var(--text-head);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 0 3px var(--accent-soft);
}

.theme-toggle:active {
  transform: translateY(0);
}

html[data-theme="dark"] .theme-icon-light {
  display: none;
}

html[data-theme="dark"] .theme-icon-dark {
  display: inline;
}

html[data-theme="light"] .theme-icon-dark {
  display: none;
}

html[data-theme="light"] .theme-icon-light {
  display: inline;
}

/* ─── Main ───────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem var(--gutter) 3.5rem;
  width: 100%;
}

/* ─── Profile ────────────────────────────────────────────────── */
.profile-intro {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #3d5afe 0%, #7c3aed 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.35rem;
  user-select: none;
  box-shadow: 0 4px 16px rgba(61, 90, 254, 0.25), 0 0 0 3px var(--bg), 0 0 0 4px var(--border);
}

html[data-theme="dark"] .avatar {
  background: linear-gradient(145deg, #6b8cff 0%, #a78bfa 100%);
  box-shadow: 0 4px 20px rgba(107, 140, 255, 0.2), 0 0 0 3px var(--bg), 0 0 0 4px var(--border);
}

.avatar-photo {
  object-fit: cover;
  background: none;
  display: block;
}

.profile-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-head);
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.profile-tagline {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
  letter-spacing: 0.01em;
}

.profile-bio p {
  font-size: 0.975rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 0.85rem;
  max-width: 68ch;
}

.profile-bio p:last-child {
  margin-bottom: 0;
}

.social-links {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.social-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ─── Sections ───────────────────────────────────────────────── */
.section {
  margin-top: 3rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.35rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

.page-header {
  margin-bottom: 0.5rem;
}

/* ─── Timeline (company block) ───────────────────────────────── */
.timeline-company {
  padding: 1.35rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.timeline-company-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-bottom: 1.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.company-logo-lg {
  width: auto;
  height: 32px;
  max-width: 88px;
}

html[data-theme="dark"] .company-logo-light {
  display: none;
}

html[data-theme="light"] .company-logo-dark {
  display: none;
}

.timeline-company-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-head);
  letter-spacing: -0.01em;
}

.timeline-company-span {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}

.timeline-roles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-role-item {
  position: relative;
  padding: 1.25rem 0 1.25rem 1.1rem;
  border-left: 2px solid var(--border);
  margin-left: 0.35rem;
}

.timeline-role-item:first-child {
  padding-top: 0.5rem;
}

.timeline-role-item:first-child::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0.5rem;
  width: 2px;
  height: 1.5rem;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-role-item:last-child {
  padding-bottom: 0;
}

.timeline-role-item::after {
  content: '';
  position: absolute;
  left: -0.35rem;
  top: 1.65rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--text-dim);
}

.timeline-role-item:first-child::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline-role-period {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.timeline-role-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-head);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.timeline-desc strong {
  font-weight: 600;
  color: var(--text-head);
}

.timeline-role-item .profile-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.timeline-results {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.timeline-results li {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.65;
}

.timeline-results strong {
  font-weight: 600;
  color: var(--text-head);
}

/* ─── Education ──────────────────────────────────────────────── */
.education-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.education-item {
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.education-degree {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-head);
  margin-bottom: 0.15rem;
}

.education-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ─── Timeline (legacy) ──────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 1.1rem;
  border-left: 2px solid var(--border);
}

.timeline::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  width: 2px;
  height: 2.5rem;
  background: linear-gradient(to bottom, var(--accent), transparent);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem 1.35rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:first-child .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.timeline-dot {
  position: absolute;
  left: -1.52rem;
  top: 0.5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--text-dim);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.timeline-content {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-left: -0.5rem;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.timeline-content:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.6rem;
}

.company-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-top: 0.05rem;
  object-fit: contain;
}

.timeline-header-text {
  min-width: 0;
}

.timeline-role {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-head);
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.timeline-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.timeline-desc {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.7;
}

.timeline-content .profile-list {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Profile lists ──────────────────────────────────────────── */
.profile-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.profile-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.65;
}

.profile-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}

/* ─── Stack ──────────────────────────────────────────────────── */
.stack-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.35rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.stack-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stack-group + .stack-group {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.stack-cat {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stack-tag {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.stack-tag-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.stack-tag-note {
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
  background: transparent;
  border-style: dashed;
}

.stack-tag-muted {
  color: var(--text-dim);
  background: transparent;
  border-style: dashed;
  opacity: 0.75;
}

.stack-context {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-top: 0.15rem;
}

/* ─── Blog page ──────────────────────────────────────────────── */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-list-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  padding: 1.15rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: baseline;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.post-list-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.post-list-date {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.post-list-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-head);
  letter-spacing: -0.01em;
}

.post-list-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-list-desc {
  grid-column: 2;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  line-height: 1.55;
}

.empty-state {
  font-size: 0.9rem;
  color: var(--text-dim);
  padding: 2rem;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ─── Post ───────────────────────────────────────────────────── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-header time {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-head);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.post-desc {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.65;
  max-width: 68ch;
}

.post-content {
  font-size: 0.975rem;
  line-height: 1.85;
}

.post-content h2 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin: 2.75rem 0 1rem;
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-head);
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--accent);
}

.post-content code {
  font-family: var(--mono);
  font-size: 0.83rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 0.12em 0.45em;
  border-radius: var(--radius-sm);
  color: var(--accent-2);
}

.post-content pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--text-dim);
  margin: 1.5rem 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-footer a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.15s var(--ease);
}

.post-footer a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.site-footer span {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.01em;
}

.footer-links {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.footer-links .social-link {
  margin: 0;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root {
    --gutter: 1.15rem;
  }

  main {
    padding: 2.75rem var(--gutter) 2.5rem;
  }

  .profile-name {
    font-size: 1.65rem;
  }

  .timeline-content {
    padding: 0.85rem 0.75rem;
    margin-left: -0.35rem;
  }

  .timeline-company {
    padding: 1.1rem 1rem;
  }

  .timeline-role-item {
    padding-left: 0.85rem;
    margin-left: 0.2rem;
  }

  .stack-card {
    padding: 1.1rem 1rem;
  }

  .post-list-item {
    padding: 1rem;
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .post-list-date {
    grid-row: 1;
  }

  .post-list-desc {
    grid-column: 1;
  }

  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
