:root {
  --black: #0A0A0A;
  --white: #F7F7F5;
  --gray-mid: #6B6B6B;
  --gray-line: #D8D8D4;
  --accent: #3D5A4C;
  --accent-soft: #E7ECE8;

  --display: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --sans: 'Inter', -apple-system, sans-serif;

  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Scroll reveal: quiet fade + rise, once per element */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

html { scrollbar-color: var(--accent) var(--white); scrollbar-width: thin; }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--white); }
::-webkit-scrollbar-thumb { background: var(--gray-line); border-radius: 100px; border: 3px solid var(--white); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Nav ---------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 32px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-logo:hover { transform: rotate(-4deg) scale(1.05); }
.nav-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.nav-logo:hover .dot { color: #7FA88F; }

.nav-links {
  display: flex;
  gap: 32px;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--black);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.15s ease;
}
.nav-links a:hover { border-color: var(--accent); }

.nav-github {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.9rem;
  border: 1px solid var(--black);
  padding: 8px 14px;
  border-radius: 100px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-github:hover { background: var(--black); color: var(--white); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-bmc {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--gray-line);
  border-radius: 100px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--black);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.nav-bmc:hover { border-color: var(--black); background: var(--accent-soft); transform: translateY(-1px); }
.nav-bmc img { display: block; flex-shrink: 0; }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-bmc span { display: none; }
  .nav-bmc { width: 38px; height: 38px; padding: 0; justify-content: center; }
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 32px 100px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero-kicker {
  font-family: 'Space Mono', var(--sans), monospace;
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 0 20px;
  letter-spacing: 0.01em;
}

.type-cursor {
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .type-cursor { animation: none; }
}

.hero-text h1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 5.4vw, 4.4rem);
  line-height: 1.02;
  font-weight: 700;
  margin: 0 0 28px;
  letter-spacing: -0.03em;
  opacity: 0;
  transform: translateY(14px);
  animation: hero-rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.5s;
}

@keyframes hero-rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-text h1 { opacity: 1; transform: none; animation: none; }
}

.hero-lead {
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--gray-mid);
  max-width: 46ch;
  margin: 0 0 36px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: 100px;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 24px -8px rgba(61, 90, 76, 0.55); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-ghost { border: 1px solid var(--gray-line); color: var(--black); }
.btn-ghost:hover { border-color: var(--black); transform: translateY(-2px); }
.btn-ghost:active { transform: translateY(0); }
.btn-wide { width: 100%; text-align: center; }

/* Hero diagram */
.hero-diagram { display: flex; justify-content: center; }
.flow-svg { width: 100%; max-width: 380px; height: auto; }

.flow-line {
  stroke: var(--gray-line);
  stroke-width: 1.5;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: draw 1.4s ease forwards 0.2s;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.flow-node {
  fill: var(--white);
  stroke: var(--gray-mid);
  stroke-width: 1.5;
  opacity: 0;
  animation: appear 0.4s ease forwards;
}
.flow-node:nth-of-type(2) { animation-delay: 0.5s; }
.flow-node:nth-of-type(3) { animation-delay: 0.9s; }
.flow-node:nth-of-type(4) { animation-delay: 1.3s; }
.flow-node-accent { fill: var(--accent); stroke: var(--accent); }

@keyframes appear { to { opacity: 1; } }

.flow-label {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  fill: var(--black);
}
.flow-sub {
  font-family: var(--sans);
  font-size: 12px;
  fill: var(--gray-mid);
}
.flow-label-accent { fill: var(--accent); }

.flow-svg text { opacity: 0; animation: appear 0.4s ease forwards; }
.flow-svg text:nth-child(6) { animation-delay: 0.45s; }
.flow-svg text:nth-child(7) { animation-delay: 0.5s; }
.flow-svg text:nth-child(8) { animation-delay: 0.85s; }
.flow-svg text:nth-child(9) { animation-delay: 0.9s; }
.flow-svg text:nth-child(10) { animation-delay: 1.25s; }
.flow-svg text:nth-child(11) { animation-delay: 1.3s; }
.flow-svg text:nth-child(12) { animation-delay: 1.65s; }
.flow-svg text:nth-child(13) { animation-delay: 1.7s; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 20px; }
  .hero-diagram { order: -1; margin-bottom: 20px; }
  .flow-svg { max-width: 300px; }
}

/* ---------- Section kicker ---------- */
.section-kicker {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0 0 16px;
}

/* ---------- Principles ---------- */
.principles {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 32px;
  border-top: 1px solid var(--gray-line);
}

.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}

.principle {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.principle:hover { transform: translateY(-4px); }

.principle h3 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  position: relative;
  display: inline-block;
}
.principle h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 28px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0.5);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.principle:hover h3::after { transform: scaleX(1); }

.principle p {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--gray-mid);
  margin: 14px 0 0;
}

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

/* ---------- Process ---------- */
.process {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 32px;
  border-top: 1px solid var(--gray-line);
}

.process-title {
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 56px;
  max-width: 34ch;
}

.process-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.process-step {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid var(--gray-line);
  transition: border-color 0.3s ease;
}
.process-step:last-child { border-bottom: 1px solid var(--gray-line); }
.process-step:hover { border-color: var(--accent); }

.step-num {
  font-family: 'Space Mono', var(--sans), monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-mid);
  padding-top: 4px;
  transition: color 0.3s ease;
}
.process-step:hover .step-num { color: var(--accent); }

.process-step h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.process-step p {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--gray-mid);
  margin: 0;
  max-width: 56ch;
}

@media (max-width: 700px) {
  .process-step { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- Work ---------- */
.work {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 32px;
  border-top: 1px solid var(--gray-line);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.work h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.work-lead {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--gray-mid);
  max-width: 50ch;
  margin: 0;
}

.work-visual { display: flex; justify-content: center; }
.mesh-svg { width: 100%; max-width: 300px; }
.mesh-grid line { stroke: var(--gray-line); stroke-width: 1; }
.mesh-dot { fill: var(--gray-mid); }
.mesh-path { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.6; }

@media (max-width: 900px) {
  .work { grid-template-columns: 1fr; }
  .work-visual { order: -1; }
}

/* ---------- Projects carousel ---------- */
.projects {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 0;
  border-top: 1px solid var(--gray-line);
}

.projects-title {
  font-family: var(--display);
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 48px;
  padding: 0 32px;
}

.carousel {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 64px, black calc(100% - 64px), transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 64px, black calc(100% - 64px), transparent);
}

.carousel-track {
  display: flex;
  width: max-content;
  gap: 16px;
  padding: 0 32px;
  animation: spin 22s linear infinite;
}
.carousel-track.no-spin { animation: none; }

@keyframes spin {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.project-card {
  position: relative;
  flex: 0 0 auto;
  width: 140px;
  text-decoration: none;
  color: var(--black);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gray-line);
}

.project-card img {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.project-card:hover img {
  filter: grayscale(0);
  transform: scale(1.03);
}

.project-name {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 8px 10px;
  border-top: 1px solid var(--gray-line);
}

@media (max-width: 640px) {
  .project-card { width: 110px; }
  .project-card img { height: 80px; }
}

/* ---------- CTA / Contact ---------- */
.cta {
  background: var(--black);
  color: var(--white);
  padding: 100px 32px;
  text-align: left;
}

.cta-inner {
  max-width: 560px;
  margin: 0 auto;
}

.cta h2 {
  font-family: var(--display);
  margin: 0 0 16px;
  font-size: clamp(2rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.cta-lead {
  font-family: var(--sans);
  color: #B8B8B4;
  font-size: 1rem;
  margin: 0 0 48px;
  max-width: 52ch;
}

.cta-direct {
  margin: 8px 0 0;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 1rem;
}
.cta-direct a {
  color: var(--white);
  text-decoration: none;
  border-bottom: 1px solid #3A3A3A;
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.cta-direct a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--gray-mid);
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--black); }
.footer-links { display: flex; gap: 20px; }
