/* ---------------------------------------------------------------
   Theme tokens
   --------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f8fafc;
  --bg-alt: #ffffff;
  --bg-subtle: #f1f5f9;
  --header-bg: rgba(248, 250, 252, 0.86);

  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #3730a3;
  --accent-contrast: #ffffff;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 40px -24px rgba(15, 23, 42, 0.35);

  --radius: 16px;
  --radius-sm: 10px;
  --max-width: 1120px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b1120;
  --bg-alt: #111827;
  --bg-subtle: #0f172a;
  --header-bg: rgba(11, 17, 32, 0.86);

  --text: #e5e7eb;
  --text-muted: #a5b4c4;
  --text-subtle: #7c8ba1;

  --border: #1f2937;
  --border-strong: #334155;

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: #1e1b4b;
  --accent-text: #c7d2fe;
  --accent-contrast: #0b1120;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 20px 44px -24px rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------------
   Base
   --------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.container {
  width: min(100% - 2.5rem, var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--accent-contrast);
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede {
  max-width: 36rem;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

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

.small {
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------
   Header and navigation
   --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand-dot {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.site-nav a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

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

.theme-toggle .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

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

/* ---------------------------------------------------------------
   Buttons and links
   --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn-secondary {
  background: var(--bg-alt);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.8rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-text);
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
}

.text-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

.social-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.social-links a:hover {
  color: var(--accent-text);
}

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */

.hero {
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 5rem);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero-visual {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 5% 0 0 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 68%);
  filter: blur(10px);
  z-index: 0;
}

.avatar {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 110px;
  height: 110px;
  margin-bottom: -1.5rem;
  border: 4px solid var(--bg);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #06b6d4);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  box-shadow: var(--shadow);
}

.code-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: var(--shadow);
  transform: rotate(1.5deg);
}

.code-card__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #22c55e; }

.code-card__title {
  margin-left: 0.6rem;
  color: var(--text-subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}

.code-card pre {
  margin: 0;
  padding: 1.1rem 1.2rem 1.3rem;
  overflow-x: auto;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.75;
}

.token-keyword { color: #a855f7; }
.token-string { color: #0ea5e9; }

[data-theme="dark"] .token-keyword { color: #d8b4fe; }
[data-theme="dark"] .token-string { color: #7dd3fc; }

/* ---------------------------------------------------------------
   Sections and cards
   --------------------------------------------------------------- */

.section {
  padding: clamp(3.5rem, 7vw, 5.5rem) 0;
}

.section-alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section-header {
  margin-bottom: 2rem;
}

.section-header > p:last-child {
  max-width: 42rem;
  color: var(--text-muted);
}

.section-header--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.section-header--split h2 {
  margin-bottom: 0;
}

.card {
  padding: 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin-bottom: 0.75rem;
}

.card > p:last-child,
.card > div > p:last-child {
  margin-bottom: 0;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.about-grid .card {
  padding: clamp(1.5rem, 3vw, 2rem);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.project-card > p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.project-card .text-link {
  margin-top: auto;
  padding-top: 1rem;
}

.project-image {
  display: block;
  width: 100%;
  height: 150px;
  margin-bottom: 1.25rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  object-fit: contain;
}

.tag-list,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-list {
  margin-bottom: 1rem;
}

.tag-list li,
.chip-list li {
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 550;
  line-height: 1.6;
}

.chip-list {
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.chip-list li {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------
   Profile links
   --------------------------------------------------------------- */

.profile-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.profile-card > p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.profile-card .text-link {
  margin-top: auto;
  padding-top: 1rem;
}

.profile-icon {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  margin-bottom: 1.1rem;
  border-radius: var(--radius-sm);
}

.profile-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.profile-icon--github {
  background: #eef1f5;
  color: #24292f;
}

.profile-icon--linkedin {
  background: #e8f3ff;
  color: #0a66c2;
}

.profile-icon--salesforce {
  background: #e9f5ff;
  color: #0176d3;
}

[data-theme="dark"] .profile-icon--github {
  background: #1e293b;
  color: #f0f6fc;
}

[data-theme="dark"] .profile-icon--linkedin {
  background: #12283f;
  color: #7dc4ff;
}

[data-theme="dark"] .profile-icon--salesforce {
  background: #0d2b45;
  color: #7dd3fc;
}

/* ---------------------------------------------------------------
   Blog list
   --------------------------------------------------------------- */

.post-list {
  display: grid;
  gap: 1rem;
}

.post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-row:hover {
  border-color: var(--border-strong);
  transform: translateX(3px);
}

.post-row h3 {
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
}

.post-row h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-row h3 a:hover {
  color: var(--accent-text);
}

.post-row > div > p:last-child {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.post-meta {
  margin-bottom: 0.35rem;
  color: var(--text-subtle);
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.01em;
}

.post-row__arrow {
  flex: 0 0 auto;
  color: var(--text-subtle);
  font-size: 1.4rem;
}

/* ---------------------------------------------------------------
   Page headers, filters, contact, 404
   --------------------------------------------------------------- */

.page-header {
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.page-header .lede {
  max-width: 46rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0 2rem;
}

.filter-btn {
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.filter-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.contact-section {
  padding-top: 0;
}

.contact-card {
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-alt) 70%);
  text-align: center;
}

.contact-card .lede,
.contact-card > p:not(.eyebrow) {
  margin-inline: auto;
  max-width: 36rem;
  color: var(--text-muted);
}

.contact-card .hero-actions {
  justify-content: center;
}

.empty-state {
  padding: 3rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

.not-found {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding: 4rem 0;
  text-align: center;
}

.not-found__code {
  margin: 0;
  color: var(--accent);
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
}

.not-found .lede {
  margin-inline: auto;
}

.not-found .hero-actions {
  justify-content: center;
}

/* ---------------------------------------------------------------
   Article styles
   --------------------------------------------------------------- */

.article {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

.article-layout {
  width: min(100% - 2.5rem, 760px);
  margin-inline: auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-text);
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  margin-bottom: 0.8rem;
}

.article-header .post-meta {
  font-size: 0.85rem;
}

.article-header .tag-list {
  margin: 1.2rem 0 0;
}

.prose {
  color: var(--text);
  font-size: 1.02rem;
}

.prose h2 {
  margin-top: 2.5rem;
  font-size: 1.55rem;
}

.prose h3 {
  margin-top: 2rem;
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: 1.2rem;
  color: var(--text-muted);
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
  list-style: disc;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose strong {
  color: var(--text);
}

.prose blockquote {
  margin: 1.8rem 0;
  padding: 0.6rem 0 0.6rem 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

.prose :not(pre) > code {
  padding: 0.15em 0.4em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-subtle);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.prose pre {
  margin: 1.8rem 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.7;
}

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

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-inner p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-text);
}

/* ---------------------------------------------------------------
   Reveal animation (only when JS is available)
   --------------------------------------------------------------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 260px;
    max-width: 480px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }

  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding-bottom: 0.4rem;
    overflow-x: auto;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .section-header--split {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .post-row {
    align-items: flex-start;
    padding: 1.25rem;
  }

  .post-row__arrow {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .container,
  .article-layout {
    width: min(100% - 1.75rem, var(--max-width));
  }

  .code-card {
    transform: none;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  html.js .reveal {
    opacity: 1;
    transform: none;
  }
}
