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

:root {
  --base: #0d0b09;
  --cream: #f3efe6;
  --cream-soft: rgba(243, 239, 230, 0.7);
  --cream-dim: rgba(243, 239, 230, 0.46);
  --hairline: rgba(243, 239, 230, 0.16);
  --glass-bg: rgba(243, 239, 230, 0.06);
  --glass-border: rgba(243, 239, 230, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --surface-glass: linear-gradient(
    165deg,
    rgba(32, 28, 24, 0.84) 0%,
    rgba(13, 11, 9, 0.72) 100%
  );
  --surface-nav: rgba(16, 14, 12, 0.62);
}

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--base);
  color: var(--cream);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  display: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Fixed background layers ── */

.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, transparent 30%, rgba(13, 11, 9, 0.55) 100%),
    linear-gradient(
      to bottom,
      rgba(13, 11, 9, 0.72) 0%,
      rgba(13, 11, 9, 0.08) 28%,
      rgba(13, 11, 9, 0.04) 50%,
      rgba(13, 11, 9, 0.08) 72%,
      rgba(13, 11, 9, 0.78) 100%
    );
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 220px 70px var(--base);
}

main {
  position: relative;
  z-index: 3;
}

/* ── Top-right liquid glass navigation ── */

.glass-nav-wrap {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 200;
  pointer-events: none;
  transform: translateZ(0);
  contain: layout style;
}

.glass-nav {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.5rem;
  border-radius: 100px;
  background: transparent;
  border: none;
  pointer-events: auto;
  overflow: hidden;
  transform: translateZ(0);
}

.glass-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--surface-nav);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.14);
  z-index: 0;
  transform: translateZ(0);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass-nav::before {
    background: linear-gradient(
      145deg,
      rgba(243, 239, 230, 0.12) 0%,
      rgba(13, 11, 9, 0.55) 100%
    );
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    backdrop-filter: blur(18px) saturate(1.35);
  }
}

.glass-nav > * {
  position: relative;
  z-index: 1;
}

.glass-nav-link {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--cream-dim);
  padding: 0.55rem 1rem;
  border-radius: 100px;
  white-space: nowrap;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.glass-nav-link::before {
  content: '';
  position: absolute;
  bottom: 0.3rem;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 1.1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--cream);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.glass-nav-link:hover {
  color: var(--cream-soft);
  background: rgba(243, 239, 230, 0.06);
  transform: translateY(-1px);
}

.glass-nav-link.is-active {
  color: var(--cream);
  background: rgba(243, 239, 230, 0.1);
}

.glass-nav-link.is-active::before {
  transform: translateX(-50%) scaleX(1);
}

.glass-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.glass-nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.glass-nav-divider {
  width: 1px;
  height: 1.25rem;
  background: var(--hairline);
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.glass-nav-external {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 100px;
  color: var(--cream-dim);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.glass-nav-external:hover {
  color: var(--cream);
  background: rgba(243, 239, 230, 0.06);
  transform: translateY(-1px);
}

.glass-nav-external svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.15rem;
  border-radius: 100px;
  background: rgba(243, 239, 230, 0.04);
  border: 1px solid rgba(243, 239, 230, 0.08);
}

.lang-switch-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  background: transparent;
  border: none;
  border-radius: 100px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.lang-switch-btn:hover {
  color: var(--cream-soft);
}

.lang-switch-btn.is-active {
  color: var(--cream);
  background: rgba(243, 239, 230, 0.12);
}

/* ── Page layout ── */

.page {
  min-height: 100vh;
  padding: 7.5rem 2.5rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-bottom: 1.5rem;
}

.page-heading {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--cream);
  margin-bottom: 1.25rem;
}

.page-lead {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--cream-soft);
  max-width: 560px;
  margin-bottom: 3.5rem;
}

/* ── Cards ── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.project-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 1100px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  border-radius: 20px;
  border: 1px solid var(--hairline);
  background: var(--surface-glass);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 2rem 1.75rem;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.35s ease;
  contain: content;
}

.card-compact {
  padding: 1.1rem 1.15rem 1.15rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.card-compact:hover {
  transform: translateY(-2px);
  border-color: rgba(243, 239, 230, 0.22);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem 0.2rem 0.2rem;
  border-radius: 100px;
  background: rgba(243, 239, 230, 0.06);
  border: 1px solid var(--hairline);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream-soft);
}

.lang-icon {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.lang-icon img {
  width: 0.8rem;
  height: 0.8rem;
  object-fit: contain;
}

.lang-icon-fallback {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 600;
  color: var(--cream);
  line-height: 1;
}

.star-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  color: var(--cream-dim);
  padding: 0.25rem 0.45rem;
  border-radius: 100px;
  background: rgba(243, 239, 230, 0.04);
  border: 1px solid rgba(243, 239, 230, 0.08);
}

.star-badge svg {
  width: 0.65rem;
  height: 0.65rem;
  fill: var(--cream-dim);
}

.card-compact .card-title {
  font-size: 1.05rem;
  margin-bottom: 0;
  line-height: 1.25;
}

.card-compact .card-copy {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-compact .card-link {
  font-size: 0.75rem;
  margin-top: auto;
  padding-top: 0.15rem;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(243, 239, 230, 0.24);
}

.card-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6875rem;
  color: var(--cream-dim);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--cream);
  margin-bottom: 0.75rem;
}

.card-copy {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--cream-soft);
  margin-bottom: 1.25rem;
}

.card-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.card-link svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* ── CTA pill ── */

.cta-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(20, 18, 16, 0.72);
  border: 1px solid var(--hairline);
  border-radius: 100px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 0.35rem 0.35rem 0.35rem 1.5rem;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cta-pill:hover {
  transform: translateY(-2px);
}

.cta-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cream);
  white-space: nowrap;
}

.cta-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(243, 239, 230, 0.1);
  border: 1px solid var(--hairline);
  margin-left: 1rem;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.cta-pill:hover .cta-icon {
  transform: rotate(45deg);
}

.cta-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--cream);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Blog post content ── */

.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--hairline);
}

.post-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--cream-dim);
  margin-bottom: 1rem;
}

.post-title {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--cream);
}

.post-body {
  max-width: 680px;
  color: var(--cream-soft);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.post-body h2,
.post-body h3 {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 600;
  color: var(--cream);
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem;
}

.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.2rem; }

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

.post-body a {
  color: var(--cream);
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.3s ease;
}

.post-body a:hover {
  border-color: var(--cream-soft);
}

.post-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(243, 239, 230, 0.08);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.15em 0.45em;
}

.post-body pre {
  background: rgba(8, 8, 10, 0.55);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 0;
}

.post-body .code-block {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 14px;
  border: 1px solid rgba(243, 239, 230, 0.12);
  background: rgba(8, 8, 10, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.post-body .code-block-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-dim);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(243, 239, 230, 0.08);
  background: rgba(243, 239, 230, 0.03);
}

.post-body .code-block pre {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
}

.post-body .code-block code,
.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  font-family: 'JetBrains Mono', monospace;
}

.post-body code.inline-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(243, 239, 230, 0.08);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.15em 0.45em;
  color: #e6db74;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.post-body blockquote {
  border-left: 2px solid var(--hairline);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--cream-dim);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25rem 1.25rem;
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 2.5rem 0;
}

.post-body img {
  max-width: 100%;
  border-radius: 12px;
  margin: 1.5rem 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--cream-dim);
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--cream-soft);
}

.back-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.loading {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--cream-dim);
  letter-spacing: 0.08em;
}

.error-msg {
  color: var(--cream-dim);
  font-size: 0.9375rem;
}

/* ── Footer ── */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  border-top: 1px solid var(--hairline);
}

.footer-wordmark {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--cream);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--cream-dim);
}

.footer-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--cream-dim);
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--cream-soft);
}

/* ── Motion ── */

@keyframes blurFadeUp {
  from {
    opacity: 0;
    filter: blur(18px);
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.rise {
  opacity: 0;
  animation: blurFadeUp 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.rise-d0 { animation-delay: 0ms; }
.rise-d1 { animation-delay: 80ms; }
.rise-d2 { animation-delay: 160ms; }
.rise-d3 { animation-delay: 240ms; }
.rise-d4 { animation-delay: 320ms; }

@keyframes navFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-enter {
  opacity: 0;
  animation: navFadeIn 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s cubic-bezier(0.2, 0.7, 0.2, 1),
              transform 0.85s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

@media (prefers-reduced-motion: reduce) {
  .rise {
    opacity: 1;
    animation: none;
    filter: none;
    transform: none;
  }

  .nav-enter {
    opacity: 1;
    animation: none;
    transform: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cta-pill:hover,
  .card:hover,
  .glass-nav-link:hover,
  .glass-nav-external:hover {
    transform: none;
  }

  .cta-pill:hover .cta-icon {
    transform: none;
  }

  .glass-nav::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(16, 14, 12, 0.88);
  }
}

@media (max-width: 900px) {
  .glass-nav-wrap {
    top: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .glass-nav {
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .glass-nav::-webkit-scrollbar {
    display: none;
  }

  .glass-nav-link,
  .glass-nav-external {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    gap: 0.35rem;
  }

  .glass-nav-label-mobile-hide {
    display: none;
  }

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

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

  .footer {
    flex-direction: column;
    gap: 1.25rem;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}
